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,34 @@
# -*- coding: utf-8 -*- #
# Copyright 2016 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 group for the Cloud Resource Manager Liens CLI."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.resource_manager import liens
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Liens(base.Group):
"""Manage Cloud Resource Manager Liens.
Commands to manage your Cloud Resource Liens.
"""
@staticmethod
def Args(parser):
parser.display_info.AddUriFunc(liens.GetUri)

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*- #
# Copyright 2021 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.
"""Command group for managing Cloud Resource Manager lien configurations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Config(base.Group):
"""Manage Cloud Resource Manager lien configurations."""

View File

@@ -0,0 +1,38 @@
release_tracks: [ALPHA]
command_type: CONFIG_EXPORT
help_text:
brief: Export the configuration for a Cloud Resource Manager lien.
description: |
*{command}* exports the configuration for a Cloud Resource Manager lien.
Lien configurations can be exported in
Kubernetes Resource Model (krm) or Terraform HCL formats. The
default format is `krm`.
Specifying `--all` allows you to export the configurations for all
liens within the project.
Specifying `--path` allows you to export the configuration(s) to
a local directory.
examples: |
To export the configuration for a lien, run:
$ {command} my-lien
To export the configuration for a lien to a file, run:
$ {command} my-lien --path=/path/to/dir/
To export the configuration for a lien in Terraform
HCL format, run:
$ {command} my-lien --resource-format=terraform
To export the configurations for all liens within a
project, run:
$ {command} --all
arguments:
resource:
help_text: Lien to export the configuration for.
spec: !REF googlecloudsdk.command_lib.resource_manager.resources:lien

View File

@@ -0,0 +1,68 @@
# -*- coding: utf-8 -*- #
# Copyright 2015 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.
"""Command to create a new Lien."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.resource_manager import error
from googlecloudsdk.api_lib.resource_manager import liens
from googlecloudsdk.calliope import base
from googlecloudsdk.core import properties
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Create(base.CreateCommand):
"""Create a new lien.
Creates a new lien to be applied to a project.
"""
@staticmethod
def Args(parser):
base.Argument(
'--restrictions',
required=True,
help='Comma separated list of IAM permissions to curtail.').AddToParser(
parser)
base.Argument(
'--reason',
required=True,
help='Human-readable description of why this lien is being applied.'
).AddToParser(parser)
base.Argument(
'--origin',
required=False,
help='Origin of this lien. Defaults to user identity.'
).AddToParser(parser)
@error.EmitErrorDetails
def Run(self, args):
parent = 'projects/' + properties.VALUES.core.project.Get(required=True)
# Origin is a required field which will default to the account property if
# not specified.
origin = args.origin
if not origin:
origin = properties.VALUES.core.account.Get(required=True)
messages = liens.LiensMessages()
return liens.LiensService().Create(
messages.Lien(
parent=parent,
restrictions=args.restrictions.split(','),
origin=origin,
reason=args.reason))

View File

@@ -0,0 +1,55 @@
# -*- coding: utf-8 -*- #
# Copyright 2016 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.
"""Command to delete a lien."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.resource_manager import error
from googlecloudsdk.api_lib.resource_manager import liens
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.resource_manager import flags
from googlecloudsdk.core import log
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Delete(base.DeleteCommand):
"""Delete a lien.
Delete a lien, given a valid lien ID.
This command can fail for the following reasons:
* There is no lien with the given ID.
* The active account does not have permission to delete the given lien.
## EXAMPLES
The following command deletes a lien with the ID `p8765-kjasdkkhsd`:
$ {command} p8765-kjasdkkhsd
"""
@staticmethod
def Args(parser):
flags.LienIdArg('you want to delete.').AddToParser(parser)
@error.EmitErrorDetails
def Run(self, args):
service = liens.LiensService()
messages = liens.LiensMessages()
service.Delete(
messages.CloudresourcemanagerLiensDeleteRequest(liensId=args.id))
log.DeletedResource(liens.LienIdToName(args.id))

View File

@@ -0,0 +1,56 @@
# -*- coding: utf-8 -*- #
# Copyright 2016 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.
"""Command to list all lien IDs associated for the specified project."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from apitools.base.py import list_pager
from googlecloudsdk.api_lib.resource_manager import error
from googlecloudsdk.api_lib.resource_manager import liens
from googlecloudsdk.calliope import base
from googlecloudsdk.core import properties
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class List(base.ListCommand):
"""List liens associated with the specified project.
List all liens which are associated with the specified project.
"""
@staticmethod
def Args(parser):
parser.display_info.AddFormat("""
table(
name.segment(),
origin,
reason
)
""")
@error.YieldErrorDetails
def Run(self, args):
"""Run the list command."""
parent = 'projects/' + properties.VALUES.core.project.Get(required=True)
return list_pager.YieldFromList(
liens.LiensService(),
liens.LiensMessages().CloudresourcemanagerLiensListRequest(
parent=parent),
limit=args.limit,
batch_size_attribute='pageSize',
batch_size=args.page_size,
field='liens')