Add fingerprint, securityPolicy to BackendService (#222)

+ increase validation

Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
The Magician 2019-04-02 14:32:02 -07:00 committed by Alex Stephen
parent aa34638e35
commit 795304780b
2 changed files with 51 additions and 34 deletions

View file

@ -67,6 +67,7 @@ options:
Valid values are UTILIZATION, RATE (for HTTP(S)) and CONNECTION (for TCP/SSL). Valid values are UTILIZATION, RATE (for HTTP(S)) and CONNECTION (for TCP/SSL).
- This cannot be used for internal load balancing. - This cannot be used for internal load balancing.
required: false required: false
default: UTILIZATION
choices: choices:
- UTILIZATION - UTILIZATION
- RATE - RATE
@ -81,6 +82,7 @@ options:
[0.0,1.0]. [0.0,1.0].
- This cannot be used for internal load balancing. - This cannot be used for internal load balancing.
required: false required: false
default: '1.0'
description: description:
description: description:
- An optional description of this resource. - An optional description of this resource.
@ -140,6 +142,7 @@ options:
target for the group. The default is 0.8. Valid range is [0.0, 1.0]. target for the group. The default is 0.8. Valid range is [0.0, 1.0].
- This cannot be used for internal load balancing. - This cannot be used for internal load balancing.
required: false required: false
default: '0.8'
cdn_policy: cdn_policy:
description: description:
- Cloud CDN configuration for this BackendService. - Cloud CDN configuration for this BackendService.
@ -196,7 +199,7 @@ options:
version_added: 2.8 version_added: 2.8
connection_draining: connection_draining:
description: description:
- Settings for connection draining. - Settings for connection draining .
required: false required: false
suboptions: suboptions:
draining_timeout_sec: draining_timeout_sec:
@ -204,6 +207,7 @@ options:
- Time for which instance will be drained (not accept new connections, but - Time for which instance will be drained (not accept new connections, but
still work to finish started). still work to finish started).
required: false required: false
default: '300'
description: description:
description: description:
- An optional description of this resource. - An optional description of this resource.
@ -221,7 +225,7 @@ options:
and a health check is required. and a health check is required.
- For internal load balancing, a URL to a HealthCheck resource must be specified - For internal load balancing, a URL to a HealthCheck resource must be specified
instead. instead.
required: false required: true
iap: iap:
description: description:
- Settings for enabling Cloud Identity Aware Proxy. - Settings for enabling Cloud Identity Aware Proxy.
@ -235,12 +239,12 @@ options:
type: bool type: bool
oauth2_client_id: oauth2_client_id:
description: description:
- OAuth2 Client ID for IAP. - OAuth2 Client ID for IAP .
required: false required: true
oauth2_client_secret: oauth2_client_secret:
description: description:
- OAuth2 Client Secret for IAP. - OAuth2 Client Secret for IAP .
required: false required: true
load_balancing_scheme: load_balancing_scheme:
description: description:
- Indicates whether the backend service will be used with internal or external - Indicates whether the backend service will be used with internal or external
@ -259,7 +263,7 @@ options:
which means the first character must be a lowercase letter, and all following which means the first character must be a lowercase letter, and all following
characters must be a dash, lowercase letter, or digit, except the last character, characters must be a dash, lowercase letter, or digit, except the last character,
which cannot be a dash. which cannot be a dash.
required: false required: true
port_name: port_name:
description: description:
- Name of backend port. The same name should appear in the instance groups referenced - Name of backend port. The same name should appear in the instance groups referenced
@ -278,11 +282,11 @@ options:
- HTTPS - HTTPS
- TCP - TCP
- SSL - SSL
region: security_policy:
description: description:
- The region where the regional backend service resides. - The security policy associated with this backend service.
- This field is not applicable to global backend services.
required: false required: false
version_added: 2.8
session_affinity: session_affinity:
description: description:
- Type of session affinity to use. The default is NONE. - Type of session affinity to use. The default is NONE.
@ -501,7 +505,7 @@ cdnPolicy:
type: int type: int
connectionDraining: connectionDraining:
description: description:
- Settings for connection draining. - Settings for connection draining .
returned: success returned: success
type: complex type: complex
contains: contains:
@ -516,6 +520,12 @@ creationTimestamp:
- Creation timestamp in RFC3339 text format. - Creation timestamp in RFC3339 text format.
returned: success returned: success
type: str type: str
fingerprint:
description:
- Fingerprint of this resource. A hash of the contents stored in this object. This
field is used in optimistic locking.
returned: success
type: str
description: description:
description: description:
- An optional description of this resource. - An optional description of this resource.
@ -554,17 +564,17 @@ iap:
type: bool type: bool
oauth2ClientId: oauth2ClientId:
description: description:
- OAuth2 Client ID for IAP. - OAuth2 Client ID for IAP .
returned: success returned: success
type: str type: str
oauth2ClientSecret: oauth2ClientSecret:
description: description:
- OAuth2 Client Secret for IAP. - OAuth2 Client Secret for IAP .
returned: success returned: success
type: str type: str
oauth2ClientSecretSha256: oauth2ClientSecretSha256:
description: description:
- OAuth2 Client Secret SHA-256 for IAP. - OAuth2 Client Secret SHA-256 for IAP .
returned: success returned: success
type: str type: str
loadBalancingScheme: loadBalancingScheme:
@ -599,10 +609,9 @@ protocol:
is TCP. is TCP.
returned: success returned: success
type: str type: str
region: securityPolicy:
description: description:
- The region where the regional backend service resides. - The security policy associated with this backend service.
- This field is not applicable to global backend services.
returned: success returned: success
type: str type: str
sessionAffinity: sessionAffinity:
@ -646,15 +655,15 @@ def main():
type='list', type='list',
elements='dict', elements='dict',
options=dict( options=dict(
balancing_mode=dict(type='str', choices=['UTILIZATION', 'RATE', 'CONNECTION']), balancing_mode=dict(default='UTILIZATION', type='str', choices=['UTILIZATION', 'RATE', 'CONNECTION']),
capacity_scaler=dict(type='str'), capacity_scaler=dict(default=1.0, type='str'),
description=dict(type='str'), description=dict(type='str'),
group=dict(), group=dict(),
max_connections=dict(type='int'), max_connections=dict(type='int'),
max_connections_per_instance=dict(type='int'), max_connections_per_instance=dict(type='int'),
max_rate=dict(type='int'), max_rate=dict(type='int'),
max_rate_per_instance=dict(type='str'), max_rate_per_instance=dict(type='str'),
max_utilization=dict(type='str'), max_utilization=dict(default=0.8, type='str'),
), ),
), ),
cdn_policy=dict( cdn_policy=dict(
@ -673,16 +682,19 @@ def main():
signed_url_cache_max_age_sec=dict(default=3600, type='int'), signed_url_cache_max_age_sec=dict(default=3600, type='int'),
), ),
), ),
connection_draining=dict(type='dict', options=dict(draining_timeout_sec=dict(type='int'))), connection_draining=dict(type='dict', options=dict(draining_timeout_sec=dict(default=300, type='int'))),
description=dict(type='str'), description=dict(type='str'),
enable_cdn=dict(type='bool'), enable_cdn=dict(type='bool'),
health_checks=dict(type='list', elements='str'), health_checks=dict(required=True, type='list', elements='str'),
iap=dict(type='dict', options=dict(enabled=dict(type='bool'), oauth2_client_id=dict(type='str'), oauth2_client_secret=dict(type='str'))), iap=dict(
type='dict',
options=dict(enabled=dict(type='bool'), oauth2_client_id=dict(required=True, type='str'), oauth2_client_secret=dict(required=True, type='str')),
),
load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']), load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']),
name=dict(type='str'), name=dict(required=True, type='str'),
port_name=dict(type='str'), port_name=dict(type='str'),
protocol=dict(type='str', choices=['HTTP', 'HTTPS', 'TCP', 'SSL']), protocol=dict(type='str', choices=['HTTP', 'HTTPS', 'TCP', 'SSL']),
region=dict(type='str'), security_policy=dict(type='str'),
session_affinity=dict(type='str', choices=['NONE', 'CLIENT_IP', 'GENERATED_COOKIE', 'CLIENT_IP_PROTO', 'CLIENT_IP_PORT_PROTO']), session_affinity=dict(type='str', choices=['NONE', 'CLIENT_IP', 'GENERATED_COOKIE', 'CLIENT_IP_PROTO', 'CLIENT_IP_PORT_PROTO']),
timeout_sec=dict(type='int', aliases=['timeout_seconds']), timeout_sec=dict(type='int', aliases=['timeout_seconds']),
) )
@ -700,7 +712,7 @@ def main():
if fetch: if fetch:
if state == 'present': if state == 'present':
if is_different(module, fetch): if is_different(module, fetch):
update(module, self_link(module), kind) update(module, self_link(module), kind, fetch)
fetch = fetch_resource(module, self_link(module), kind) fetch = fetch_resource(module, self_link(module), kind)
changed = True changed = True
else: else:
@ -842,7 +854,7 @@ def response_to_hash(module, response):
u'healthChecks': response.get(u'healthChecks'), u'healthChecks': response.get(u'healthChecks'),
u'id': response.get(u'id'), u'id': response.get(u'id'),
u'iap': BackendServiceIap(response.get(u'iap', {}), module).from_response(), u'iap': BackendServiceIap(response.get(u'iap', {}), module).from_response(),
u'loadBalancingScheme': module.params.get('load_balancing_scheme'), u'loadBalancingScheme': response.get(u'loadBalancingScheme'),
u'name': module.params.get('name'), u'name': module.params.get('name'),
u'portName': response.get(u'portName'), u'portName': response.get(u'portName'),
u'protocol': response.get(u'protocol'), u'protocol': response.get(u'protocol'),

