feat: Add new gcloud commands, API clients, and third-party libraries across various services.

This commit is contained in:
2026-01-01 20:26:35 +01:00
parent 5e23cbece0
commit a19e592eb7
25221 changed files with 8324611 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*- #
# Copyright 2023 Google LLC. All Rights Reserved.
#
# 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.
"""The Secure Source Manager repositories sub-group."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.DefaultUniverseOnly
@base.ReleaseTracks(
base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA, base.ReleaseTrack.GA
)
class SourceManagerReposAlpha(base.Group):
"""Manage Secure Source Manager repositories."""

View File

@@ -0,0 +1,25 @@
release_tracks: [ALPHA, BETA, GA]
help_text:
brief: Add an IAM policy binding to a Secure Source Manager repository.
description: Add an IAM policy binding to a Secure Source Manager repository.
examples: |
To add an IAM policy binding for the Repository Admin role (`roles/securesourcemanager.repoAdmin`)
for the user `test-user@gmail.com` in a repository named `my-repo` and location `us-central1`,
run the following command:
$ {command} my-repo --region=us-central1 --member=user:test-user@gmail.com --role=roles/securesourcemanager.repoAdmin
See https://cloud.google.com/iam/docs/managing-policies for details of policy role and member types.
request:
api_version: v1
collection: securesourcemanager.projects.locations.repositories
arguments:
resource:
help_text: Secure Source Manager repository to add the IAM policy binding to.
spec: !REF googlecloudsdk.command_lib.source_manager.resources:repository
iam:
enable_condition: false

View File

@@ -0,0 +1,75 @@
# -*- coding: utf-8 -*- #
# Copyright 2023 Google LLC. All Rights Reserved.
#
# 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.
"""Create Secure Source Manager repository command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.securesourcemanager import repositories
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.source_manager import flags
from googlecloudsdk.command_lib.source_manager import resource_args
from googlecloudsdk.core import log
DETAILED_HELP = {
"DESCRIPTION": """
Create a Secure Source Manager repository.
""",
"EXAMPLES": """
To create a repository called 'my-repo' in location 'us-central1' in
instance 'my-instance', run the following command:
$ {command} my-repo --region=us-central1 --instance=my-instance
""",
}
@base.DefaultUniverseOnly
@base.ReleaseTracks(
base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA, base.ReleaseTrack.GA
)
class Create(base.CreateCommand):
"""Create a Secure Source Manager repository."""
@staticmethod
def Args(parser):
resource_args.AddRepositoryResourceArg(parser, "to create")
flags.AddInstance(parser)
flags.AddDescription(parser)
flags.AddInitialConfigGroup(parser)
def Run(self, args):
# Get resource args to contruct base url
repository_ref = args.CONCEPTS.repository.Parse()
# Create a repository
client = repositories.RepositoriesClient()
# this is a shortcut LRO, it completes immediately and is marked as done
# there is no need to wait
create_operation = client.Create(
repository_ref,
args.instance,
args.description,
args.default_branch,
args.gitignores,
args.license,
args.readme,
)
log.CreatedResource(repository_ref.RelativeName())
return create_operation
Create.detailed_help = DETAILED_HELP

View File

@@ -0,0 +1,65 @@
# -*- coding: utf-8 -*- #
# Copyright 2023 Google LLC. All Rights Reserved.
#
# 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.
"""Delete Secure Source Manager repository command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.securesourcemanager import repositories
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.source_manager import flags
from googlecloudsdk.command_lib.source_manager import resource_args
from googlecloudsdk.core import log
DETAILED_HELP = {
"DESCRIPTION": """
Delete a Secure Source Manager repository.
""",
"EXAMPLES": """
To delete a repository called `my-repo` in location `us-central1`,
run the following command:
$ {command} my-repo --region=us-central1
""",
}
@base.DefaultUniverseOnly
@base.ReleaseTracks(
base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA, base.ReleaseTrack.GA
)
class Delete(base.DeleteCommand):
"""Delete a Secure Source Manager repository."""
@staticmethod
def Args(parser):
resource_args.AddRepositoryResourceArg(parser, "to delete")
flags.AddAllowMissing(parser)
def Run(self, args):
# Get resource args to contruct base url
repository_ref = args.CONCEPTS.repository.Parse()
# Delete repository
client = repositories.RepositoriesClient()
# this is a shortcut LRO, it completes immediately and is marked as done
# there is no need to wait
delete_operation = client.Delete(repository_ref, args.allow_missing)
log.DeletedResource(repository_ref.RelativeName())
return delete_operation
Delete.detailed_help = DETAILED_HELP

View File

@@ -0,0 +1,18 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: Describe a Secure Source Manager repository.
description: Get metadata of a Secure Source Manager repository.
examples: |
To describe a repository called `my-repo` in location `us-central1`, run the following command:
$ {command} my-repo --region=us-central1
request:
api_version: v1
collection: securesourcemanager.projects.locations.repositories
arguments:
resource:
help_text: The Secure Source Manager repository to describe.
spec: !REF googlecloudsdk.command_lib.source_manager.resources:repository

View File

@@ -0,0 +1,17 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: Get the IAM policy for a Secure Source Manager repository.
description: Get the IAM policy for a Secure Source Manager repository.
examples: |
To get the IAM policy for an repository named `my-repo` in location `us-central1`, run the following command:
$ {command} my-repo --region=us-central1
request:
collection: securesourcemanager.projects.locations.repositories
arguments:
resource:
help_text: Secure Source Manager repository to get the IAM policy from.
spec: !REF googlecloudsdk.command_lib.source_manager.resources:repository

View File

@@ -0,0 +1,71 @@
# -*- coding: utf-8 -*- #
# Copyright 2023 Google LLC. All Rights Reserved.
#
# 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.
"""List Secure Source Manager repositories command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.securesourcemanager import repositories
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.source_manager import flags
from googlecloudsdk.command_lib.source_manager import resource_args
DETAILED_HELP = {
"DESCRIPTION": """
List Secure Source Manager repositories.
""",
"EXAMPLES": """
To list repositories in location `us-central1` under instance
`my-instance`, run the following command:
$ {command} --region=us-central1 --instance=my-instance
""",
}
@base.DefaultUniverseOnly
@base.ReleaseTracks(
base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA, base.ReleaseTrack.GA
)
class List(base.ListCommand):
"""List all repositories under a Secure Source Manager instance."""
@staticmethod
def Args(parser):
resource_args.AddRegionResourceArg(parser, "to list")
flags.AddInstance(parser)
base.FILTER_FLAG.RemoveFromParser(parser)
base.SORT_BY_FLAG.RemoveFromParser(parser)
base.URI_FLAG.RemoveFromParser(parser)
parser.display_info.AddFormat("""
table(
name.basename():label=REPOSITORY_ID:sort=1,
name.segment(3):label=LOCATION,
instance.basename():label=INSTANCE_ID,
createTime.date(),
uris.html:label=HTML_HOST
)
""")
def Run(self, args):
# Get resource args to contruct base url
location_ref = args.CONCEPTS.region.Parse()
# List repositories
client = repositories.RepositoriesClient()
return client.List(location_ref, args.instance, args.page_size, args.limit)
List.detailed_help = DETAILED_HELP

