Skip to content
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

RESOURCE-599 State added in Cloud Scheduler files generated from MM #439

Merged
merged 6 commits into from
May 3, 2023
Merged
5 changes: 5 additions & 0 deletions docs/resources/google_cloud_scheduler_job.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ Properties that can be accessed from the `google_cloud_scheduler_job` resource:

* `time_zone`: Specifies the time zone to be used in interpreting schedule. The value of this field must be a time zone name from the tz database.

* `state`: State of the job.
Possible values:
* ENABLED
* PAUSED

* `attempt_deadline`: The deadline for job attempts. If the request handler does not respond by this deadline then the request is cancelled and the attempt is marked as a DEADLINE_EXCEEDED failure. The failed attempt can be viewed in execution logs. Cloud Scheduler will retry the job according to the RetryConfig. The allowed duration for this deadline is: * For HTTP targets, between 15 seconds and 30 minutes. * For App Engine HTTP targets, between 15 seconds and 24 hours. * **Note**: For PubSub targets, this field is ignored - setting it will introduce an unresolvable diff. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s"

* `retry_config`: By default, if a job does not complete successfully, meaning that an acknowledgement is not received from the handler, then it will be retried with exponential backoff according to the settings
Expand Down
1 change: 1 addition & 0 deletions docs/resources/google_cloud_scheduler_jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ See [google_cloud_scheduler_job.md](google_cloud_scheduler_job.md) for more deta
* `descriptions`: an array of `google_cloud_scheduler_job` description
* `schedules`: an array of `google_cloud_scheduler_job` schedule
* `time_zones`: an array of `google_cloud_scheduler_job` time_zone
* `states`: an array of `google_cloud_scheduler_job` state
* `attempt_deadlines`: an array of `google_cloud_scheduler_job` attempt_deadline
* `retry_configs`: an array of `google_cloud_scheduler_job` retry_config
* `pubsub_targets`: an array of `google_cloud_scheduler_job` pubsub_target
Expand Down
2 changes: 1 addition & 1 deletion generate/generate-profile/attributes.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Below is to be uncommented and set with your GCP project ID:
# gcp_project_id: 'your-gcp-project'
gcp_project_id: 'your-gcp-project'
2 changes: 1 addition & 1 deletion generate/generate-profile/inspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ attributes:
description: 'The GCP project identifier.'
type: string
depends:
- name: inspec-gcp-generate
- name: inspec-gcp
path: ../
supports:
- platform: gcp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
Expand Down
4 changes: 3 additions & 1 deletion libraries/google_cloud_scheduler_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
Expand Down Expand Up @@ -33,6 +33,7 @@ class CloudSchedulerJob < GcpResourceBase
attr_reader :description
attr_reader :schedule
attr_reader :time_zone
attr_reader :state
attr_reader :attempt_deadline
attr_reader :retry_config
attr_reader :pubsub_target
Expand All @@ -52,6 +53,7 @@ def parse
@description = @fetched['description']
@schedule = @fetched['schedule']
@time_zone = @fetched['timeZone']
@state = @fetched['state']
@attempt_deadline = @fetched['attemptDeadline']
@retry_config = GoogleInSpec::CloudScheduler::Property::JobRetryConfig.new(@fetched['retryConfig'], to_s)
@pubsub_target = GoogleInSpec::CloudScheduler::Property::JobPubsubTarget.new(@fetched['pubsubTarget'], to_s)
Expand Down
4 changes: 3 additions & 1 deletion libraries/google_cloud_scheduler_jobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
Expand All @@ -27,6 +27,7 @@ class CloudSchedulerJobs < GcpResourceBase
filter_table_config.add(:descriptions, field: :description)
filter_table_config.add(:schedules, field: :schedule)
filter_table_config.add(:time_zones, field: :time_zone)
filter_table_config.add(:states, field: :state)
filter_table_config.add(:attempt_deadlines, field: :attempt_deadline)
filter_table_config.add(:retry_configs, field: :retry_config)
filter_table_config.add(:pubsub_targets, field: :pubsub_target)
Expand Down Expand Up @@ -76,6 +77,7 @@ def transformers
'description' => ->(obj) { return :description, obj['description'] },
'schedule' => ->(obj) { return :schedule, obj['schedule'] },
'timeZone' => ->(obj) { return :time_zone, obj['timeZone'] },
'state' => ->(obj) { return :state, obj['state'] },
'attemptDeadline' => ->(obj) { return :attempt_deadline, obj['attemptDeadline'] },
'retryConfig' => ->(obj) { return :retry_config, GoogleInSpec::CloudScheduler::Property::JobRetryConfig.new(obj['retryConfig'], to_s) },
'pubsubTarget' => ->(obj) { return :pubsub_target, GoogleInSpec::CloudScheduler::Property::JobPubsubTarget.new(obj['pubsubTarget'], to_s) },
Expand Down
2 changes: 1 addition & 1 deletion test/integration/configuration/mm-attributes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ spannerdatabase:
ddl: "CREATE TABLE test (test STRING(MAX),) PRIMARY KEY (test)"

scheduler_job:
# region must match where the appengine instance is deployed
# region must match where the apengine instance is deployed
region: us-central1
name: job-name
description: A description
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
Expand Down