Skip to content

Commit

Permalink
Support cloud scheduler update (#4409) (#364)
Browse files Browse the repository at this point in the history
* Specify which apis are required for cloud scheduler

* Add support update api for cloud scheduler

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Jan 19, 2021
1 parent df8a9d7 commit c48fc6a
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions plugins/modules/gcp_cloudscheduler_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,8 +717,8 @@ def create(module, link):


def update(module, link):
delete(module, self_link(module))
create(module, collection(module))
auth = GcpSession(module, 'cloudscheduler')
return return_if_object(module, auth.patch(link, resource_to_request(module)))


def delete(module, link):
Expand Down Expand Up @@ -807,14 +807,14 @@ def is_different(module, response):
def response_to_hash(module, response):
return {
u'name': module.params.get('name'),
u'description': module.params.get('description'),
u'schedule': module.params.get('schedule'),
u'timeZone': module.params.get('time_zone'),
u'attemptDeadline': module.params.get('attempt_deadline'),
u'retryConfig': JobRetryconfig(module.params.get('retry_config', {}), module).to_request(),
u'pubsubTarget': JobPubsubtarget(module.params.get('pubsub_target', {}), module).to_request(),
u'appEngineHttpTarget': JobAppenginehttptarget(module.params.get('app_engine_http_target', {}), module).to_request(),
u'httpTarget': JobHttptarget(module.params.get('http_target', {}), module).to_request(),
u'description': response.get(u'description'),
u'schedule': response.get(u'schedule'),
u'timeZone': response.get(u'timeZone'),
u'attemptDeadline': response.get(u'attemptDeadline'),
u'retryConfig': JobRetryconfig(response.get(u'retryConfig', {}), module).from_response(),
u'pubsubTarget': JobPubsubtarget(response.get(u'pubsubTarget', {}), module).from_response(),
u'appEngineHttpTarget': JobAppenginehttptarget(response.get(u'appEngineHttpTarget', {}), module).from_response(),
u'httpTarget': JobHttptarget(response.get(u'httpTarget', {}), module).from_response(),
}


Expand Down Expand Up @@ -852,11 +852,11 @@ def to_request(self):
def from_response(self):
return remove_nones_from_dict(
{
u'retryCount': self.module.params.get('retry_count'),
u'maxRetryDuration': self.module.params.get('max_retry_duration'),
u'minBackoffDuration': self.module.params.get('min_backoff_duration'),
u'maxBackoffDuration': self.module.params.get('max_backoff_duration'),
u'maxDoublings': self.module.params.get('max_doublings'),
u'retryCount': self.request.get(u'retryCount'),
u'maxRetryDuration': self.request.get(u'maxRetryDuration'),
u'minBackoffDuration': self.request.get(u'minBackoffDuration'),
u'maxBackoffDuration': self.request.get(u'maxBackoffDuration'),
u'maxDoublings': self.request.get(u'maxDoublings'),
}
)

Expand All @@ -876,7 +876,7 @@ def to_request(self):

def from_response(self):
return remove_nones_from_dict(
{u'topicName': self.module.params.get('topic_name'), u'data': self.module.params.get('data'), u'attributes': self.module.params.get('attributes')}
{u'topicName': self.request.get(u'topicName'), u'data': self.request.get(u'data'), u'attributes': self.request.get(u'attributes')}
)


Expand All @@ -902,11 +902,11 @@ def to_request(self):
def from_response(self):
return remove_nones_from_dict(
{
u'httpMethod': self.module.params.get('http_method'),
u'appEngineRouting': JobAppenginerouting(self.module.params.get('app_engine_routing', {}), self.module).to_request(),
u'httpMethod': self.request.get(u'httpMethod'),
u'appEngineRouting': JobAppenginerouting(self.request.get(u'appEngineRouting', {}), self.module).from_response(),
u'relativeUri': self.request.get(u'relativeUri'),
u'body': self.module.params.get('body'),
u'headers': self.module.params.get('headers'),
u'body': self.request.get(u'body'),
u'headers': self.request.get(u'headers'),
}
)

Expand All @@ -926,7 +926,7 @@ def to_request(self):

def from_response(self):
return remove_nones_from_dict(
{u'service': self.module.params.get('service'), u'version': self.module.params.get('version'), u'instance': self.module.params.get('instance')}
{u'service': self.request.get(u'service'), u'version': self.request.get(u'version'), u'instance': self.request.get(u'instance')}
)


Expand Down Expand Up @@ -957,8 +957,8 @@ def from_response(self):
u'httpMethod': self.request.get(u'httpMethod'),
u'body': self.request.get(u'body'),
u'headers': self.request.get(u'headers'),
u'oauthToken': JobOauthtoken(self.module.params.get('oauth_token', {}), self.module).to_request(),
u'oidcToken': JobOidctoken(self.module.params.get('oidc_token', {}), self.module).to_request(),
u'oauthToken': JobOauthtoken(self.request.get(u'oauthToken', {}), self.module).from_response(),
u'oidcToken': JobOidctoken(self.request.get(u'oidcToken', {}), self.module).from_response(),
}
)

Expand Down

0 comments on commit c48fc6a

Please sign in to comment.