-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add paused
attribute to cloud_scheduler_job resource
#430
Conversation
Add `state` and `paused` attributes to the cloud scheduler job resources Based on: GoogleCloudPlatform/magic-modules#6304 Signed-off-by: William Yardley <[email protected]>
@sa-progress @clintoncwolfe I see you all have your own fork of Magic Modules now. I made this PR with the original one; I removed the updates to the headers and stuff to keep this as minimal as possible (and to keep things like having Side note: you may want to update the project README and the headers about code generation to make it clear to what extent this project is or isn't using Magic Modules now, and what the process is for requesting upstream changes (or requesting updates to resources), how inspec / Chef's fork is or isn't going to get updated from the GCP magic modules repo, etc. |
@sa-progress would you be able to take a look at this one? |
Going through your changes will provide input if required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at provided comment.
@@ -52,6 +54,8 @@ def parse | |||
@description = @fetched['description'] | |||
@schedule = @fetched['schedule'] | |||
@time_zone = @fetched['timeZone'] | |||
@state = @fetched['state'] | |||
@paused = @fetched['paused'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here paused is an enum value under state.
so when you will try to access @fetched['paused'] it will fail.
Please see the response of the api below:
{
"name": string,
"description": string,
"schedule": string,
"timeZone": string,
"userUpdateTime": string,
"state": enum ([State](https://cloud.google.com/scheduler/docs/reference/rest/v1beta1/projects.locations.jobs#State)),
"status": {
object (Status)
},
"scheduleTime": string,
"lastAttemptTime": string,
"retryConfig": {
object (RetryConfig)
},
"attemptDeadline": string,
"legacyAppEngineCron": boolean,
// Union field target can be only one of the following:
"pubsubTarget": {
object (PubsubTarget)
},
"appEngineHttpTarget": {
object (AppEngineHttpTarget)
},
"httpTarget": {
object (HttpTarget)
}
// End of list of possible types for union field target.
}
api -
response api
state enum has below values:
Enum values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. So if I pull out the stuff related to paused
completely, this should work because we'll be able to test if state
is equal to PAUSED
(in the case of a paused job), right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, since paused
is a top level attribute in Terraform itself, should the interface here stay the same, but we should just populate it from @fetched['state']
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is something we should implement by making an adjustment in inspec's fork of magic-modules, happy to work on trying to implement it that way too (I didn't know it existed at the time I created this).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! That is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes You can contribute to Magic module that will be the right thing to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sa-progress I think we basically want
GoogleCloudPlatform/magic-modules#6304
I have cherry-picked that in with attribution to the original author (@SarahFrench) as inspec/magic-modules#6
Because the original commit is also under a license that should be compatible, I've signed off on the commit, which I think is all Ok / allowed?
Closing for inspec/magic-modules#6 |
Description
Add
state
andpaused
attributes to the cloud scheduler job resourcesBased on:
GoogleCloudPlatform/magic-modules#6304
Issues Resolved
List any existing issues this PR resolves, or any Discourse or StackOverflow discussion that's relevant.
Please ensure commits have been signed-off for the Developer Certificate of Origin. See https://github.com/chef/chef/blob/master/CONTRIBUTING.md#developer-certification-of-origin-dco