From 01dbb0557654bf991f949dc93e9778c4da19743d Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Thu, 19 Mar 2020 17:37:20 -0400 Subject: [PATCH 1/5] resource policy --- products/compute/ansible.yaml | 4 -- products/compute/ansible_version_added.yaml | 45 +++++++++++++++++++ .../examples/ansible/resource_policy.yaml | 25 +++++++++++ 3 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 products/compute/examples/ansible/resource_policy.yaml diff --git a/products/compute/ansible.yaml b/products/compute/ansible.yaml index db89665c1ff4..bde644c8cc9e 100644 --- a/products/compute/ansible.yaml +++ b/products/compute/ansible.yaml @@ -43,8 +43,6 @@ datasources: !ruby/object:Overrides::ResourceOverrides exclude: true RegionSslCertificate: !ruby/object:Overrides::Ansible::ResourceOverride exclude: true - ResourcePolicy: !ruby/object:Overrides::Ansible::ResourceOverride - exclude: true RouterBgpPeer: !ruby/object:Overrides::Ansible::ResourceOverride exclude: true RouterNat: !ruby/object:Overrides::Ansible::ResourceOverride @@ -259,8 +257,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides description: | The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. - ResourcePolicy: !ruby/object:Overrides::Ansible::ResourceOverride - exclude: true Reservation: !ruby/object:Overrides::Ansible::ResourceOverride properties: specificReservation.instanceProperties.minCpuPlatform: !ruby/object:Overrides::Ansible::PropertyOverride diff --git a/products/compute/ansible_version_added.yaml b/products/compute/ansible_version_added.yaml index a6b6a7d60226..21e694127af3 100644 --- a/products/compute/ansible_version_added.yaml +++ b/products/compute/ansible_version_added.yaml @@ -56,6 +56,8 @@ :version_added: '2.10' :RegionHealthCheck: :version_added: '2.10' + :ResourcePolicy: + :version_added: '2.10' :Route: :version_added: '2.7' :Router: @@ -1519,6 +1521,49 @@ :version_added: '2.10' :portSpecification: :version_added: '2.10' +======= + :ResourcePolicy: + :version_added: '2.10' + :name: + :version_added: '2.10' + :snapshotSchedulePolicy: + :version_added: '2.10' + :schedule: + :version_added: '2.10' + :hourlySchedule: + :version_added: '2.10' + :hoursInCycle: + :version_added: '2.10' + :startTime: + :version_added: '2.10' + :dailySchedule: + :version_added: '2.10' + :daysInCycle: + :version_added: '2.10' + :startTime: + :version_added: '2.10' + :weeklySchedule: + :version_added: '2.10' + :dayOfWeeks: + :version_added: '2.10' + :startTime: + :version_added: '2.10' + :day: + :version_added: '2.10' + :retentionPolicy: + :version_added: '2.10' + :maxRetentionDays: + :version_added: '2.10' + :onSourceDiskDelete: + :version_added: '2.10' + :snapshotProperties: + :version_added: '2.10' + :labels: + :version_added: '2.10' + :storageLocations: + :version_added: '2.10' + :guestFlush: + :version_added: '2.10' :region: :version_added: '2.10' :Route: diff --git a/products/compute/examples/ansible/resource_policy.yaml b/products/compute/examples/ansible/resource_policy.yaml new file mode 100644 index 000000000000..cef8709711a8 --- /dev/null +++ b/products/compute/examples/ansible/resource_policy.yaml @@ -0,0 +1,25 @@ +# Copyright 2020 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- !ruby/object:Provider::Ansible::Example +task: !ruby/object:Provider::Ansible::Task + name: gcp_compute_resource_policy + code: + name: <%= ctx[:name] %> + region: 'us-central1' + snapshot_schedule_policy: + daily_schedule: + days_in_cycle: 1 + start_time: "04:00" + project: <%= ctx[:project] %> + auth_kind: <%= ctx[:auth_kind] %> + service_account_file: <%= ctx[:service_account_file] %> From f22356d586091c6070c69f559b4593af0d64b276 Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Thu, 19 Mar 2020 17:59:35 -0400 Subject: [PATCH 2/5] fixed --- products/compute/api.yaml | 19 +------------------ .../examples/ansible/resource_policy.yaml | 7 ++++--- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/products/compute/api.yaml b/products/compute/api.yaml index 3f5f1b87f975..58467869f899 100644 --- a/products/compute/api.yaml +++ b/products/compute/api.yaml @@ -10513,26 +10513,9 @@ objects: base_url: projects/{{project}}/regions/{{region}}/resourcePolicies input: true has_self_link: true + collection_url_key: 'items' description: | A policy that can be attached to a resource to specify or schedule actions on that resource. - async: !ruby/object:Api::OpAsync - operation: !ruby/object:Api::OpAsync::Operation - kind: 'compute#operation' - path: 'name' - base_url: 'projects/{{project}}/global/operations/{{op_id}}' - wait_ms: 1000 - result: !ruby/object:Api::OpAsync::Result - path: 'targetLink' - status: !ruby/object:Api::OpAsync::Status - path: 'status' - complete: 'DONE' - allowed: - - 'PENDING' - - 'RUNNING' - - 'DONE' - error: !ruby/object:Api::OpAsync::Error - path: 'error/errors' - message: 'message' parameters: - !ruby/object:Api::Type::ResourceRef name: region diff --git a/products/compute/examples/ansible/resource_policy.yaml b/products/compute/examples/ansible/resource_policy.yaml index cef8709711a8..7639b2a8ba3c 100644 --- a/products/compute/examples/ansible/resource_policy.yaml +++ b/products/compute/examples/ansible/resource_policy.yaml @@ -17,9 +17,10 @@ task: !ruby/object:Provider::Ansible::Task name: <%= ctx[:name] %> region: 'us-central1' snapshot_schedule_policy: - daily_schedule: - days_in_cycle: 1 - start_time: "04:00" + schedule: + daily_schedule: + days_in_cycle: 1 + start_time: "04:00" project: <%= ctx[:project] %> auth_kind: <%= ctx[:auth_kind] %> service_account_file: <%= ctx[:service_account_file] %> From 43c3e05b50fca5818b95c4eaab5c868c80a3c9b9 Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Thu, 19 Mar 2020 18:04:10 -0400 Subject: [PATCH 3/5] rebase issues --- products/compute/ansible_version_added.yaml | 45 --------------------- 1 file changed, 45 deletions(-) diff --git a/products/compute/ansible_version_added.yaml b/products/compute/ansible_version_added.yaml index 21e694127af3..a6b6a7d60226 100644 --- a/products/compute/ansible_version_added.yaml +++ b/products/compute/ansible_version_added.yaml @@ -56,8 +56,6 @@ :version_added: '2.10' :RegionHealthCheck: :version_added: '2.10' - :ResourcePolicy: - :version_added: '2.10' :Route: :version_added: '2.7' :Router: @@ -1521,49 +1519,6 @@ :version_added: '2.10' :portSpecification: :version_added: '2.10' -======= - :ResourcePolicy: - :version_added: '2.10' - :name: - :version_added: '2.10' - :snapshotSchedulePolicy: - :version_added: '2.10' - :schedule: - :version_added: '2.10' - :hourlySchedule: - :version_added: '2.10' - :hoursInCycle: - :version_added: '2.10' - :startTime: - :version_added: '2.10' - :dailySchedule: - :version_added: '2.10' - :daysInCycle: - :version_added: '2.10' - :startTime: - :version_added: '2.10' - :weeklySchedule: - :version_added: '2.10' - :dayOfWeeks: - :version_added: '2.10' - :startTime: - :version_added: '2.10' - :day: - :version_added: '2.10' - :retentionPolicy: - :version_added: '2.10' - :maxRetentionDays: - :version_added: '2.10' - :onSourceDiskDelete: - :version_added: '2.10' - :snapshotProperties: - :version_added: '2.10' - :labels: - :version_added: '2.10' - :storageLocations: - :version_added: '2.10' - :guestFlush: - :version_added: '2.10' :region: :version_added: '2.10' :Route: From 4d028548d6eacf0a7580b47fd305c3ee5eb773ee Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Thu, 19 Mar 2020 18:06:56 -0400 Subject: [PATCH 4/5] finally fixed --- products/compute/ansible_version_added.yaml | 46 +++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/products/compute/ansible_version_added.yaml b/products/compute/ansible_version_added.yaml index a6b6a7d60226..d2d9ea19a065 100644 --- a/products/compute/ansible_version_added.yaml +++ b/products/compute/ansible_version_added.yaml @@ -56,6 +56,8 @@ :version_added: '2.10' :RegionHealthCheck: :version_added: '2.10' + :ResourcePolicy: + :version_added: '2.10' :Route: :version_added: '2.7' :Router: @@ -1521,6 +1523,50 @@ :version_added: '2.10' :region: :version_added: '2.10' + :ResourcePolicy: + :version_added: '2.10' + :name: + :version_added: '2.10' + :snapshotSchedulePolicy: + :version_added: '2.10' + :schedule: + :version_added: '2.10' + :hourlySchedule: + :version_added: '2.10' + :hoursInCycle: + :version_added: '2.10' + :startTime: + :version_added: '2.10' + :dailySchedule: + :version_added: '2.10' + :daysInCycle: + :version_added: '2.10' + :startTime: + :version_added: '2.10' + :weeklySchedule: + :version_added: '2.10' + :dayOfWeeks: + :version_added: '2.10' + :startTime: + :version_added: '2.10' + :day: + :version_added: '2.10' + :retentionPolicy: + :version_added: '2.10' + :maxRetentionDays: + :version_added: '2.10' + :onSourceDiskDelete: + :version_added: '2.10' + :snapshotProperties: + :version_added: '2.10' + :labels: + :version_added: '2.10' + :storageLocations: + :version_added: '2.10' + :guestFlush: + :version_added: '2.10' + :region: + :version_added: '2.10' :Route: :version_added: '2.6' :destRange: From 2d109a78810b5c0c015cf0fa6b51855f0570a13f Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Thu, 19 Mar 2020 19:54:24 -0400 Subject: [PATCH 5/5] async fix --- products/compute/api.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/products/compute/api.yaml b/products/compute/api.yaml index 58467869f899..7f97a3b6a42e 100644 --- a/products/compute/api.yaml +++ b/products/compute/api.yaml @@ -10516,6 +10516,24 @@ objects: collection_url_key: 'items' description: | A policy that can be attached to a resource to specify or schedule actions on that resource. + async: !ruby/object:Api::OpAsync + operation: !ruby/object:Api::OpAsync::Operation + kind: 'compute#operation' + path: 'name' + base_url: 'projects/{{project}}/regions/{{region}}/operations/{{op_id}}' + wait_ms: 1000 + result: !ruby/object:Api::OpAsync::Result + path: 'targetLink' + status: !ruby/object:Api::OpAsync::Status + path: 'status' + complete: 'DONE' + allowed: + - 'PENDING' + - 'RUNNING' + - 'DONE' + error: !ruby/object:Api::OpAsync::Error + path: 'error/errors' + message: 'message' parameters: - !ruby/object:Api::Type::ResourceRef name: region