Skip to content

Commit

Permalink
Added maintenancePolicy attribute to redis instance (GoogleCloudPlatf…
Browse files Browse the repository at this point in the history
  • Loading branch information
jaceq authored and lcaggio committed Mar 17, 2022
1 parent 5691d8e commit b54cf9e
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 0 deletions.
115 changes: 115 additions & 0 deletions mmv1/products/redis/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,121 @@ objects:
The ID of the instance or a fully qualified identifier for the instance.
required: true
input: true
- !ruby/object:Api::Type::NestedObject
name: maintenancePolicy
description: Maintenance policy for an instance.
properties:
- !ruby/object:Api::Type::String
name: 'createTime'
output: true
description: |
Output only. The time when the policy was created.
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond
resolution and up to nine fractional digits.
- !ruby/object:Api::Type::String
name: 'updateTime'
output: true
description: |
Output only. The time when the policy was last updated.
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond
resolution and up to nine fractional digits.
- !ruby/object:Api::Type::String
name: 'description'
description: |
Optional. Description of what this policy is for.
Create/Update methods return INVALID_ARGUMENT if the
length is greater than 512.
- !ruby/object:Api::Type::Array
name: 'weeklyMaintenanceWindow'
description: |
Optional. Maintenance window that is applied to resources covered by this policy.
Minimum 1. For the current version, the maximum number
of weekly_window is expected to be one.
item_type: !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::Enum
name: 'day'
required: true
description: |
Required. The day of week that maintenance updates occur.
- DAY_OF_WEEK_UNSPECIFIED: The day of the week is unspecified.
- MONDAY: Monday
- TUESDAY: Tuesday
- WEDNESDAY: Wednesday
- THURSDAY: Thursday
- FRIDAY: Friday
- SATURDAY: Saturday
- SUNDAY: Sunday
values:
- :DAY_OF_WEEK_UNSPECIFIED
- :MONDAY
- :TUESDAY
- :WEDNESDAY
- :THURSDAY
- :FRIDAY
- :SATURDAY
- :SUNDAY
- !ruby/object:Api::Type::String
name: 'duration'
output: true
description: |
Output only. Duration of the maintenance window.
The current window is fixed at 1 hour.
A duration in seconds with up to nine fractional digits,
terminated by 's'. Example: "3.5s".
- !ruby/object:Api::Type::NestedObject
name: 'startTime'
required: true
allow_empty_object: true
send_empty_value: true
description: |
Required. Start time of the window in UTC time.
properties:
- !ruby/object:Api::Type::Integer
name: 'hours'
description: |
Hours of day in 24 hour format. Should be from 0 to 23.
An API may choose to allow the value "24:00:00" for scenarios like business closing time.
- !ruby/object:Api::Type::Integer
name: 'minutes'
description: |
Minutes of hour of day. Must be from 0 to 59.
- !ruby/object:Api::Type::Integer
name: 'seconds'
description: |
Seconds of minutes of the time. Must normally be from 0 to 59.
An API may allow the value 60 if it allows leap-seconds.
- !ruby/object:Api::Type::Integer
name: 'nanos'
description: |
Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.
- !ruby/object:Api::Type::NestedObject
name: maintenanceSchedule
description: Upcoming maintenance schedule.
properties:
- !ruby/object:Api::Type::String
name: 'startTime'
output: true
description: |
Output only. The start time of any upcoming scheduled maintenance for this instance.
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond
resolution and up to nine fractional digits.
- !ruby/object:Api::Type::String
name: 'endTime'
output: true
description: |
Output only. The end time of any upcoming scheduled maintenance for this instance.
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond
resolution and up to nine fractional digits.
- !ruby/object:Api::Type::String
name: 'scheduleDeadlineTime'
output: true
description: |
Output only. The deadline that the maintenance schedule start time
can not go beyond, including reschedule.
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond
resolution and up to nine fractional digits.
- !ruby/object:Api::Type::Integer
name: memorySizeGb
description: Redis memory size in GiB.
Expand Down
12 changes: 12 additions & 0 deletions mmv1/products/redis/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ overrides: !ruby/object:Overrides::ResourceOverrides
custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb'
validation: !ruby/object:Provider::Terraform::Validation
regex: '^[a-z][a-z0-9-]{0,39}[a-z0-9]$'
maintenancePolicy.weeklyMaintenanceWindow.startTime.hours: !ruby/object:Overrides::Terraform::PropertyOverride
validation: !ruby/object:Provider::Terraform::Validation
function: 'validation.IntBetween(0,23)'
maintenancePolicy.weeklyMaintenanceWindow.startTime.minutes: !ruby/object:Overrides::Terraform::PropertyOverride
validation: !ruby/object:Provider::Terraform::Validation
function: 'validation.IntBetween(0,59)'
maintenancePolicy.weeklyMaintenanceWindow.startTime.seconds: !ruby/object:Overrides::Terraform::PropertyOverride
validation: !ruby/object:Provider::Terraform::Validation
function: 'validation.IntBetween(0,60)'
maintenancePolicy.weeklyMaintenanceWindow.startTime.nanos: !ruby/object:Overrides::Terraform::PropertyOverride
validation: !ruby/object:Provider::Terraform::Validation
function: 'validation.IntBetween(0,999999999)'
redisVersion: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
update_url: 'projects/{{project}}/locations/{{region}}/instances/{{name}}:upgrade'
Expand Down
12 changes: 12 additions & 0 deletions mmv1/templates/terraform/examples/redis_instance_full.tf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" {
my_key = "my_val"
other_key = "other_val"
}

maintenance_policy {
weekly_maintenance_window {
day = "TUESDAY"
start_time {
hours = 0
minutes = 30
seconds = 0
nanos = 0
}
}
}
}

// This example assumes this network already exists.
Expand Down

0 comments on commit b54cf9e

Please sign in to comment.