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,28 @@
# -*- coding: utf-8 -*- #
# Copyright 2022 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 command group for managing Looker resources."""
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)
class Looker(base.Group):
"""Manage Looker resources."""
# See third_party/py/googlecloudsdk/calliope/base.py for a list of categories.
category = base.DATA_ANALYTICS_CATEGORY

View File

@@ -0,0 +1,53 @@
# -*- coding: utf-8 -*- #
# Copyright 2022 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 Looker backups."""
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
@base.UniverseCompatible
class Backups(base.Group):
"""Manage Looker instances.
## EXAMPLES
To create a backup of an instance with the name `my-looker-instance` and in
the region `us-central1`, run:
$ {command} create --instance='my-looker-instance --region=us-central1'
To delete a backup with the name `looker-backup` that is a backup of an
instance with the name `my-looker-instance` and in the region `us-central1`,
run:
$ {command} delete looker-backup --instance=my-looker-instance
--region=us-central1
To display the details for a backup with the name `looker-backup` that is a
backup of an instance with the name `my-looker-instance` and in the region
`us-central1`, run:
$ {command} describe looker-backup --instance=my-looker-instance
--region=us-central1
To list all backups of an instance with the name
`my-looker-instance` and in the region `us-central1`, run:
$ {command} list --instance=my-looker-instance --region=us-central1
"""
pass

View File

@@ -0,0 +1,66 @@
# -*- coding: utf-8 -*- #
# Copyright 2022 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 a backup of a Looker instance."""
from googlecloudsdk.api_lib.looker import backups
from googlecloudsdk.api_lib.looker import utils
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.looker import flags
from googlecloudsdk.core import properties
from googlecloudsdk.core import resources
_DETAILED_HELP = {
'DESCRIPTION': 'Create a backup of a Looker instance.',
'EXAMPLES': """ \
To create a backup of an instance with the name my-looker-instance, in
region us-central1 run:
$ {command} --instance='my-looker-instance' --region='us-central1'
""",
}
@base.UniverseCompatible
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class CreateInstanceBackup(base.CreateCommand):
"""Create a backup of a Looker instance."""
detailed_help = _DETAILED_HELP
@staticmethod
def Args(parser):
"""Register flags for this command."""
flags.AddInstance(parser)
parser.add_argument(
'--region',
required=True,
help=(""" \
The name of the Looker region of the instance. Overrides the
default looker/region property value for this command invocation.
"""),
)
def Run(self, args):
parent = resources.REGISTRY.Parse(
args.instance,
params={
'projectsId': properties.VALUES.core.project.GetOrFail,
'locationsId': args.region,
},
api_version=utils.VERSION_MAP[self.ReleaseTrack()],
collection='looker.projects.locations.instances',
).RelativeName()
return backups.CreateBackup(parent, self.ReleaseTrack())

View File

@@ -0,0 +1,38 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: |
Delete a backup of a Looker instance.
description: |
Delete a backup of a Looker instance.
This command can fail for the following reasons:
* The instance specified does not exist.
* The backup does not exist.
* The active account does not have permission to access the given
instance.
examples: |
To delete a backup with ID `c24ad631-ad83-42f0-9f98-41e2b493263e` on instance with name `my-looker-instance`, run:
$ {command} c24ad631-ad83-42f0-9f98-41e2b493263e --instance='my-looker-instance'
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.looker.resources:backup
help_text: |
The instance of the backup to delete.
input:
confirmation_prompt: |
You are about to delete backup [{__name__}] in [{locationsId}].
Any associated data will be lost.
request:
ALPHA:
api_version: v1alpha2
GA:
api_version: v1
collection: looker.projects.locations.instances.backups
async:
collection: looker.projects.locations.operations

View File

@@ -0,0 +1,42 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: |
Show metadata of a backup for a Looker instance.
description: |
Show metadata of a backup for a Looker instance.
Displays all metadata associated with a backup of a Looker instance given a valid backup and
instance name.
This command can fail for the following reasons:
* The instance specified does not exist.
* The backup specified does not exist.
* The active account does not have permission to access the given
instance and backups.
examples: |
To display the metadata for a backup with id of `c24ad631-ad83-42f0-9f98-41e2b493263e` on instance with name `my-looker-instance`, and in the region `us-central1`, run:
$ {command} c24ad631-ad83-42f0-9f98-41e2b493263e --instance='my-looker-instance' --region='us-central1'
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.looker.resources:backup
help_text: |
The instance of the backup to describe.
request:
ALPHA:
api_version: v1alpha2
GA:
api_version: v1
collection: looker.projects.locations.instances.backups
output:
format: |
table(
name.basename():label=NAME:sort=2,
state:label=STATUS,
createTime.date(),
expireTime.date()
)

View File

@@ -0,0 +1,38 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: |
List backups of a Looker instance.
description: |
List all backups of a Looker instance under the specified project and region.
To specify the maximum number of backups to list, use the --limit flag.
examples: |
To list up to five backups, of a Looker instance named `my-looker-instance` in the region `us-central1` run:
$ {command} --instance='my-looker-instance' --limit=5 --region='us-central1'
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.looker.resources:instance
help_text: |
The instance of the backups to display.
request:
ALPHA:
api_version: v1alpha2
GA:
api_version: v1
collection: looker.projects.locations.instances.backups
response:
id_field: name
output:
format: |
table(
name.basename():label=NAME:sort=2,
state:label=STATUS,
createTime.date():sort=1:reverse,
expireTime.date()
)

