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,46 @@
# -*- coding: utf-8 -*- #
# Copyright 2019 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 Artifact Registry packages."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.UniverseCompatible
class Packages(base.Group):
"""Manage Artifact Registry packages.
## EXAMPLES
To list all packages in the current project and `artifacts/repository` and
`artifacts/location` properties are set,
run:
$ {command} list
To list packages under repository my-repo in the current project and location,
run:
$ {command} list --repository=my-repo
To delete package `my-pkg` under repository my-repo in the current project and
location, run:
$ {command} delete my-pkg --repository=my-repo
"""
category = base.CI_CD_CATEGORY

View File

@@ -0,0 +1,31 @@
- release_tracks: [ALPHA, BETA, GA]
help_text:
brief: |
Delete an Artifact Registry package.
description: |
Delete an Artifact Registry package.
This command can fail for the following reasons:
* The specified package does not exist.
* The active account does not have permission to delete packages.
examples: |
To delete a package named `my-pkg` under the current project, repository, and location, run:
$ {command} my-pkg
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.artifacts.resources:package
help_text: |
The Artifact Registry package to delete.
request: &request
api_version: v1
collection: artifactregistry.projects.locations.repositories.packages
modify_request_hooks:
- googlecloudsdk.command_lib.artifacts.util:EscapePackageNameHook
async:
collection: artifactregistry.projects.locations.operations

View File

@@ -0,0 +1,27 @@
- release_tracks: [GA]
help_text:
brief: |
Describe an Artifact Registry package.
description: |
Describe an Artifact Registry package.
This command can fail for the following reasons:
* The specified package does not exist.
* The active account does not have permission to view packages.
examples: |
To describe a package named `my-pkg` under the current project, repository, and location, run:
$ {command} my-pkg
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.artifacts.resources:package
help_text: |
The Artifact Registry package to describe.
request: &request
api_version: v1
collection: artifactregistry.projects.locations.repositories.packages
modify_request_hooks:
- googlecloudsdk.command_lib.artifacts.util:EscapePackageNameHook

View File

@@ -0,0 +1,110 @@
# -*- 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.
"""List Artifact Registry packages."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.artifacts import flags
from googlecloudsdk.command_lib.artifacts import package_util
DEFAULT_LIST_FORMAT = """\
table(
name.sub("%5E", "^"):label=PACKAGE,
createTime.date(tz=LOCAL),
updateTime.date(tz=LOCAL),
annotations
)"""
@base.DefaultUniverseOnly
class List(base.ListCommand):
"""List Artifact Registry packages.
List all Artifact Registry packages in the specified repository and project.
To specify the maximum number of packages to list, use the --limit flag.
"""
detailed_help = {
'DESCRIPTION':
'{description}',
'EXAMPLES':
"""\
The following command lists a maximum of five packages:
$ {command} --limit=5
To list packages with name as `my-pkg`:
$ {command} --filter='name="projects/my-project/locations/us/repositories/my-repo/packages/my-pkg"
To list packages with a given partial name, use `*` to match any character in name:
$ {command} --filter='name="projects/my-project/locations/us/repositories/my-repo/packages/*pkg"'
$ {command} --filter='name="projects/my-project/locations/us/repositories/my-repo/packages/my*"'
To list files that have annotations:
$ {command} --filter=annotations:*
To list packages with annotations pair as [annotation_key: annotation_value]:
$ {command} --filter='annotations.annotation_key:annotation_value'
To list packages with annotations containing key as `my_key`:
$ {command} --filter='annotations.my_key'
If the key or value contains special characters, such as `my.key` or `my.value`, backtick("`") is required:
$ {command} --filter='annotations.`my.key`'
$ {command} --filter='annotations.`my.key`:`my.value`'
To list packages with given partial annotation key or value, use `*` to match any character:
$ {command} --filter='annotations.my_*:`*.value`'
To list packages ordered by create_time:
$ {command} --sort-by=create_time
To list packages ordered by update_time reversely:
$ {command} --sort-by=~update_time
"""
}
@staticmethod
def Args(parser):
parser.display_info.AddFormat(DEFAULT_LIST_FORMAT)
base.URI_FLAG.RemoveFromParser(parser)
flags.GetRepoFlag().AddToParser(parser)
def Run(self, args):
"""This is what gets called when the user runs this command.
Args:
args: an argparse namespace. All the arguments that were provided to this
command invocation.
Returns:
A list of packages.
"""
return package_util.ListPackages(args)

View File

@@ -0,0 +1,40 @@
- release_tracks: [GA]
help_text:
brief: |
Update annotations on an Artifact Registry package.
description: |
Update annotations on an Artifact Registry package.
examples: |
To update annotations on a package named `my-pkg` when the project ID, repository and location defaults are set, run the following command:
CAUTION: This command will overwrite any existing annotations on the package.
$ {command} my-pkg --annotations=key1=value1,key2=value2
To clear all annotations on the package run the following command:
$ {command} my-pkg --annotations={}
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.artifacts.resources:package
help_text: |
The Artifact Registry package to update.
params:
- arg_name: annotations
api_field: package.annotations
required: false
help_text: |
List of annotations in the format of KEY=VALUE pairs to add, update, or remove.
Duplicate keys will be overwritten. For more details on annotations,
see https://google.aip.dev/148#annotations.
spec:
- api_field: key
- api_field: value
request: &request
api_version: v1
collection: artifactregistry.projects.locations.repositories.packages
modify_request_hooks:
- googlecloudsdk.command_lib.artifacts.util:EscapePackageNameHook