GCP Bug Fixes (#48276)

* GCP Bug fixes

* added util file changes
This commit is contained in:
Alex Stephen 2018-11-15 05:44:10 -08:00
commit d64785e811
80 changed files with 14198 additions and 13862 deletions

View file

@ -32,63 +32,65 @@ DOCUMENTATION = '''
---
module: gcp_pubsub_subscription
description:
- A named resource representing the stream of messages from a single, specific topic,
to be delivered to the subscribing application.
- A named resource representing the stream of messages from a single, specific topic,
to be delivered to the subscribing application.
short_description: Creates a GCP Subscription
version_added: 2.6
author: Google Inc. (@googlecloudplatform)
requirements:
- python >= 2.6
- requests >= 2.18.4
- google-auth >= 1.3.0
- python >= 2.6
- requests >= 2.18.4
- google-auth >= 1.3.0
options:
state:
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
name:
description:
- Name of the subscription.
required: false
topic:
description:
- A reference to a Topic resource.
- 'This field represents a link to a Topic resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_pubsub_topic
task and then set this topic field to "{{ name-of-resource }}" Alternatively,
you can set this topic to a dictionary with the name key where the value is
the name of your Topic'
required: false
push_config:
description:
- If push delivery is used with this subscription, this field is used to configure
it. An empty pushConfig signifies that the subscriber will pull and ack messages
using API methods.
required: false
suboptions:
push_endpoint:
description:
- Whether the given object should exist in GCP
choices: ['present', 'absent']
default: 'present'
name:
description:
- Name of the subscription.
required: false
topic:
description:
- A reference to a Topic resource.
- 'This field represents a link to a Topic resource in GCP. It can be specified in
two ways. You can add `register: name-of-resource` to a gcp_pubsub_topic task and
then set this topic field to "{{ name-of-resource }}" Alternatively, you can set
this topic to a dictionary with the name key where the value is the name of your
Topic.'
required: false
push_config:
description:
- If push delivery is used with this subscription, this field is used to configure
it. An empty pushConfig signifies that the subscriber will pull and ack messages
using API methods.
required: false
suboptions:
push_endpoint:
description:
- A URL locating the endpoint to which messages should be pushed.
- For example, a Webhook endpoint might use "U(https://example.com/push".)
required: false
ack_deadline_seconds:
description:
- This value is the maximum time after a subscriber receives a message before the
subscriber should acknowledge the message. After message delivery but before the
ack deadline expires and before the message is acknowledged, it is an outstanding
message and will not be delivered again during that time (on a best-effort basis).
- For pull subscriptions, this value is used as the initial value for the ack deadline.
To override this value for a given message, call subscriptions.modifyAckDeadline
with the corresponding ackId if using pull. The minimum custom deadline you can
specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds
(10 minutes).
- If this parameter is 0, a default value of 10 seconds is used.
- For push delivery, this value is also used to set the request timeout for the call
to the push endpoint.
- If the subscriber never acknowledges the message, the Pub/Sub system will eventually
redeliver the message.
- A URL locating the endpoint to which messages should be pushed.
- For example, a Webhook endpoint might use "U(https://example.com/push".)
required: false
ack_deadline_seconds:
description:
- This value is the maximum time after a subscriber receives a message before
the subscriber should acknowledge the message. After message delivery but before
the ack deadline expires and before the message is acknowledged, it is an outstanding
message and will not be delivered again during that time (on a best-effort basis).
- For pull subscriptions, this value is used as the initial value for the ack
deadline. To override this value for a given message, call subscriptions.modifyAckDeadline
with the corresponding ackId if using pull. The minimum custom deadline you
can specify is 10 seconds. The maximum custom deadline you can specify is 600
seconds (10 minutes).
- If this parameter is 0, a default value of 10 seconds is used.
- For push delivery, this value is also used to set the request timeout for the
call to the push endpoint.
- If the subscriber never acknowledges the message, the Pub/Sub system will eventually
redeliver the message.
required: false
extends_documentation_fragment: gcp
'''
@ -116,48 +118,48 @@ EXAMPLES = '''
'''
RETURN = '''
name:
description:
- Name of the subscription.
returned: success
type: str
topic:
description:
- A reference to a Topic resource.
returned: success
type: dict
pushConfig:
description:
- If push delivery is used with this subscription, this field is used to configure
it. An empty pushConfig signifies that the subscriber will pull and ack messages
using API methods.
returned: success
type: complex
contains:
pushEndpoint:
description:
- A URL locating the endpoint to which messages should be pushed.
- For example, a Webhook endpoint might use "U(https://example.com/push".)
returned: success
type: str
ackDeadlineSeconds:
description:
- This value is the maximum time after a subscriber receives a message before the
subscriber should acknowledge the message. After message delivery but before the
ack deadline expires and before the message is acknowledged, it is an outstanding
message and will not be delivered again during that time (on a best-effort basis).
- For pull subscriptions, this value is used as the initial value for the ack deadline.
To override this value for a given message, call subscriptions.modifyAckDeadline
with the corresponding ackId if using pull. The minimum custom deadline you can
specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds
(10 minutes).
- If this parameter is 0, a default value of 10 seconds is used.
- For push delivery, this value is also used to set the request timeout for the call
to the push endpoint.
- If the subscriber never acknowledges the message, the Pub/Sub system will eventually
redeliver the message.
returned: success
type: int
name:
description:
- Name of the subscription.
returned: success
type: str
topic:
description:
- A reference to a Topic resource.
returned: success
type: dict
pushConfig:
description:
- If push delivery is used with this subscription, this field is used to configure
it. An empty pushConfig signifies that the subscriber will pull and ack messages
using API methods.
returned: success
type: complex
contains:
pushEndpoint:
description:
- A URL locating the endpoint to which messages should be pushed.
- For example, a Webhook endpoint might use "U(https://example.com/push".)
returned: success
type: str
ackDeadlineSeconds:
description:
- This value is the maximum time after a subscriber receives a message before the
subscriber should acknowledge the message. After message delivery but before the
ack deadline expires and before the message is acknowledged, it is an outstanding
message and will not be delivered again during that time (on a best-effort basis).
- For pull subscriptions, this value is used as the initial value for the ack deadline.
To override this value for a given message, call subscriptions.modifyAckDeadline
with the corresponding ackId if using pull. The minimum custom deadline you can
specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds
(10 minutes).
- If this parameter is 0, a default value of 10 seconds is used.
- For push delivery, this value is also used to set the request timeout for the
call to the push endpoint.
- If the subscriber never acknowledges the message, the Pub/Sub system will eventually
redeliver the message.
returned: success
type: int
'''
################################################################################
@ -235,7 +237,7 @@ def resource_to_request(module):
request = {
u'name': module.params.get('name'),
u'topic': replace_resource_dict(module.params.get(u'topic', {}), 'name'),
u'pushConfig': SubscriptionPushConfig(module.params.get('push_config', {}), module).to_request(),
u'pushConfig': SubscriptionPushconfig(module.params.get('push_config', {}), module).to_request(),
u'ackDeadlineSeconds': module.params.get('ack_deadline_seconds')
}
request = encode_request(request, module)
@ -308,7 +310,7 @@ def response_to_hash(module, response):
return {
u'name': response.get(u'name'),
u'topic': response.get(u'topic'),
u'pushConfig': SubscriptionPushConfig(response.get(u'pushConfig', {}), module).from_response(),
u'pushConfig': SubscriptionPushconfig(response.get(u'pushConfig', {}), module).from_response(),
u'ackDeadlineSeconds': response.get(u'ackDeadlineSeconds')
}
@ -332,7 +334,7 @@ def encode_request(request, module):
return request
class SubscriptionPushConfig(object):
class SubscriptionPushconfig(object):
def __init__(self, request, module):
self.module = module
if request: