mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
New module: GCP Storage Bucket Access Controls (#37289)
This commit is contained in:
parent
ebe7666d71
commit
d39b1ff664
5 changed files with 488 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
|||
cloud/gcp
|
||||
unsupported
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
# defaults file
|
||||
resource_name: '{{resource_prefix}}'
|
|
@ -0,0 +1,120 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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: create a bucket
|
||||
gcp_storage_bucket:
|
||||
name: 'bucket-bac'
|
||||
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: bucket
|
||||
- name: delete a bucket access control
|
||||
gcp_storage_bucket_access_control:
|
||||
bucket: "{{ bucket }}"
|
||||
entity: 'user-alexstephen@google.com'
|
||||
role: 'WRITER'
|
||||
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 access control
|
||||
gcp_storage_bucket_access_control:
|
||||
bucket: "{{ bucket }}"
|
||||
entity: 'user-alexstephen@google.com'
|
||||
role: 'WRITER'
|
||||
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#bucketAccessControl'"
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a bucket access control that already exists
|
||||
gcp_storage_bucket_access_control:
|
||||
bucket: "{{ bucket }}"
|
||||
entity: 'user-alexstephen@google.com'
|
||||
role: 'WRITER'
|
||||
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#bucketAccessControl'"
|
||||
#----------------------------------------------------------
|
||||
- name: delete a bucket access control
|
||||
gcp_storage_bucket_access_control:
|
||||
bucket: "{{ bucket }}"
|
||||
entity: 'user-alexstephen@google.com'
|
||||
role: 'WRITER'
|
||||
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 access control that does not exist
|
||||
gcp_storage_bucket_access_control:
|
||||
bucket: "{{ bucket }}"
|
||||
entity: 'user-alexstephen@google.com'
|
||||
role: 'WRITER'
|
||||
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
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
- name: delete a bucket
|
||||
gcp_storage_bucket:
|
||||
name: 'bucket-bac'
|
||||
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: bucket
|
Loading…
Add table
Add a link
Reference in a new issue