New module: GCP Storage Buckets (#37288)
This commit is contained in:
parent
39bf7d3655
commit
58bf4ae611
5 changed files with 1259 additions and 0 deletions
1166
lib/ansible/modules/cloud/google/gcp_storage_bucket.py
Normal file
1166
lib/ansible/modules/cloud/google/gcp_storage_bucket.py
Normal file
File diff suppressed because it is too large
Load diff
2
test/integration/targets/gcp_storage_bucket/aliases
Normal file
2
test/integration/targets/gcp_storage_bucket/aliases
Normal file
|
@ -0,0 +1,2 @@
|
|||
cloud/gcp
|
||||
unsupported
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
# defaults file
|
||||
resource_name: '{{resource_prefix}}'
|
88
test/integration/targets/gcp_storage_bucket/tasks/main.yml
Normal file
88
test/integration/targets/gcp_storage_bucket/tasks/main.yml
Normal 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
|
Loading…
Reference in a new issue