View File

@@ -0,0 +1,79 @@
# -*- coding: utf-8 -*- #
# Copyright 2022 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 Looker instances."""
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.UniverseCompatible
class Instances(base.Group):
"""Manage Looker instances.
## EXAMPLES
To create an instance with the name `my-looker-instance`, with an edition of
"LOOKER_CORE_STANDARD", run:
$ {command} create my-looker-instance --oauth-client-id='looker'
--oauth-client-secret='looker' --edition="core-standard" --async
Note: It is *recommended* that the *--async* argument is provided when
creating a Looker instance.
To delete an instance with the name `my-looker-instance`, run:
$ {command} delete my-looker-instance --async
To display the details for an instance with name `my-looker-instance`, run:
$ {command} describe my-looker-instance
To restart an instance with the name `my-looker-instance`, run:
$ {command} restart my-looker-instance --async
To update an instance with the name `my-looker-instance`, run:
$ {command} update my-looker-instance --async
To restore a backup with id of `7e504e66-c389-4d8d` that
belongs to an instance named `my-looker-instance`, in the region
`us-central1`, run:
$ {command} restore my-looker-instance --backup="7e504e66-c389-4d8"
--region="us-central1" --async
To export an instance with the name `my-looker-instance`, run:
$ {command} export my-looker-instance
--target-gcs-uri='gs://bucketName/folderName'
--kms-key='projects/my-project/locations/us-central1/keyRings/my-key-ring/cryptoKeys/my-key'
To import an instance with the name `my-looker-instance`, run:
$ {command} import my-looker-instance
--source-gcs-uri='gs://bucketName/folderName'
To list all the instances, run:
$ {command} list
"""
pass

View File