View file

@ -219,7 +219,7 @@ items:
type: int type: int
connectionDraining: connectionDraining:
description: description:
- Settings for connection draining. - Settings for connection draining .
returned: success returned: success
type: complex type: complex
contains: contains:
@ -234,6 +234,12 @@ items:
- Creation timestamp in RFC3339 text format. - Creation timestamp in RFC3339 text format.
returned: success returned: success
type: str type: str
fingerprint:
description:
- Fingerprint of this resource. A hash of the contents stored in this object.
This field is used in optimistic locking.
returned: success
type: str
description: description:
description: description:
- An optional description of this resource. - An optional description of this resource.
@ -272,17 +278,17 @@ items:
type: bool type: bool
oauth2ClientId: oauth2ClientId:
description: description:
- OAuth2 Client ID for IAP. - OAuth2 Client ID for IAP .
returned: success returned: success
type: str type: str
oauth2ClientSecret: oauth2ClientSecret:
description: description:
- OAuth2 Client Secret for IAP. - OAuth2 Client Secret for IAP .
returned: success returned: success
type: str type: str
oauth2ClientSecretSha256: oauth2ClientSecretSha256:
description: description:
- OAuth2 Client Secret SHA-256 for IAP. - OAuth2 Client Secret SHA-256 for IAP .
returned: success returned: success
type: str type: str
loadBalancingScheme: loadBalancingScheme:
@ -317,10 +323,9 @@ items:
default is TCP. default is TCP.
returned: success returned: success
type: str type: str
region: securityPolicy:
description: description:
- The region where the regional backend service resides. - The security policy associated with this backend service.
- This field is not applicable to global backend services.
returned: success returned: success
type: str type: str
sessionAffinity: sessionAffinity: