From 28b67d809f14640279e5ee20de43473cd5fb4190 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 20 Jun 2019 17:51:44 -0700 Subject: [PATCH] Bug fixes for GCP modules (#58107) --- .../google/gcp_compute_backend_service.py | 56 ++++++++++++++++--- .../gcp_compute_backend_service_facts.py | 25 +++++++-- 2 files changed, 69 insertions(+), 12 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index 2b67537e736..bd02a46f2ef 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -105,8 +105,8 @@ options: description: - The max number of simultaneous connections for the group. Can be used with either CONNECTION or UTILIZATION balancing modes. - - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance - must be set. + - For CONNECTION mode, either maxConnections or one of maxConnectionsPerInstance + or maxConnectionsPerEndpoint, as appropriate for group type, must be set. required: false max_connections_per_instance: description: @@ -116,12 +116,21 @@ options: - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be set. required: false + max_connections_per_endpoint: + description: + - The max number of simultaneous connections that a single backend network + endpoint can handle. This is used to calculate the capacity of the group. + Can be used in either CONNECTION or UTILIZATION balancing modes. + - For CONNECTION mode, either maxConnections or maxConnectionsPerEndpoint + must be set. + required: false + version_added: 2.9 max_rate: description: - The max requests per second (RPS) of the group. - Can be used with either RATE or UTILIZATION balancing modes, but required - if RATE mode. For RATE mode, either maxRate or maxRatePerInstance must be - set. + if RATE mode. For RATE mode, either maxRate or one of maxRatePerInstance + or maxRatePerEndpoint, as appropriate for group type, must be set. required: false max_rate_per_instance: description: @@ -130,6 +139,14 @@ options: balancing mode. For RATE mode, either maxRate or maxRatePerInstance must be set. required: false + max_rate_per_endpoint: + description: + - The max requests per second (RPS) that a single backend network endpoint + can handle. This is used to calculate the capacity of the group. Can be + used in either balancing mode. For RATE mode, either maxRate or maxRatePerEndpoint + must be set. + required: false + version_added: 2.9 max_utilization: description: - Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization @@ -389,8 +406,8 @@ backends: description: - The max number of simultaneous connections for the group. Can be used with either CONNECTION or UTILIZATION balancing modes. - - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must - be set. + - For CONNECTION mode, either maxConnections or one of maxConnectionsPerInstance + or maxConnectionsPerEndpoint, as appropriate for group type, must be set. returned: success type: int maxConnectionsPerInstance: @@ -402,12 +419,21 @@ backends: be set. returned: success type: int + maxConnectionsPerEndpoint: + description: + - The max number of simultaneous connections that a single backend network endpoint + can handle. This is used to calculate the capacity of the group. Can be used + in either CONNECTION or UTILIZATION balancing modes. + - For CONNECTION mode, either maxConnections or maxConnectionsPerEndpoint must + be set. + returned: success + type: int maxRate: description: - The max requests per second (RPS) of the group. - Can be used with either RATE or UTILIZATION balancing modes, but required - if RATE mode. For RATE mode, either maxRate or maxRatePerInstance must be - set. + if RATE mode. For RATE mode, either maxRate or one of maxRatePerInstance or + maxRatePerEndpoint, as appropriate for group type, must be set. returned: success type: int maxRatePerInstance: @@ -418,6 +444,14 @@ backends: set. returned: success type: str + maxRatePerEndpoint: + description: + - The max requests per second (RPS) that a single backend network endpoint can + handle. This is used to calculate the capacity of the group. Can be used in + either balancing mode. For RATE mode, either maxRate or maxRatePerEndpoint + must be set. + returned: success + type: str maxUtilization: description: - Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization @@ -636,8 +670,10 @@ def main(): group=dict(type='str'), max_connections=dict(type='int'), max_connections_per_instance=dict(type='int'), + max_connections_per_endpoint=dict(type='int'), max_rate=dict(type='int'), max_rate_per_instance=dict(type='str'), + max_rate_per_endpoint=dict(type='str'), max_utilization=dict(default=0.8, type='str'), ), ), @@ -903,8 +939,10 @@ class BackendServiceBackendsArray(object): u'group': item.get('group'), u'maxConnections': item.get('max_connections'), u'maxConnectionsPerInstance': item.get('max_connections_per_instance'), + u'maxConnectionsPerEndpoint': item.get('max_connections_per_endpoint'), u'maxRate': item.get('max_rate'), u'maxRatePerInstance': item.get('max_rate_per_instance'), + u'maxRatePerEndpoint': item.get('max_rate_per_endpoint'), u'maxUtilization': item.get('max_utilization'), } ) @@ -918,8 +956,10 @@ class BackendServiceBackendsArray(object): u'group': item.get(u'group'), u'maxConnections': item.get(u'maxConnections'), u'maxConnectionsPerInstance': item.get(u'maxConnectionsPerInstance'), + u'maxConnectionsPerEndpoint': item.get(u'maxConnectionsPerEndpoint'), u'maxRate': item.get(u'maxRate'), u'maxRatePerInstance': item.get(u'maxRatePerInstance'), + u'maxRatePerEndpoint': item.get(u'maxRatePerEndpoint'), u'maxUtilization': item.get(u'maxUtilization'), } ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index a6fb0d6b0c2..4602cdf0590 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -123,8 +123,8 @@ resources: description: - The max number of simultaneous connections for the group. Can be used with either CONNECTION or UTILIZATION balancing modes. - - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance - must be set. + - For CONNECTION mode, either maxConnections or one of maxConnectionsPerInstance + or maxConnectionsPerEndpoint, as appropriate for group type, must be set. returned: success type: int maxConnectionsPerInstance: @@ -136,12 +136,21 @@ resources: must be set. returned: success type: int + maxConnectionsPerEndpoint: + description: + - The max number of simultaneous connections that a single backend network + endpoint can handle. This is used to calculate the capacity of the group. + Can be used in either CONNECTION or UTILIZATION balancing modes. + - For CONNECTION mode, either maxConnections or maxConnectionsPerEndpoint + must be set. + returned: success + type: int maxRate: description: - The max requests per second (RPS) of the group. - Can be used with either RATE or UTILIZATION balancing modes, but required - if RATE mode. For RATE mode, either maxRate or maxRatePerInstance must - be set. + if RATE mode. For RATE mode, either maxRate or one of maxRatePerInstance + or maxRatePerEndpoint, as appropriate for group type, must be set. returned: success type: int maxRatePerInstance: @@ -152,6 +161,14 @@ resources: be set. returned: success type: str + maxRatePerEndpoint: + description: + - The max requests per second (RPS) that a single backend network endpoint + can handle. This is used to calculate the capacity of the group. Can be + used in either balancing mode. For RATE mode, either maxRate or maxRatePerEndpoint + must be set. + returned: success + type: str maxUtilization: description: - Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization