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 2024 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 Dataplex Entry Group services."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
@base.DefaultUniverseOnly
class EntryGroups(base.Group):
"""Manage Dataplex Entry Groups."""
category = base.DATA_ANALYTICS_CATEGORY

View File

@@ -0,0 +1,65 @@
# -*- coding: utf-8 -*- #
# Copyright 2024 Google Inc. 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.
"""`gcloud dataplex entry-groups add-iam-policy-binding` command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.dataplex import entry_group
from googlecloudsdk.api_lib.util import exceptions as gcloud_exception
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.dataplex import resource_args
from googlecloudsdk.command_lib.iam import iam_util
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
@base.DefaultUniverseOnly
class AddIamPolicyBinding(base.Command):
"""Add IAM policy binding to a Dataplex Entry Group."""
detailed_help = {
'EXAMPLES':
"""\
To add an IAM policy binding for the role of `roles/dataplex.viewer`
for the user `test-user@gmail.com` to Entry Group `test-entry-group` in
project `test-project` and in location `us-central1`, run:
$ {command} test-entry-group --project=test-project --location=us-central1 --role=roles/dataplex.viewer --member=user:foo@gmail.com
See https://cloud.google.com/dataplex/docs/iam-roles for details of
policy role and member types.
""",
}
@staticmethod
def Args(parser):
resource_args.AddDataplexEntryGroupResourceArg(
parser, 'to add IAM policy binding to.'
)
iam_util.AddArgsForAddIamPolicyBinding(parser)
@gcloud_exception.CatchHTTPErrorRaiseHTTPException(
'Status code: {status_code}. {status_message}.'
)
def Run(self, args):
entry_group_ref = args.CONCEPTS.entry_group.Parse()
result = entry_group.EntryGroupAddIamPolicyBinding(
entry_group_ref, args.member, args.role
)
return result

View File

@@ -0,0 +1,106 @@
# -*- coding: utf-8 -*- #
# Copyright 2024 Google Inc. 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.
"""`gcloud dataplex entry-groups create` command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.dataplex import entry_group
from googlecloudsdk.api_lib.dataplex import util as dataplex_util
from googlecloudsdk.api_lib.util import exceptions as gcloud_exception
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.dataplex import resource_args
from googlecloudsdk.command_lib.util.args import labels_util
from googlecloudsdk.core import log
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
@base.DefaultUniverseOnly
class Create(base.Command):
"""Create a Dataplex Entry Group.
Entry Group acts as a logical container used to organize Entries.
"""
detailed_help = {
'EXAMPLES':
"""\
To create Entry Group `test-entry-group` in project `test-dataplex` at location `us-central1`,
with description `test description` and displayName `test display name`, run:
$ {command} test-entry-group --location=us-central1 --project=test-project --description='test description' --display-name='test display name'
""",
}
@staticmethod
def Args(parser):
resource_args.AddDataplexEntryGroupResourceArg(parser,
'to create.')
parser.add_argument(
'--description',
required=False,
help='Description of the Entry Group.')
parser.add_argument(
'--display-name',
required=False,
help='Display name of the Entry Group.')
async_group = parser.add_group(
mutex=True,
required=False)
async_group.add_argument(
'--validate-only',
action='store_true',
default=False,
help='Validate the create action, but don\'t actually perform it.')
base.ASYNC_FLAG.AddToParser(async_group)
labels_util.AddCreateLabelsFlags(parser)
@gcloud_exception.CatchHTTPErrorRaiseHTTPException(
'Status code: {status_code}. {status_message}.')
def Run(self, args):
entry_group_ref = args.CONCEPTS.entry_group.Parse()
dataplex_client = dataplex_util.GetClientInstance()
create_req_op = dataplex_client.projects_locations_entryGroups.Create(
dataplex_util.GetMessageModule(
).DataplexProjectsLocationsEntryGroupsCreateRequest(
entryGroupId=entry_group_ref.Name(),
parent=entry_group_ref.Parent().RelativeName(),
validateOnly=args.validate_only,
googleCloudDataplexV1EntryGroup=entry_group
.GenerateEntryGroupForCreateRequest(args)))
validate_only = getattr(args, 'validate_only', False)
if validate_only:
log.status.Print('Validation complete.')
return
async_ = getattr(args, 'async_', False)
if not async_:
response = entry_group.WaitForOperation(create_req_op)
log.CreatedResource(
response.name,
details='Entry Group created in project [{0}] with location [{1}]'
.format(entry_group_ref.projectsId,
entry_group_ref.locationsId))
return response
log.status.Print(
'Creating Entry Group [{0}] with operation [{1}].'.format(
entry_group_ref, create_req_op.name))
return create_req_op

View File

@@ -0,0 +1,26 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: |
Delete a Dataplex Entry Group.
description: |
Delete a Dataplex Entry Group.
examples: |
To delete Entry Group `test-entry-group` in project `test-project` and in location `us-central1`, run:
$ {command} test-entry-group --location=us-central1 --project=test-project
request:
ALPHA:
api_version: v1
collection: dataplex.projects.locations.entryGroups
arguments:
resource:
help_text: |
Arguments and flags that define the Dataplex Entry Group you want to delete.
spec: !REF googlecloudsdk.command_lib.dataplex.resources:entry_group
params:
- arg_name: etag
api_field: etag
help_text: |
etag for the Entry Group you want to delete.
async:
collection: dataplex.projects.locations.operations

View File

@@ -0,0 +1,20 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: |
Describe a Dataplex Entry Group.
description: |
Displays all details of an Entry Group given a valid Entry Group ID.
examples: |
To describe a Dataplex Entry Group `test-entry-group` in location `us-central1` and in project `test-project`, run:
$ {command} test-entry-group --location=us-central1 --project=test-project
request:
ALPHA:
api_version: v1
collection: dataplex.projects.locations.entryGroups
method: get
arguments:
resource:
help_text: |
Arguments and flags that define the Dataplex Entry Group you want to retrieve.
spec: !REF googlecloudsdk.command_lib.dataplex.resources:entry_group

View File

@@ -0,0 +1,21 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: |
Retrieve a Dataplex Entry Group IAM policy.
description: |
Displays the IAM policy associated with a Dataplex Entry Group resource.
If formatted as JSON, the output can be edited and used as
a policy file for *set-iam-policy*. The output includes an "etag"
field identifying the version emitted and allowing detection of
concurrent policy updates.
examples: |
To get the IAM policy of a Dataplex Entry Group `test-entry-group` in project `test-project` under location `us-central1`, run:
$ {command} test-entry-group --project=test-project --location=us-central1
request:
collection: dataplex.projects.locations.entryGroups
arguments:
resource:
help_text: |
Arguments and flags that define the Dataplex Entry Group IAM policy you want to retrieve.
spec: !REF googlecloudsdk.command_lib.dataplex.resources:entry_group

View File

@@ -0,0 +1,26 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: |
List Dataplex Entry Groups.
description: |
List Dataplex Entry Groups based on project and location.
{command} --project={project_id} --location={location}
examples: |
To list Entry Groups in project `test-dataplex` at location `us-central1`
$ {command} --location=us-central1 --project=test-dataplex
request:
ALPHA:
api_version: v1
collection: dataplex.projects.locations.entryGroups
response:
id_field: name
arguments:
resource:
help_text: |
Location to list Entry Groups in.
spec: !REF googlecloudsdk.command_lib.dataplex.resources:location

View File

@@ -0,0 +1,63 @@
# -*- coding: utf-8 -*- #
# Copyright 2024 Google Inc. 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.
"""`gcloud dataplex entry-groups remove-iam-policy-binding` command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.dataplex import entry_group
from googlecloudsdk.api_lib.util import exceptions as gcloud_exception
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.dataplex import resource_args
from googlecloudsdk.command_lib.iam import iam_util
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
@base.DefaultUniverseOnly
class RemoveIamPolicyBinding(base.Command):
"""Remove IAM policy binding from a Dataplex Entry Group."""
detailed_help = {
'EXAMPLES':
"""\
To remove an IAM policy binding for the role `roles/dataplex.viewer`
for the user `testuser@gmail.com` from an entry group `test-entry-group` in project
`test-project` and in location `us-central1`, run:
$ {command} test-entry-group --project=test-project --location=us-central1 --role=roles/dataplex.viewer --member=user:testuser@gmail.com
See https://cloud.google.com/dataplex/docs/iam-roles for details of
policy role and member types.
""",
}
@staticmethod
def Args(parser):
resource_args.AddDataplexEntryGroupResourceArg(
parser, 'to remove IAM policy binding from ')
iam_util.AddArgsForRemoveIamPolicyBinding(parser)
@gcloud_exception.CatchHTTPErrorRaiseHTTPException(
'Status code: {status_code}. {status_message}.')
def Run(self, args):
entry_group_ref = args.CONCEPTS.entry_group.Parse()
result = entry_group.EntryGroupRemoveIamPolicyBinding(
entry_group_ref, args.member, args.role)
return result

View File

@@ -0,0 +1,66 @@
# -*- coding: utf-8 -*- #
# Copyright 2024 Google Inc. 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.
"""`gcloud dataplex entry-groups set-iam-policy-binding` command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.dataplex import entry_group
from googlecloudsdk.api_lib.util import exceptions as gcloud_exception
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.dataplex import resource_args
from googlecloudsdk.command_lib.iam import iam_util
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
@base.DefaultUniverseOnly
class SetIamPolicy(base.Command):
"""Set an IAM policy binding for a Dataplex Entry Group as defined in a JSON or YAML file.
See https://cloud.google.com/iam/docs/managing-policies for details of
the policy file format and contents.
"""
detailed_help = {
'EXAMPLES':
"""\
The following command will read an IAM policy defined in a JSON file
`policy.json` and set it for the Dataplex Entry Group `test-entry-group` in
project `test-project` and in location `us-central1`:
$ {command} test-entry-group --project=test-project --location=us-central1 policy.json
where policy.json is the relative path to the JSON file.
""",
}
@staticmethod
def Args(parser):
resource_args.AddDataplexEntryGroupResourceArg(
parser, 'to set IAM policy to.'
)
iam_util.AddArgForPolicyFile(parser)
@gcloud_exception.CatchHTTPErrorRaiseHTTPException(
'Status code: {status_code}. {status_message}.'
)
def Run(self, args):
entry_group_ref = args.CONCEPTS.entry_group.Parse()
result = entry_group.EntryGroupSetIamPolicyFromFile(
entry_group_ref, args.policy_file
)
return result

View File

@@ -0,0 +1,109 @@
# -*- coding: utf-8 -*- #
# Copyright 2024 Google Inc. 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.
"""`gcloud dataplex entry-groups update` command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.dataplex import entry_group
from googlecloudsdk.api_lib.dataplex import util as dataplex_util
from googlecloudsdk.api_lib.util import exceptions as gcloud_exception
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.command_lib.dataplex import resource_args
from googlecloudsdk.command_lib.util.args import labels_util
from googlecloudsdk.core import log
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
@base.DefaultUniverseOnly
class Update(base.Command):
"""Update a Dataplex Entry Group."""
detailed_help = {
'EXAMPLES':
"""\
To update Entry Group `test-entry-group` in project `test-project` at location `us-central1`,
with description `updated description` and display name `updated display name`, run:
$ {command} test-entry-group --location=us-central1 --project=test-project --description='updated description'
--display-name='updated display name'
""",
}
@staticmethod
def Args(parser):
resource_args.AddDataplexEntryGroupResourceArg(parser, 'to update.')
parser.add_argument(
'--description', required=False, help='Description of the Entry Group.'
)
parser.add_argument(
'--display-name',
required=False,
help='Display name of the Entry Group.',
)
parser.add_argument(
'--etag', required=False, help='etag value for particular Entry Group.'
)
async_group = parser.add_group(mutex=True, required=False)
async_group.add_argument(
'--validate-only',
action='store_true',
default=False,
help="Validate the update action, but don't actually perform it.",
)
base.ASYNC_FLAG.AddToParser(async_group)
labels_util.AddCreateLabelsFlags(parser)
@gcloud_exception.CatchHTTPErrorRaiseHTTPException(
'Status code: {status_code}. {status_message}.'
)
def Run(self, args):
update_mask = entry_group.GenerateEntryGroupUpdateMask(args)
if len(update_mask) < 1:
raise exceptions.HttpException(
'Update commands must specify at least one additional parameter to '
'change.'
)
entry_group_ref = args.CONCEPTS.entry_group.Parse()
dataplex_client = dataplex_util.GetClientInstance()
update_req_op = dataplex_client.projects_locations_entryGroups.Patch(
dataplex_util.GetMessageModule(
).DataplexProjectsLocationsEntryGroupsPatchRequest(
name=entry_group_ref.RelativeName(),
validateOnly=args.validate_only,
updateMask=u','.join(update_mask),
googleCloudDataplexV1EntryGroup=entry_group
.GenerateEntryGroupForUpdateRequest(args)))
validate_only = getattr(args, 'validate_only', False)
if validate_only:
log.status.Print('Validation complete.')
return
async_ = getattr(args, 'async_', False)
if not async_:
response = entry_group.WaitForOperation(update_req_op)
log.UpdatedResource(entry_group_ref, details='Operation was successful.')
return response
log.status.Print(
'Updating Entry Group [{0}] with operation [{1}].'.format(
entry_group_ref, update_req_op.name))
return update_req_op