View File

@@ -0,0 +1,25 @@
release_tracks: [ALPHA, BETA, GA]
help_text:
brief: Remove an IAM policy binding from a Secure Source Manager repository.
description: Remove an IAM policy binding to a Secure Source Manager repository.
examples: |
To remove the Repository Admin IAM role (`roles/securesourcemanager.repoAdmin`) binding from the
user `test-user@gmail.com` in a repository named `my-repo` and location `us-central1`, run the
following command:
$ {command} my-repo --region=us-central1 --member=user:test-user@gmail.com --role=roles/securesourcemanager.repoAdmin
See https://cloud.google.com/iam/docs/managing-policies for details of policy role and member types.
request:
api_version: v1
collection: securesourcemanager.projects.locations.repositories
arguments:
resource:
help_text: Secure Source Manager repository to remove the IAM policy binding from.
spec: !REF googlecloudsdk.command_lib.source_manager.resources:repository
iam:
enable_condition: false

View File

@@ -0,0 +1,18 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: Set the IAM policy for a Secure Source Manager repository.
description: Set the IAM policy for a Secure Source Manager repository.
examples: |
To set the IAM policy for a repository named `my-repo` in location `us-central` to the
content of `policy.json` , run the following command:
$ {command} my-repo --region=us-central1 policy.json
request:
collection: securesourcemanager.projects.locations.repositories
arguments:
resource:
help_text: Secure Source Manager repository to set the IAM policy on.
spec: !REF googlecloudsdk.command_lib.source_manager.resources:repository

View File

@@ -0,0 +1,86 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# 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.
"""Update Secure Source Manager repository command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.securesourcemanager import repositories
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.command_lib.source_manager import flags
from googlecloudsdk.command_lib.source_manager import resource_args
from googlecloudsdk.core import log
DETAILED_HELP = {
"DESCRIPTION": """
Update a Secure Source Manager repository.
""",
"EXAMPLES": """
To update the description of a repository called `my-repo` in
location `us-central1`, run the following command:
$ {command} my-repo --description="new description" --region=us-central1
""",
}
@base.DefaultUniverseOnly
@base.ReleaseTracks(
base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA, base.ReleaseTrack.GA
)
class Update(base.UpdateCommand):
"""Update a Secure Source Manager repository."""
NO_CHANGES_MESSAGE = (
"There are no changes to the repository [{repository}] for update"
)
@staticmethod
def Args(parser):
resource_args.AddRepositoryResourceArg(parser, "to update")
flags.AddDescription(parser)
flags.AddValidateOnly(parser)
def Run(self, args):
# Get resource args to contruct base url
repository_ref = args.CONCEPTS.repository.Parse()
# Update repository
client = repositories.RepositoriesClient()
# Collect the list of update masks
update_mask = []
if args.IsSpecified("description"):
update_mask.append("description")
if not update_mask:
raise exceptions.MinimumArgumentException(
[
"--description",
],
self.NO_CHANGES_MESSAGE.format(repository=repository_ref.Name()),
)
# this is a shortcut LRO, it completes immediately and is marked as done
# there is no need to wait
update_operation = client.Update(
repository_ref, update_mask, args.validate_only, args.description
)
log.UpdatedResource(repository_ref.RelativeName())
return update_operation
Update.detailed_help = DETAILED_HELP