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,43 @@
# -*- coding: utf-8 -*- #
# Copyright 2017 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 gcloud app ssl-certificates group."""
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.BETA,
base.ReleaseTrack.GA)
class SslCertificates(base.Group):
"""View and manage your App Engine SSL certificates.
This set of commands can be used to view and manage your app's
SSL certificates.
"""
category = base.APP_ENGINE_CATEGORY
detailed_help = {
'DESCRIPTION':
'{description}',
'EXAMPLES':
"""\
To list your App Engine SSL certificates, run:
$ {command} list
""",
}

View File

@@ -0,0 +1,58 @@
# -*- coding: utf-8 -*- #
# Copyright 2017 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.
"""Surface for uploading an SSL certificate to an App Engine app."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.app.api import appengine_ssl_api_client as api_client
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.app import flags
from googlecloudsdk.core import log
class Create(base.CreateCommand):
"""Uploads a new SSL certificate.
The user must be the verified owner of the certificate domain(s). Use the
gcloud domains command group to manage domain ownership and verification.
"""
detailed_help = {
'DESCRIPTION':
'{description}',
'EXAMPLES':
"""\
To add a new SSL certificate to App Engine, run:
$ {command} --display-name='example cert' \
--certificate='/home/user/me/my_cert.cer' \
--private-key='/home/user/me/my_key.pfx'
""",
}
@staticmethod
def Args(parser):
flags.AddSslCertificateFlags(parser, required=True)
def Run(self, args):
client = api_client.GetApiClientForTrack(self.ReleaseTrack())
cert = client.CreateSslCertificate(
args.display_name,
cert_path=args.certificate,
private_key_path=args.private_key)
log.CreatedResource(cert.id)
return cert

View File

@@ -0,0 +1,53 @@
# -*- coding: utf-8 -*- #
# Copyright 2017 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.
"""Surface for deleting an SSL certificate from an App Engine app."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.app.api import appengine_ssl_api_client as api_client
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.app import flags
from googlecloudsdk.core import log
from googlecloudsdk.core.console import console_io
class Delete(base.DeleteCommand):
"""Deletes an SSL certificate."""
detailed_help = {
'DESCRIPTION':
'{description}',
'EXAMPLES':
"""\
To delete an App Engine SSL certificate, run:
$ {command} 1234
""",
}
@staticmethod
def Args(parser):
flags.CERTIFICATE_ID_FLAG.AddToParser(parser)
def Run(self, args):
client = api_client.GetApiClientForTrack(self.ReleaseTrack())
console_io.PromptContinue(
prompt_string=('Deleting certificate [{0}]'.format(args.id)),
cancel_on_no=True)
client.DeleteSslCertificate(args.id)
log.DeletedResource(args.id)

View File

@@ -0,0 +1,46 @@
# -*- coding: utf-8 -*- #
# Copyright 2017 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.
"""Surface for retrieving a single SSL certificate for an App Engine app."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.app.api import appengine_ssl_api_client as api_client
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.app import flags
class Describe(base.DescribeCommand):
"""Describes a specified SSL certificate."""
detailed_help = {
'DESCRIPTION':
'{description}',
'EXAMPLES':
"""\
To describe an App Engine SSL certificate, run:
$ {command} 1234
""",
}
@staticmethod
def Args(parser):
flags.CERTIFICATE_ID_FLAG.AddToParser(parser)
def Run(self, args):
client = api_client.GetApiClientForTrack(self.ReleaseTrack())
return client.GetSslCertificate(args.id)

View File

@@ -0,0 +1,73 @@
# -*- coding: utf-8 -*- #
# Copyright 2017 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.
"""Surface for listing all SSL certificates for an App Engine app."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.app.api import appengine_ssl_api_client as api_client
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.GA)
class List(base.ListCommand):
"""Lists the SSL certificates."""
detailed_help = {
'DESCRIPTION':
'{description}',
'EXAMPLES':
"""\
To list all App Engine SSL certificates, run:
$ {command}
This will return certificates mapped to domain-mappings for the
current app as well as all certificates that apply to domains which
the current user owns.
To view your owned domains, run `gcloud domains list-user-verified`.
""",
}
def Run(self, args):
return api_client.GetApiClientForTrack(
self.ReleaseTrack()).ListSslCertificates()
@staticmethod
def Args(parser):
parser.display_info.AddFormat("""
table(
id:sort=1,
display_name,
domain_names.list()
)
""")
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA)
class ListBeta(List):
@staticmethod
def Args(parser):
parser.display_info.AddFormat("""
table(
id:sort=1,
display_name,
domain_names.list(),
managed_certificate.status:label=MANAGED_CERTIFICATE_STATUS
)
""")

View File

@@ -0,0 +1,53 @@
# -*- coding: utf-8 -*- #
# Copyright 2017 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.
"""Surface for updating an SSL certificate for an App Engine app."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.app.api import appengine_ssl_api_client as api_client
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.app import flags
from googlecloudsdk.core import log
class Update(base.UpdateCommand):
"""Updates an SSL certificate."""
detailed_help = {
'DESCRIPTION':
'{description}',
'EXAMPLES':
"""\
To update an App Engine SSL certificate, run:
$ {command} 1234 --display-name='updated name' \
--certificate='/home/user/me/new_cert.cer' \
--private-key='/home/user/me/new_key.pfx'
""",
}
@staticmethod
def Args(parser):
flags.CERTIFICATE_ID_FLAG.AddToParser(parser)
flags.AddSslCertificateFlags(parser, required=False)
def Run(self, args):
client = api_client.GetApiClientForTrack(self.ReleaseTrack())
ssl_cert = client.UpdateSslCertificate(args.id, args.display_name,
args.certificate, args.private_key)
log.UpdatedResource(args.id)
return ssl_cert