Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add storage_folder_management_hub resource. #12726

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
222 changes: 222 additions & 0 deletions mmv1/products/storage/FolderManagementHub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
# Copyright 2024 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.

---
# API resource name
name: 'FolderManagementHub'
kind: 'storage#managementhub'
# Resource description for the provider documentation.
description: |
The Folder Management Hub resource represents GCS Management Hub operating on
individual GCP Folder. Management Hub is a singleton resource and individual
instance exists on each GCP project.

Management Hub is for Storage Admins to manage GCP storage assets at scale for
performance, cost, security & compliance.

docs:
warning: |
Management Hub is a singleton resource which cannot be created or
deleted. A single instance of Management Hub exist for each GCP Project.
Terraform does not create or destroy this resource. Terraform resource
creation for this resource is simply an update operation on existing
resource with specified properties. Terraform deletion won't have any effect
on this resource rather it will only remove it from the state file.
# Marks the resource as beta-only. Ensure a beta version block is present in
# provider.yaml.
# min_version: beta

# URL for the resource's standard Get method. https://google.aip.dev/131
# Terraform field names enclosed in double curly braces are replaced with
# the field values from the resource at runtime.
self_link: 'folders/{{name}}/locations/global/managementHub'

# URL for the resource's standard Create method, including query parameters.
# https://google.aip.dev/133
# Terraform field names enclosed in double curly braces are replaced with
# the field values from the resource at runtime.
custom_code:
pre_delete: templates/terraform/constants/storage_management_hub.go.tmpl
pre_read: templates/terraform/constants/storage_management_hub.go.tmpl
pre_update: templates/terraform/constants/storage_management_hub.go.tmpl
custom_create: templates/terraform/custom_create/storage_folder_management_hub.go.tmpl
# Overrides the URL for the resource's standard Update method. (If unset, the
# self_link URL is used by default.) https://google.aip.dev/134
# Terraform field names enclosed in double curly braces are replaced with
# the field values from the resource at runtime.
# update_url: 'projects/{{project}}/locations/{{location}}/resourcenames/{{name}}'
# The HTTP verb used to update a resource. Allowed values: :POST, :PUT, :PATCH. Default: :PUT.
update_verb: 'PATCH'
# If true, the resource sets an `updateMask` query parameter listing modified
# fields when updating the resource. If false, it does not.
update_mask: true

create_url: 'folders/{{name}}/locations/global/managementHub?updateMask=editionConfig,filter'
create_verb: 'PATCH'

exclude_delete: true

import_format:
- 'folders/{{name}}/locations/global/managementHub'

# If true, code for handling long-running operations is generated along with
# the resource. If false, that code is not generated.
autogen_async: false

properties:
# Fields go here
- name: 'name'
type: String
required: true
immutable: true
url_param_only: true
description: |
Identifier of the GCP folder. For GCP folder, It should be folder number.
- name: 'editionConfig'
type: String
required: true
description: |
Edition configuration of the Management Hub resource. Valid values are
INHERIT, DISABLED and STANDARD.
- name: 'updateTime'
type: String
output: true
description: |
The time at which the Management Hub resource is last updated.
- name: 'filter'
type: NestedObject
description: |
Filter over location and bucket using include or exclude semantics.
Resources that match the include or exclude filter are exclusively
included or excluded from the Management Hub plan.
properties:
- name: excludedCloudStorageBuckets
type: NestedObject
required: false
description: |
Buckets to exclude from the Management Hub plan.
conflicts:
- 'filter.0.included_cloud_storage_buckets'
at_least_one_of:
- 'filter.0.included_cloud_storage_buckets'
- 'filter.0.excluded_cloud_storage_buckets'
- 'filter.0.included_cloud_storage_locations'
- 'filter.0.excluded_cloud_storage_locations'
properties:
- name: cloudStorageBuckets
required: true
type: Array
item_type:
type: NestedObject
properties:
- name: bucketId
type: String
description: |
Id of the bucket.
Only one of the bucket_id and bucket_id_regex should be
specified.
- name: bucketIdRegex
type: String
description: |
ID regex of the bucket.
Only one of the bucket_id and bucket_id_regex should be
specified.
- name: includedCloudStorageBuckets
type: NestedObject
required: false
description: |
Buckets to include in the Management Hub plan.
conflicts:
- 'filter.0.excluded_cloud_storage_buckets'
at_least_one_of:
- 'filter.0.included_cloud_storage_buckets'
- 'filter.0.excluded_cloud_storage_buckets'
- 'filter.0.included_cloud_storage_locations'
- 'filter.0.excluded_cloud_storage_locations'
properties:
- name: cloudStorageBuckets
required: true
type: Array
item_type:
type: NestedObject
properties:
- name: bucketId
type: String
required: false
description: |
Id of the bucket.
Only one of the bucket_id and bucket_id_regex should be
specified.
- name: bucketIdRegex
type: String
required: false
description: |
ID regex of the bucket.
Only one of the bucket_id and bucket_id_regex should be
specified.
- name: excludedCloudStorageLocations
type: NestedObject
required: false
description: |
Locations to exclude from the Management Hub plan.
conflicts:
- 'filter.0.included_cloud_storage_locations'
at_least_one_of:
- 'filter.0.included_cloud_storage_buckets'
- 'filter.0.excluded_cloud_storage_buckets'
- 'filter.0.included_cloud_storage_locations'
- 'filter.0.excluded_cloud_storage_locations'
properties:
- name: locations
type: Array
required: true
description: |
List of locations.
item_type:
type: String
- name: includedCloudStorageLocations
type: NestedObject
required: false
description: |
Locations to include in the Management Hub plan.
conflicts:
- 'filter.0.excluded_cloud_storage_locations'
at_least_one_of:
- 'filter.0.included_cloud_storage_buckets'
- 'filter.0.excluded_cloud_storage_buckets'
- 'filter.0.included_cloud_storage_locations'
- 'filter.0.excluded_cloud_storage_locations'
properties:
- name: locations
type: Array
required: true
description: |
List of locations.
item_type:
type: String
- name: 'effectiveManagementHubEdition'
output: true
description: |
The Management Hub edition that is effective for the resource.
type: NestedObject
properties:
- name: managementHub
type: String
output: true
description: |
The Management Hub resource that is applied for the target resource.
- name: managementHubEdition
type: String
output: true
description: |
The `ManagementHub` edition that is applicable for the resource.
Loading
Loading