@@ -0,0 +1,297 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: |
Create a Looker instance.
description: |
Create a new Looker instance.
This command can fail for the following reasons:
* An instance with the same name already exists.
* The active account does not have permission to create instances.
* `--async` flag is not passed
examples: |
To create a basic tier instance with the name `my-looker-instance` in region `us-central-1`
with an edition of `LOOKER_CORE_STANDARD`, run:
$ {command} my-looker-instance --region=us-central1 --edition="core-standard" --oauth-client-id='looker' --oauth-client-secret='looker' --async
Note: It is *recommended* that the `--async` argument is provided when creating
a Looker instance.
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.looker.resources:instance
help_text: |
Arguments and flags that specify the Looker instance you want
to create.
params:
# Required Flags - edition
- arg_name: edition
api_field: instance.platformEdition
required: true
help_text: |
The edition of the Looker instance.
choices:
- enum_value: LOOKER_CORE_TRIAL
arg_value: core-trial
help_text: |
Trial edition of Looker.
- enum_value: LOOKER_CORE_STANDARD
arg_value: core-standard
help_text: |
A Looker (Google Cloud core) product for small organizations or teams with fewer than 50
users. This will be billed monthly while the instance is active.
- enum_value: LOOKER_CORE_STANDARD_ANNUAL
arg_value: core-standard-annual
help_text: |
A Looker (Google Cloud core) product for small organizations or teams with fewer than 50
users. This can be purchased via an annual contract.
- enum_value: LOOKER_CORE_ENTERPRISE_ANNUAL
arg_value: core-enterprise-annual
help_text: |
A Looker (Google Cloud core) product with enhanced security features for a wide variety of
internal BI and analytics use cases. This can be purchased via an annual contract.
- enum_value: LOOKER_CORE_EMBED_ANNUAL
arg_value: core-embed-annual
help_text: |
A Looker (Google Cloud core) product for deploying and maintaining external analytics and
custom applications at scale. This can be purchased via an annual contract.
- enum_value: LOOKER_CORE_NONPROD_STANDARD_ANNUAL
arg_value: nonprod-core-standard-annual
help_text: |
A non-production edition of Looker (Google Cloud core) product for small organizations or teams with fewer than 50
users. This can be purchased via an annual contract.
- enum_value: LOOKER_CORE_NONPROD_ENTERPRISE_ANNUAL
arg_value: nonprod-core-enterprise-annual
help_text: |
A non-production edition of Looker (Google Cloud core) product with enhanced security features for a wide variety of
internal BI and analytics use cases. This can be purchased via an annual contract.
- enum_value: LOOKER_CORE_NONPROD_EMBED_ANNUAL
arg_value: nonprod-core-embed-annual
help_text: |
A non-production edition of Looker (Google Cloud core) product for deploying and maintaining external analytics and
custom applications at scale. This can be purchased via an annual contract.
- enum_value: LOOKER_CORE_TRIAL_STANDARD
arg_value: core-trial-standard
help_text: |
A standard trial edition of Looker (Google Cloud core) product.
- enum_value: LOOKER_CORE_TRIAL_ENTERPRISE
arg_value: core-trial-enterprise
help_text: |
An enterprise trial edition of Looker (Google Cloud core) product.
- enum_value: LOOKER_CORE_TRIAL_EMBED
arg_value: core-trial-embed
help_text: |
An embed trial edition of Looker (Google Cloud core) product.
# Flags - Public IP
- arg_name: public-ip-enabled
api_field: instance.publicIpEnabled
type: bool
help_text: |
This specifies whether public IP is enabled on the Looker instance.
default: true
- arg_name: fips-enabled
api_field: instance.fipsEnabled
type: bool
help_text: |
This specifies whether FIPS is enabled on the Looker instance.
default: false
# Required Flags - OAuth
- api_field: instance.oauthConfig.clientId
arg_name: oauth-client-id
required: true
help_text: |
The client ID from an external OAuth application.
OAuth Application Credentials - Looker Instance OAuth login settings. Setup an OAuth
app that will allow users to authenticate and access the instance. For more
information see: https://developers.google.com/identity/protocols/oauth2/web-server#creatingcred
- api_field: instance.oauthConfig.clientSecret
arg_name: oauth-client-secret
required: true
help_text: |
The client secret from an external OAuth application.
OAuth Application Credentials - Looker Instance OAuth login settings. Setup an OAuth
app that will allow users to authenticate and access the instance. For more
information see: https://developers.google.com/identity/protocols/oauth2/web-server#creatingcred
# Class Type for PD SSD
- arg_name: class-type
required: false
api_field: instance.classType
help_text: |
The class type of the Looker instance.
choices:
- arg_value: r1
enum_value: R1
- arg_value: p1
enum_value: P1
# Group for Private IP
- group:
required: false
help_text: |
Private IP - Assigns an internal, Google-hosted VPC IP address. Private IP
connectivity requires additional APIs and permissions. Private IP cannot be disabled once it
has been enabled. If enabled, *consumer-network* must be assigned.
params:
- api_field: instance.privateIpEnabled
arg_name: private-ip-enabled
required: true
type: bool
help_text: |
This specifies whether private IP (PSA) is enabled on the Looker instance.
This flag is for creating a PSA (Private Service Access) instance.
- api_field: instance.consumerNetwork
arg_name: consumer-network
required: true
help_text: |
The network name within the consumer project. This MUST be delared if enabling private IP.
- api_field: instance.reservedRange
arg_name: reserved-range
help_text: |
The name of a reserved IP address range within the consumer network to be used for private
service access connection.
# Group for PSC
- group:
required: false
help_text: |
Private Service Connect - Private Service Connect allows private consumption of services
across VPC networks that belong to different groups, teams, projects, or organizations.
params:
- api_field: instance.pscEnabled
arg_name: psc-enabled
type: bool
required: true
help_text: |
This specifies whether Private Service Connect (PSC) is enabled on the Looker instance.
- api_field: instance.pscConfig.allowedVpcs
arg_name: psc-allowed-vpcs
help_text: |
List of VPCs that are allowed ingress into the Looker instance.
# Group for KMS Encryption config
- group:
required: false
help_text: |
Key resource - The Cloud KMS (Key Management Service) cryptokey that will be used to
protect the Looker instance and backups. The 'Looker Service Agent' service account must hold
permission 'Cloud KMS CryptoKey Encrypter/Decrypter'. The arguments in this group can
be used to specify the attributes of this resource.
params:
- api_field: instance.encryptionConfig.kmsKeyName
arg_name: kms-key
help_text: |
ID of the key or fully qualified identifier for the key. To
set the *kms-key* attribute:
* provide the argument *--kms-key* on the command line.
# Group for Maintanence Windows
- group:
required: false
help_text: |
Maintenance Window - Maintenance typically only takes place once every few months, and requires your instance
to be restarted while updates are made, which disrupts service briefly.
params:
- api_field: instance.maintenanceWindow.dayOfWeek
required: true
arg_name: maintenance-window-day
choices:
- arg_value: monday
enum_value: MONDAY
- arg_value: tuesday
enum_value: TUESDAY
- arg_value: wednesday
enum_value: WEDNESDAY
- arg_value: thursday
enum_value: THURSDAY
- arg_value: friday
enum_value: FRIDAY
- arg_value: saturday
enum_value: SATURDAY
- arg_value: sunday
enum_value: SUNDAY
help_text: |
Day of week for maintenance window, in UTC time zone.
- api_field: instance.maintenanceWindow.startTime
arg_name: maintenance-window-time
required: true
ALPHA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseTimeOfDayMainWindowV1Alpha
GA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseTimeOfDayMainWindowV1
help_text: |
Hour of day for maintenance window, in UTC time zone. A valid time of day must be
specified in 24hr format (ex: 13:00, 17:30, 23:45). Maintenance will be scheduled
within 60 minutes.
# Group for Deny Maintanence period
- group:
required: false
help_text: |
Deny Maintanence Period - You must allow at least 48 hours of maintenance availability in
a 60-day rolling window. Only contiguous availability windows of at least two hours are
considered. When setting a maintenance exclusion please be aware that excluding
application upgrades cannot exceed 60-days and excluding infrastructure upgrades cannot
exceed 90-days.
params:
- api_field: instance.denyMaintenancePeriod.startDate
arg_name: deny-maintenance-period-start-date
required: true
GA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseToDateTypeV1
ALPHA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseToDateTypeV1Alpha
help_text: |
Start date of the deny maintenance period in format: YYYY-MM-DD
- api_field: instance.denyMaintenancePeriod.endDate
arg_name: deny-maintenance-period-end-date
required: true
GA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseToDateTypeV1
ALPHA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseToDateTypeV1Alpha
help_text: |
End date of the deny maintenance period in format: YYYY-MM-DD
- api_field: instance.denyMaintenancePeriod.time
required: true
arg_name: deny-maintenance-period-time
GA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseTimeOfDayDenyPeriodV1
ALPHA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseTimeOfDayDenyPeriodV1Alpha
help_text: |
Time in UTC when the period starts and ends. A valid time of day must be
specified in 24hr format (ex: 13:00, 17:30, 23:45).
# Group for Gemini AI
- group:
required: false
release_tracks: [ALPHA]
help_text: |
Gemini AI - Gemini AI is a powerful AI model that can be used to answer questions,
generate content, and perform a variety of other tasks.
params:
- api_field: instance.geminiEnabled
arg_name: gemini-enabled
type: bool
required: true
help_text: |
This specifies whether Gemini AI is enabled on the Looker instance.
- api_field: instance.geminiAiConfig.trustedTester
arg_name: gemini-preview-tester-enabled
type: bool
help_text: |
This specifies whether user opts in for Gemini AI public preview for the Looker instance.
- api_field: instance.geminiAiConfig.promptLogging
arg_name: gemini-prompt-log-enabled
type: bool
help_text: |
This specifies whether Gemini AI prompt logging is enabled for the Looker instance.
async:
collection: looker.projects.locations.operations
request:
ALPHA:
api_version: v1alpha2
GA:
api_version: v1
collection: looker.projects.locations.instances

