mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-06 19:00:27 -07:00
Add RegionHealthCheck to compute
Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
parent
66cb57dfc6
commit
895932a90f
2 changed files with 227 additions and 2 deletions
|
@ -107,7 +107,7 @@ options:
|
|||
- Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If not
|
||||
specified, the default is TCP. Exactly one of the protocol-specific health check
|
||||
field must be specified, which must match type field.
|
||||
- 'Some valid choices include: "TCP", "SSL", "HTTP", "HTTPS"'
|
||||
- 'Some valid choices include: "TCP", "SSL", "HTTP", "HTTPS", "HTTP2"'
|
||||
required: false
|
||||
type: str
|
||||
http_health_check:
|
||||
|
@ -344,6 +344,68 @@ options:
|
|||
required: false
|
||||
type: str
|
||||
version_added: '2.9'
|
||||
http2_health_check:
|
||||
description:
|
||||
- A nested object resource.
|
||||
required: false
|
||||
type: dict
|
||||
version_added: '2.10'
|
||||
suboptions:
|
||||
host:
|
||||
description:
|
||||
- The value of the host header in the HTTP2 health check request.
|
||||
- If left empty (default value), the public IP on behalf of which this health
|
||||
check is performed will be used.
|
||||
required: false
|
||||
type: str
|
||||
request_path:
|
||||
description:
|
||||
- The request path of the HTTP2 health check request.
|
||||
- The default value is /.
|
||||
required: false
|
||||
default: "/"
|
||||
type: str
|
||||
response:
|
||||
description:
|
||||
- The bytes to match against the beginning of the response data. If left empty
|
||||
(the default value), any response will indicate health. The response data
|
||||
can only be ASCII.
|
||||
required: false
|
||||
type: str
|
||||
port:
|
||||
description:
|
||||
- The TCP port number for the HTTP2 health check request.
|
||||
- The default value is 443.
|
||||
required: false
|
||||
type: int
|
||||
port_name:
|
||||
description:
|
||||
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
|
||||
are defined, port takes precedence.
|
||||
required: false
|
||||
type: str
|
||||
proxy_header:
|
||||
description:
|
||||
- Specifies the type of proxy header to append before sending data to the
|
||||
backend, either NONE or PROXY_V1. The default is NONE.
|
||||
- 'Some valid choices include: "NONE", "PROXY_V1"'
|
||||
required: false
|
||||
default: NONE
|
||||
type: str
|
||||
port_specification:
|
||||
description:
|
||||
- 'Specifies how port is selected for health checking, can be one of the following
|
||||
values: * `USE_FIXED_PORT`: The port number in `port` is used for health
|
||||
checking.'
|
||||
- "* `USE_NAMED_PORT`: The `portName` is used for health checking."
|
||||
- "* `USE_SERVING_PORT`: For NetworkEndpointGroup, the port specified for
|
||||
each network endpoint is used for health checking. For other backends, the
|
||||
port or named port specified in the Backend Service is used for health checking."
|
||||
- If not specified, HTTP2 health check follows behavior specified in `port`
|
||||
and `portName` fields.
|
||||
- 'Some valid choices include: "USE_FIXED_PORT", "USE_NAMED_PORT", "USE_SERVING_PORT"'
|
||||
required: false
|
||||
type: str
|
||||
project:
|
||||
description:
|
||||
- The Google Cloud Platform project to use.
|
||||
|
@ -684,6 +746,62 @@ sslHealthCheck:
|
|||
`portName` fields.
|
||||
returned: success
|
||||
type: str
|
||||
http2HealthCheck:
|
||||
description:
|
||||
- A nested object resource.
|
||||
returned: success
|
||||
type: complex
|
||||
contains:
|
||||
host:
|
||||
description:
|
||||
- The value of the host header in the HTTP2 health check request.
|
||||
- If left empty (default value), the public IP on behalf of which this health
|
||||
check is performed will be used.
|
||||
returned: success
|
||||
type: str
|
||||
requestPath:
|
||||
description:
|
||||
- The request path of the HTTP2 health check request.
|
||||
- The default value is /.
|
||||
returned: success
|
||||
type: str
|
||||
response:
|
||||
description:
|
||||
- The bytes to match against the beginning of the response data. If left empty
|
||||
(the default value), any response will indicate health. The response data
|
||||
can only be ASCII.
|
||||
returned: success
|
||||
type: str
|
||||
port:
|
||||
description:
|
||||
- The TCP port number for the HTTP2 health check request.
|
||||
- The default value is 443.
|
||||
returned: success
|
||||
type: int
|
||||
portName:
|
||||
description:
|
||||
- Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name
|
||||
are defined, port takes precedence.
|
||||
returned: success
|
||||
type: str
|
||||
proxyHeader:
|
||||
description:
|
||||
- Specifies the type of proxy header to append before sending data to the backend,
|
||||
either NONE or PROXY_V1. The default is NONE.
|
||||
returned: success
|
||||
type: str
|
||||
portSpecification:
|
||||
description:
|
||||
- 'Specifies how port is selected for health checking, can be one of the following
|
||||
values: * `USE_FIXED_PORT`: The port number in `port` is used for health checking.'
|
||||
- "* `USE_NAMED_PORT`: The `portName` is used for health checking."
|
||||
- "* `USE_SERVING_PORT`: For NetworkEndpointGroup, the port specified for each
|
||||
network endpoint is used for health checking. For other backends, the port
|
||||
or named port specified in the Backend Service is used for health checking."
|
||||
- If not specified, HTTP2 health check follows behavior specified in `port`
|
||||
and `portName` fields.
|
||||
returned: success
|
||||
type: str
|
||||
'''
|
||||
|
||||
################################################################################
|
||||
|
@ -758,8 +876,20 @@ def main():
|
|||
port_specification=dict(type='str'),
|
||||
),
|
||||
),
|
||||
http2_health_check=dict(
|
||||
type='dict',
|
||||
options=dict(
|
||||
host=dict(type='str'),
|
||||
request_path=dict(default='/', type='str'),
|
||||
response=dict(type='str'),
|
||||
port=dict(type='int'),
|
||||
port_name=dict(type='str'),
|
||||
proxy_header=dict(default='NONE', type='str'),
|
||||
port_specification=dict(type='str'),
|
||||
),
|
||||
),
|
||||
),
|
||||
mutually_exclusive=[['http_health_check', 'https_health_check', 'ssl_health_check', 'tcp_health_check']],
|
||||
mutually_exclusive=[['http2_health_check', 'http_health_check', 'https_health_check', 'ssl_health_check', 'tcp_health_check']],
|
||||
)
|
||||
|
||||
if not module.params['scopes']:
|
||||
|
@ -822,6 +952,7 @@ def resource_to_request(module):
|
|||
u'httpsHealthCheck': HealthCheckHttpshealthcheck(module.params.get('https_health_check', {}), module).to_request(),
|
||||
u'tcpHealthCheck': HealthCheckTcphealthcheck(module.params.get('tcp_health_check', {}), module).to_request(),
|
||||
u'sslHealthCheck': HealthCheckSslhealthcheck(module.params.get('ssl_health_check', {}), module).to_request(),
|
||||
u'http2HealthCheck': HealthCheckHttp2healthcheck(module.params.get('http2_health_check', {}), module).to_request(),
|
||||
}
|
||||
return_vals = {}
|
||||
for k, v in request.items():
|
||||
|
@ -900,6 +1031,7 @@ def response_to_hash(module, response):
|
|||
u'httpsHealthCheck': HealthCheckHttpshealthcheck(response.get(u'httpsHealthCheck', {}), module).from_response(),
|
||||
u'tcpHealthCheck': HealthCheckTcphealthcheck(response.get(u'tcpHealthCheck', {}), module).from_response(),
|
||||
u'sslHealthCheck': HealthCheckSslhealthcheck(response.get(u'sslHealthCheck', {}), module).from_response(),
|
||||
u'http2HealthCheck': HealthCheckHttp2healthcheck(response.get(u'http2HealthCheck', {}), module).from_response(),
|
||||
}
|
||||
|
||||
|
||||
|
@ -1074,5 +1206,40 @@ class HealthCheckSslhealthcheck(object):
|
|||
)
|
||||
|
||||
|
||||
class HealthCheckHttp2healthcheck(object):
|
||||
def __init__(self, request, module):
|
||||
self.module = module
|
||||
if request:
|
||||
self.request = request
|
||||
else:
|
||||
self.request = {}
|
||||
|
||||
def to_request(self):
|
||||
return remove_nones_from_dict(
|
||||
{
|
||||
u'host': self.request.get('host'),
|
||||
u'requestPath': self.request.get('request_path'),
|
||||
u'response': self.request.get('response'),
|
||||
u'port': self.request.get('port'),
|
||||
u'portName': self.request.get('port_name'),
|
||||
u'proxyHeader': self.request.get('proxy_header'),
|
||||
u'portSpecification': self.request.get('port_specification'),
|
||||
}
|
||||
)
|
||||
|
||||
def from_response(self):
|
||||
return remove_nones_from_dict(
|
||||
{
|
||||
u'host': self.request.get(u'host'),
|
||||
u'requestPath': self.request.get(u'requestPath'),
|
||||
u'response': self.request.get(u'response'),
|
||||
u'port': self.request.get(u'port'),
|
||||
u'portName': self.request.get(u'portName'),
|
||||
u'proxyHeader': self.request.get(u'proxyHeader'),
|
||||
u'portSpecification': self.request.get(u'portSpecification'),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -394,6 +394,64 @@ resources:
|
|||
and `portName` fields.
|
||||
returned: success
|
||||
type: str
|
||||
http2HealthCheck:
|
||||
description:
|
||||
- A nested object resource.
|
||||
returned: success
|
||||
type: complex
|
||||
contains:
|
||||
host:
|
||||
description:
|
||||
- The value of the host header in the HTTP2 health check request.
|
||||
- If left empty (default value), the public IP on behalf of which this health
|
||||
check is performed will be used.
|
||||
returned: success
|
||||
type: str
|
||||
requestPath:
|
||||
description:
|
||||
- The request path of the HTTP2 health check request.
|
||||
- The default value is /.
|
||||
returned: success
|
||||
type: str
|
||||
response:
|
||||
description:
|
||||
- The bytes to match against the beginning of the response data. If left
|
||||
empty (the default value), any response will indicate health. The response
|
||||
data can only be ASCII.
|
||||
returned: success
|
||||
type: str
|
||||
port:
|
||||
description:
|
||||
- The TCP port number for the HTTP2 health check request.
|
||||
- The default value is 443.
|
||||
returned: success
|
||||
type: int
|
||||
portName:
|
||||
description:
|
||||
- Port name as defined in InstanceGroup#NamedPort#name. If both port and
|
||||
port_name are defined, port takes precedence.
|
||||
returned: success
|
||||
type: str
|
||||
proxyHeader:
|
||||
description:
|
||||
- Specifies the type of proxy header to append before sending data to the
|
||||
backend, either NONE or PROXY_V1. The default is NONE.
|
||||
returned: success
|
||||
type: str
|
||||
portSpecification:
|
||||
description:
|
||||
- 'Specifies how port is selected for health checking, can be one of the
|
||||
following values: * `USE_FIXED_PORT`: The port number in `port` is used
|
||||
for health checking.'
|
||||
- "* `USE_NAMED_PORT`: The `portName` is used for health checking."
|
||||
- "* `USE_SERVING_PORT`: For NetworkEndpointGroup, the port specified for
|
||||
each network endpoint is used for health checking. For other backends,
|
||||
the port or named port specified in the Backend Service is used for health
|
||||
checking."
|
||||
- If not specified, HTTP2 health check follows behavior specified in `port`
|
||||
and `portName` fields.
|
||||
returned: success
|
||||
type: str
|
||||
'''
|
||||
|
||||
################################################################################
|
||||
|
|
Loading…
Add table
Reference in a new issue