Skip to content

feature folders #1

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

Closed
wants to merge 2 commits into from
Closed
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
13 changes: 13 additions & 0 deletions mmv1/products/storage/Bucket.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -499,3 +499,16 @@ properties:
description: |
The period of time, in seconds, that objects in the bucket must be retained and cannot be deleted,
overwritten, or made noncurrent.
- !ruby/object:Api::Type::NestedObject
name: 'hierarchicalNameSpace'
immutable: true
description: |
Hierarchical namespace is a capability offered by Cloud Storage that lets you organize objects into folders
enable hierarchical namespace when creating a bucket
properties:
- !ruby/object:Api::Type::Boolean
name: 'enabled'
description: |
If enabled bucket supports HNS features and able to create HNS folders


73 changes: 73 additions & 0 deletions mmv1/products/storage/Folder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# 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.

--- !ruby/object:Api::Resource
name: 'Folder'
kind: 'storage#folder'
base_url: 'b/{{bucket}}/folders'
self_link: 'b/{{bucket}}/folders/{{%name}}'
id_format: '{{bucket}}/{{name}}'
delete_url: 'b/{{bucket}}/folders/{{%name}}?allowNonEmpty={{force_destroy}}'
has_self_link: true
skip_sweeper: true # Skipping sweeper since this is a child resource.
description: |
A Google Cloud Storage Folder.

The Folder resource represents a folder in a Cloud Storage bucket with hierarchical namespace enabled
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Official Documentation': 'https://cloud.google.com/storage/docs/folders-overview'
api: 'https://cloud.google.com/storage/docs/json_api/v1/folders'
# iam_policy: handwritten in mmv1/third_party/terraform/services/storage/iam_storage_managed_folder.go
examples:
- !ruby/object:Provider::Terraform::Examples
name: 'storage_folder_basic'
primary_resource_id: 'folder'
vars:
bucket_name: 'my-bucket'
parameters:
- !ruby/object:Api::Type::ResourceRef
name: 'bucket'
resource: 'Bucket'
imports: 'name'
description: 'The name of the bucket that contains the managed folder.'
required: true
immutable: true
- !ruby/object:Api::Type::String
name: 'name'
description: |
The name of the folder expressed as a path. Must include
trailing '/'. For example, `example_dir/example_dir2/`.
required: true
immutable: true
# The API returns values with trailing slashes, even if not
# provided. Enforcing trailing slashes prevents diffs and ensures
# consistent output.
validation: !ruby/object:Provider::Terraform::Validation
regex: '/$'
properties:
- !ruby/object:Api::Type::String
name: createTime
description: |
The timestamp at which this managed folder was created.
output: true
- !ruby/object:Api::Type::String
name: updateTime
description: |
The timestamp at which this managed folder was most recently updated.
output: true
- !ruby/object:Api::Type::String
name: metageneration
description: |
The metadata generation of the managed folder.
output: true
11 changes: 11 additions & 0 deletions mmv1/templates/terraform/examples/storage_folder_basic.tf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resource "google_storage_bucket" "bucket" {
name = "<%= ctx[:vars]['bucket_name'] %>"
location = "EU"
uniform_bucket_level_access = true
}

resource "google_storage_folder" "<%= ctx[:primary_resource_id] %>" {
bucket = google_storage_bucket.bucket.name
name = "folder/name/"
force_destroy = true
}