View File

@@ -0,0 +1,45 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: |
Delete a Looker instance.
description: |
Delete a Looker instance.
This command can fail for the following reasons:
* The instance specified does not exist.
* The active account does not have permission to access the given
instance.
examples: |
To delete an instance with the name `my-looker-instance` in your default region, run:
$ {command} my-looker-instance --async
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.looker.resources:instance
help_text: |
Arguments and flags that specify the Looker instance you want
to delete.
params:
- arg_name: force
api_field: force
required: false
type: bool
help_text: |
Force delete an instance.
input:
confirmation_prompt: |
You are about to delete instance [{__name__}] in [{locationsId}].
Any associated data will be lost.
request:
ALPHA:
api_version: v1alpha2
GA:
api_version: v1
collection: looker.projects.locations.instances
async:
collection: looker.projects.locations.operations

View File

@@ -0,0 +1,47 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: |
Show metadata for a Looker instance.
description: |
Show metadata for a Looker instance.
This command can fail for the following reasons:
* The instance specified does not exist.
* The active account does not have permission to access the given
instance.
examples: |
To display the metadata for an instance with the name `my-looker-instance` in the default
region, run:
$ {command} my-looker-instance
To display all fields of the instance metadata, add the `--format=json` flag:
$ {command} my-looker-instance --format=json
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.looker.resources:instance
help_text: |
Arguments and flags that specify the Looker instance you want
to describe.
request:
ALPHA:
api_version: v1alpha2
GA:
api_version: v1
collection: looker.projects.locations.instances
output:
format: |
table(
name.basename():label=NAME:sort=2,
lookerUri:label=INSTANCE_URL,
lookerVersion:label=VERSION,
platformEdition:label=EDITION,
state:label=STATUS,
createTime.date(),
updateTime.date()
)

View File

@@ -0,0 +1,61 @@
# -*- 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.
"""Export a Looker instance."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.looker import instances
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.looker import flags
from googlecloudsdk.core import log
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class Export(base.Command):
"""Export a Looker instance.
This command can fail for the following reasons:
* The instance specified does not exist.
* The active account does not have permission to access the given
instance.
* The Google Cloud Storage bucket does not exist.
"""
detailed_help = {'EXAMPLES': """\
To export an instance with the name `my-looker-instance` in the default
region, run:
$ {command} my-looker-instance --target-gcs-uri='gs://bucketName/folderName'
--kms-key='projects/my-project/locations/us-central1/keyRings/my-key-ring/cryptoKeys/my-key'
Note that the kms-key flag should be the full name of the kms key.
"""}
@staticmethod
def Args(parser):
"""Register flags for this command."""
flags.AddExportInstanceArgs(parser)
def Run(self, args):
instance_ref = args.CONCEPTS.instance.Parse()
op = instances.ExportInstance(instance_ref, args, self.ReleaseTrack())
log.status.Print(
'Export request issued for: [{}]\n'
'Check operation [{}] for status.'.format(args.instance, op.name)
)
return op

View File

@@ -0,0 +1,59 @@
# -*- 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.
"""Import a Looker instance."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.looker import instances
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.looker import flags
from googlecloudsdk.core import log
@base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.GA)
class Import(base.Command):
"""Import a Looker instance.
This command can fail for the following reasons:
* The instance specified does not exist.
* The active account does not have permission to access the given
instance.
* The Google Cloud Storage bucket does not exist.
"""
detailed_help = {'EXAMPLES': """\
To import an instance with the name `my-looker-instance` in the default
region, run:
$ {command} my-looker-instance --source-gcs-uri='gs://bucketName/folderName'
"""}
@staticmethod
def Args(parser):
"""Register flags for this command."""
flags.AddImportInstanceArgs(parser)
def Run(self, args):
instance_ref = args.CONCEPTS.instance.Parse()
op = instances.ImportInstance(instance_ref, args, self.ReleaseTrack())
log.status.Print(
'Import request issued for: [{}]\n'
'Check operation [{}] for status.'.format(args.instance, op.name)
)
return op

