New module: GCP Storage Buckets (#37288)

This commit is contained in:
Alex Stephen 2018-04-25 12:26:13 -07:00 committed by Ryan Brown
parent 39bf7d3655
commit 58bf4ae611
5 changed files with 1259 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,2 @@
cloud/gcp
unsupported

View file

@ -0,0 +1,3 @@
---
# defaults file
resource_name: '{{resource_prefix}}'

View file

@ -0,0 +1,88 @@
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file at
# https://www.github.com/GoogleCloudPlatform/magic-modules
#
# ----------------------------------------------------------------------------
# Pre-test setup
- name: delete a bucket
gcp_storage_bucket:
name: 'ansible-storage-module'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/devstorage.full_control
state: absent
#----------------------------------------------------------
- name: create a bucket
gcp_storage_bucket:
name: 'ansible-storage-module'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/devstorage.full_control
state: present
register: result
- name: assert changed is true
assert:
that:
- result.changed == true
- "result.kind == 'storage#bucket'"
# ----------------------------------------------------------------------------
- name: create a bucket that already exists
gcp_storage_bucket:
name: 'ansible-storage-module'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/devstorage.full_control
state: present
register: result
- name: assert changed is false
assert:
that:
- result.changed == false
- "result.kind == 'storage#bucket'"
#----------------------------------------------------------
- name: delete a bucket
gcp_storage_bucket:
name: 'ansible-storage-module'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/devstorage.full_control
state: absent
register: result
- name: assert changed is true
assert:
that:
- result.changed == true
- result.has_key('kind') == False
# ----------------------------------------------------------------------------
- name: delete a bucket that does not exist
gcp_storage_bucket:
name: 'ansible-storage-module'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/devstorage.full_control
state: absent
register: result
- name: assert changed is false
assert:
that:
- result.changed == false
- result.has_key('kind') == False