View File

@@ -0,0 +1,42 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: |
List Looker instances.
description: |
List all Looker instances under the specified project and region.
To specify the maximum number of instances to list, use the --limit flag.
examples: |
To list up to five instances, run:
$ {command} --limit=5
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.looker.resources:region
help_text: |
The region of the instances to display.
request:
ALPHA:
api_version: v1alpha2
GA:
api_version: v1
collection: looker.projects.locations.instances
response:
id_field: name
output:
format: |
table(
name.basename():label=NAME:sort=2,
lookerUri:label=INSTANCE_URL,
lookerVersion:label=VERSION,
name.segment(3):label=REGION,
platformEdition:label=EDITION,
state:label=STATUS,
createTime.date(),
updateTime.date()
)

View File

@@ -0,0 +1,38 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: |
Restart a Looker instance.
description: |
Restart for a Looker instance.
This command can fail for the following reasons:
* The instance specified does not exist.
* The active account does not have permission to access the given
instance.
examples: |
To restart an instance with the name `my-looker-instance` in the default
region, run:
$ {command} my-looker-instance --async
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.looker.resources:instance
help_text: |
Arguments and flags that specify the Looker instance you want
to describe.
request:
ALPHA:
api_version: v1alpha2
GA:
api_version: v1
collection: looker.projects.locations.instances
method: restart
async:
collection: looker.projects.locations.operations
output:
format: none

View File

@@ -0,0 +1,52 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: |
Restore a Looker instance from a backup.
description: |
Restore a Looker instance from a backup.
The Looker instance in which the backup is derived from will be restored to that specific backup.
This command can fail for the following reasons:
* The instance specified does not exist.
* The backup specified does not exist.
* The active account does not have permission to access the given
instance and backups.
examples: |
To restore a backup with id of `7e504e66-c389-4d8d-bca7-f710c6d96567` that belongs to an
instance named `my-looker-instance`, in the region `us-central1`, run:
$ {command} my-looker-instance --backup="7e504e66-c389-4d8d-bca7-f710c6d96567" --region="us-central1" --async
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.looker.resources:instance
help_text: |
Arguments and flags that specify the Looker instance you want
to describe.
params:
- arg_name: backup
api_field: restoreInstanceRequest.backup
required: true
help_text: |
The ID of the backup instance in the format
projects/{project}/locations/{location}/instances/{instance}/backups/{backup}
request:
ALPHA:
api_version: v1alpha2
modify_request_hooks:
- googlecloudsdk.command_lib.looker.backups_util:ModifyInstanceBackupNameAlpha
GA:
api_version: v1
modify_request_hooks:
- googlecloudsdk.command_lib.looker.backups_util:ModifyInstanceBackupName
collection: looker.projects.locations.instances
method: restore
async:
collection: looker.projects.locations.operations
output:
format: none

View File

@@ -0,0 +1,375 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: |
Update a Looker instance.
description: |
Update the metadata and/or configuration parameters of a Looker instance.
This command can fail for the following reasons:
* The instance specified does not exist.
* The active account does not have permission to update the given
instance.
examples: |
To update the maintenance window to Sunday at 11:00 PM for a Looker instance with the name
`my-looker-instance`, run:
$ {command} my-looker-instance --maintenance-window-day=sunday --maintenance-window-time='23:00' --async
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.looker.resources:instance
help_text: |
Arguments and flags that specify the Looker instance you want
to update.
params:
# Public Enabled Flags
- arg_name: public-ip-enabled
api_field: instance.publicIpEnabled
type: bool
help_text: |
This specifies whether public IP is enabled on the Looker instance.
- arg_name: linked-lsp-project-number
required: false
api_field: instance.linkedLspProjectNumber
type: long
help_text: |
The Looker Studio Pro project number to be linked.
# Class Type for PD SSD
- arg_name: class-type
required: false
api_field: instance.classType
help_text: |
The class type of the Looker instance.
choices:
- arg_value: r1
enum_value: R1
- arg_value: p1
enum_value: P1
# Group for Maintanence Windows
- group:
required: false
help_text: |
Maintenance Window - Maintenance typically only takes place once every few months, and requires your instance
to be restarted while updates are made, which disrupts service briefly.
params:
- api_field: instance.maintenanceWindow.dayOfWeek
required: true
arg_name: maintenance-window-day
choices:
- arg_value: monday
enum_value: MONDAY
- arg_value: tuesday
enum_value: TUESDAY
- arg_value: wednesday
enum_value: WEDNESDAY
- arg_value: thursday
enum_value: THURSDAY
- arg_value: friday
enum_value: FRIDAY
- arg_value: saturday
enum_value: SATURDAY
- arg_value: sunday
enum_value: SUNDAY
help_text: |
Day of the week for the maintenance window, in UTC time zone.
- api_field: instance.maintenanceWindow.startTime
arg_name: maintenance-window-time
required: true
ALPHA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseTimeOfDayMainWindowV1Alpha
GA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseTimeOfDayMainWindowV1
help_text: |
Hour of day for maintenance window, in UTC time zone. A valid time of day must be
specified in 24hr format (ex: 13:00, 17:30, 23:45). Maintenance will be scheduled
within 60 minutes. To set the maintenance-window-time* attribute:
* provide the argument *--maintenance-window-time* on the command line.
# Group for Deny Maintanence period
- group:
required: false
help_text: |
Deny Maintanence Period - You must allow at least 48 hours of maintenance availability in
a 60-day rolling window. Only contiguous availability windows of at least two hours are
considered. When setting a maintenance exclusion please be aware that excluding
application upgrades cannot exceed 60-days and excluding infrastructure upgrades cannot
exceed 90-days.
params:
- api_field: instance.denyMaintenancePeriod.startDate
arg_name: deny-maintenance-period-start-date
required: true
GA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseToDateTypeV1
ALPHA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseToDateTypeV1Alpha
help_text: |
Start date of the deny maintenance period in format: YYYY-MM-DD
- api_field: instance.denyMaintenancePeriod.endDate
arg_name: deny-maintenance-period-end-date
required: true
GA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseToDateTypeV1
ALPHA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseToDateTypeV1Alpha
help_text: |
End date of the deny maintenance period in format: YYYY-MM-DD
- api_field: instance.denyMaintenancePeriod.time
required: true
arg_name: deny-maintenance-period-time
GA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseTimeOfDayDenyPeriodV1
ALPHA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseTimeOfDayDenyPeriodV1Alpha
help_text: |
Time in UTC when the period starts and ends. A valid time of day must be
specified in 24hr format (ex: 13:00, 17:30, 23:45).
# Group for Admin Setting
- group:
required: false
help_text: |
Email Domain Allowlist for Scheduled Content - Define the email domains to which your
users can deliver Looker (Google Cloud core) content.
params:
- arg_name: allowed-email-domains
api_field: instance.adminSettings.allowedEmailDomains
required: true
help_text: |
This specifies the entire allowed email domain list.
# Group for Oauth configuration
- group:
required: false
help_text: |
OAuth Application Credentials - Looker Instance OAuth login settings. Setup an OAuth
app that will allow users to authenticate and access the instance. For more
information see: https://developers.google.com/identity/protocols/oauth2/web-server#creatingcred
params:
- arg_name: oauth-client-id
api_field: instance.oauthConfig.clientId
required: true
help_text: |
The client ID from an external OAuth application.
- arg_name: oauth-client-secret
api_field: instance.oauthConfig.clientSecret
required: true
help_text: |
The client secret from an external OAuth application.
# Group for Users Allocations
- group:
required: false
help_text: |
User Allocations - There are ten Standard and two Developer users included in the cost of
the product. You can allocate additional Standard, Viewer, and Developer users for this
instance. It is an optional step and can be modified later.
With the Standard edition of Looker (Google Cloud core), you can provision up to 50 total
users, distributed across Viewer, Standard, and Developer.
params:
- arg_name: add-viewer-users
api_field: instance.userMetadata.additionalViewerUserCount
help_text: |
Number of additional Viewer Users to allocate to the Looker Instance.
- arg_name: add-standard-users
api_field: instance.userMetadata.additionalStandardUserCount
help_text: |
Number of additional Standard Users to allocate to the Looker Instance.
- arg_name: add-developer-users
api_field: instance.userMetadata.additionalDeveloperUserCount
help_text: |
Number of additional Developer Users to allocate to the Looker Instance.
# Group for Gemini AI
- group:
required: false
release_tracks: [ALPHA]
help_text: |
Gemini AI - Gemini AI is a powerful AI model that can be used to answer questions,
generate content, and perform a variety of other tasks.
params:
- arg_name: gemini-enabled
api_field: instance.geminiEnabled
type: bool
required: true
help_text: |
This specifies whether Gemini AI is enabled on the Looker instance. To disable Gemini AI,
use the `--no-gemini-enabled` flag.
- arg_name: gemini-preview-tester-enabled
api_field: instance.geminiAiConfig.trustedTester
required: true
type: bool
help_text: |
This specifies whether user opts in for Gemini AI public preview for the Looker instance. To disable Gemini AI public preview,
use the `--no-gemini-preview-tester-enabled` flag.
- arg_name: gemini-prompt-log-enabled
api_field: instance.geminiAiConfig.promptLogging
required: true
type: bool
help_text: |
This specifies whether user opts in for Gemini AI prompt logging for the Looker instance. To disable Gemini AI prompt logging,
use the `--no-gemini-prompt-log-enabled` flag.
# Group for Custom Domain
- group:
required: false
help_text: |
Custom Domains - Looker (Google Cloud core) lets you serve your application through a custom
domain. If you use a custom domain, Google will provide a managed auto-renewing SSL
certificate for security.
DNS changes can take up to 24 hours to take effect. Your SSL certificate will take several
minutes to activate. Note that you must get the Type A DNS Record from the Google Cloud
Console and update with your domain registrar for your custom domain to work properly.
params:
- arg_name: custom-domain
api_field: instance.customDomain.domain
help_text: |
Domain name wanted to serve the Looker instance.
# Group for PSC
- group:
required: false
help_text: |
Private Service Connect - Private Service Connect allows the Looker Instance to be
reached via a private connection from inside a VPC network, and for the Looker Instance
to connect to managed services via private connections.
params:
- group:
mutex: true
params:
- api_field: instance.pscConfig.allowedVpcs
arg_name: psc-allowed-vpcs
help_text: |
List of VPCs that are allowed ingress into the Looker instance.
- arg_name: clear-psc-allowed-vpcs
action: store_true
help_text: |
Remove all service attachments from the PSC config of the instance.
- group:
mutex: true
params:
- api_field: instance.pscConfig.serviceAttachments
arg_name: psc-service-attachment
help_text: |
Service attachments representing egress connections for the Looker instance.
This flag can be repeated.
(Example: --psc-service-attachment domain="mydomain.com",attachment="projects/my-project/regions/us-east1/serviceAttachments/sa" --psc-service-attachments domain="mydomain2.com",attachment="projects/my-project/regions/us-east1/serviceAttachments/sa2")
You can also assign multiple domains to a single service attachment.
(Example: --psc-service-attachment multiple-domains="mydomain.com;mydomain2.com",attachment="projects/my-project/regions/us-east1/serviceAttachments/sa")
type:
arg_dict:
flatten: false
spec:
- api_field: localFqdn
arg_name: domain
required: false
type: str
- api_field: targetServiceAttachmentUri
arg_name: attachment
type: str
- api_field: localFqdns
required: false
arg_name: multiple-domains
type: 'googlecloudsdk.calliope.arg_parsers:ArgList:custom_delim_char=;'
- arg_name: clear-psc-service-attachments
action: store_true
help_text: |
Remove all allowed VPCs from the PSC config of the instance.
# Group for Periodic Export Config
- group:
required: false
mutex: true
params:
- group:
help_text: |
Configuration for periodic export. All flags in this group must be provided to enable or update the configuration.
params:
- arg_name: periodic-export-kms-key
api_field: instance.periodicExportConfig.kmsKey
required: false
help_text: |
Name of the CMEK key in KMS.
Format: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}
- arg_name: periodic-export-gcs-uri
api_field: instance.periodicExportConfig.gcsUri
required: false
help_text: |
Cloud Storage bucket URI for periodic export.
Format: gs://{bucket_name}
- arg_name: periodic-export-start-time
api_field: instance.periodicExportConfig.startTime
required: false
GA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseTimeOfDayPeriodicExportStartTimeV1
ALPHA:
processor: googlecloudsdk.command_lib.looker.instances_util:ParseTimeOfDayPeriodicExportStartTimeV1Alpha
help_text: |
Time in UTC when the periodic export job starts. A valid time of day must be
specified in 24hr format (ex: 13:00, 17:30, 23:45).
- arg_name: clear-periodic-export-config
action: 'store_true'
help_text: |
Clears all periodic export configuration from the instance.
# Group for Controlled Egress
- group:
required: false
release_tracks: [ALPHA, GA]
help_text: |
Controlled Egress - Controlled egress allows you to egress data from a Looker (Google Cloud core) instance to a third party service provider.
params:
- arg_name: egress-enabled
api_field: instance.controlledEgressEnabled
type: bool
required: false
help_text: |
This specifies whether controlled egress is enabled on the Looker instance. To disable controlled egress,
use the `--no-egress-enabled` flag.
- arg_name: marketplace-enabled
api_field: instance.controlledEgressConfig.marketplaceEnabled
type: bool
required: false
help_text: |
This specifies whether marketplace is enabled for controlled egress on the Looker instance. To disable marketplace for controlled egress,
use the `--no-marketplace-enabled` flag.
- arg_name: egress-fqdns
api_field: instance.controlledEgressConfig.egressFqdns
required: false
help_text: |
List of FQDNs that are allowed to egress from the Looker instance. Example: `--egress-fqdns="github.com,my.salesforce.com"`. To clear all egress FQDNs, use `--egress-fqdns=""`.
request:
ALPHA:
api_version: v1alpha2
modify_request_hooks:
- googlecloudsdk.command_lib.looker.instances_update_util:UpdateOauthClient
- googlecloudsdk.command_lib.looker.instances_update_util:ModifyAllowedEmailDomains
- googlecloudsdk.command_lib.looker.instances_update_util:UpdateMaintenanceWindow
- googlecloudsdk.command_lib.looker.instances_update_util:UpdateUserMetadata
- googlecloudsdk.command_lib.looker.instances_update_util:UpdateDenyMaintenancePeriod
- googlecloudsdk.command_lib.looker.instances_update_util:UpdatePublicIPEnabled
- googlecloudsdk.command_lib.looker.instances_update_util:UpdateCustomDomain
- googlecloudsdk.command_lib.looker.instances_update_util:UpdatePscAllowedVpcs
- googlecloudsdk.command_lib.looker.instances_update_util:UpdatePscServiceAttachments
- googlecloudsdk.command_lib.looker.instances_update_util:UpdateGeminiAiConfig
- googlecloudsdk.command_lib.looker.instances_update_util:UpdatePeriodicExportConfig
- googlecloudsdk.command_lib.looker.instances_update_util:UpdateControlledEgressConfig
GA:
api_version: v1
modify_request_hooks:
- googlecloudsdk.command_lib.looker.instances_update_util:UpdateOauthClient
- googlecloudsdk.command_lib.looker.instances_update_util:ModifyAllowedEmailDomains
- googlecloudsdk.command_lib.looker.instances_update_util:UpdateMaintenanceWindow
- googlecloudsdk.command_lib.looker.instances_update_util:UpdateUserMetadata
- googlecloudsdk.command_lib.looker.instances_update_util:UpdateDenyMaintenancePeriod
- googlecloudsdk.command_lib.looker.instances_update_util:UpdatePublicIPEnabled
- googlecloudsdk.command_lib.looker.instances_update_util:UpdateCustomDomain
- googlecloudsdk.command_lib.looker.instances_update_util:UpdatePscAllowedVpcs
- googlecloudsdk.command_lib.looker.instances_update_util:UpdatePscServiceAttachments
- googlecloudsdk.command_lib.looker.instances_update_util:UpdatePeriodicExportConfig
- googlecloudsdk.command_lib.looker.instances_update_util:UpdateControlledEgressConfig
collection: looker.projects.locations.instances
update:
disable_auto_field_mask: true
async:
collection: looker.projects.locations.operations
output:
format: none

View File

@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*- #
# Copyright 2022 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 Looker operations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
class Operations(base.Group):
"""Manage Looker operations.
## EXAMPLES
To display the details for an operation with name `my-looker-op`, run:
$ {command} describe my-looker-op
To list all the operations, run:
$ {command} list
"""

View File

@@ -0,0 +1,37 @@
- release_tracks: [ALPHA, GA]
help_text:
brief: |
Cancel a Looker import or export operation.
description: |
Cancel a Looker import or export operation.
examples: |
To cancel an operation named `my-looker-operation` in the default region, run:
$ {command} my-looker-operation
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.looker.resources:operation
help_text: |
Arguments and flags that specify the Looker operation you
want to describe.
request:
ALPHA:
api_version: v1alpha2
GA:
api_version: v1
collection: looker.projects.locations.operations
method: cancel
response:
modify_response_hooks:
- googlecloudsdk.command_lib.looker.operations_util:LogCanceledOperation
input:
confirmation_prompt: |
You are about to cancel [{__name__}].
output:
format: none

View File

@@ -0,0 +1,30 @@
- help_text:
brief: |
Show metadata for a Looker operation.
description: |
Display all metadata associated with a Looker operation given a valid
operation name.
This command can fail for the following reasons:
* The operation specified does not exist.
* The active account does not have permission to access the given
operation.
examples: |
To display the metadata for an operation named `my-looker-operation` in the default region,
run:
$ {command} my-looker-operation
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.looker.resources:operation
help_text: |
Arguments and flags that specify the Looker operation you
want to describe.
request:
ALPHA:
api_version: v1alpha2
GA:
api_version: v1
collection: looker.projects.locations.operations

View File

@@ -0,0 +1,39 @@
- help_text:
brief: |
List Looker operations.
description: |
List all Looker operations under the specified project and region.
To specify the maximum number of operations to list, use the --limit flag.
examples: |
To list up to five operations, run:
$ {command} --limit=5
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.looker.resources:region
help_text: |
The region of the operations to display.
request:
ALPHA:
api_version: v1alpha2
GA:
api_version: v1
collection: looker.projects.locations.operations
response:
id_field: name
output:
format: |
table(
name.basename():label=OPERATION_NAME,
name.segment(3):label=REGION,
metadata.verb:label=TYPE,
metadata.target.basename(),
done,
metadata.createTime.date():sort=1,
duration(start=metadata.createTime,end=metadata.endTime,precision=0,calendar=false).slice(2:).join("").yesno(no="<1S"):label=DURATION
)

View File

@@ -0,0 +1,32 @@
# -*- 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.
"""Command group for Looker regions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
class Regions(base.Group):
"""Manage Looker regions.
## EXAMPLES
To list all available regions, run:
$ {command} list
"""

View File

@@ -0,0 +1,32 @@
- help_text:
brief: |
List Looker regions.
description: |
List all available Looker regions.
examples: |
To list all available Looker regions, run:
$ {command}
arguments:
resource:
spec: !REF googlecloudsdk.command_lib.looker.resources:project
help_text: |
The project to list available Looker regions.
request:
ALPHA:
api_version: v1alpha2
GA:
api_version: v1
collection: looker.projects.locations
response:
id_field: name
output:
format: |
table(
locationId:label=NAME:sort=1
)