8.2.34 | Linux | www-data (uid:33)
👁 View: hibernate.py
📁 /snap/google-cloud-cli/current/lib/surface/composer/environments/hibernate.py
# -*- coding: utf-8 -*- # # Copyright 2026 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 that hibernates an environment.""" from googlecloudsdk.api_lib.composer import environments_util as environments_api_util from googlecloudsdk.api_lib.composer import operations_util as operations_api_util from googlecloudsdk.calliope import base from googlecloudsdk.command_lib.composer import resource_args from googlecloudsdk.command_lib.composer import util as command_util from googlecloudsdk.core import log import six DETAILED_HELP = { 'EXAMPLES': ( """\ To hibernate the Cloud Composer environment named ``env-1'', run: $ {command} env-1 """ ) } @base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA) @base.DefaultUniverseOnly class Hibernate(base.Command): """Hibernate a Cloud Composer environment.""" detailed_help = DETAILED_HELP @staticmethod def Args(parser): resource_args.AddEnvironmentResourceArg(parser, 'to hibernate') base.ASYNC_FLAG.AddToParser(parser) def Run(self, args): env_resource = args.CONCEPTS.environment.Parse() operation = environments_api_util.Hibernate( env_resource, release_track=self.ReleaseTrack() ) if args.async_: return self._AsynchronousExecution(env_resource, operation) else: return self._SynchronousExecution(env_resource, operation) def _AsynchronousExecution(self, env_resource, operation): details = 'with operation [{0}]'.format(operation.name) log.UpdatedResource( env_resource.RelativeName(), kind='environment', is_async=True, details=details, ) return operation def _SynchronousExecution(self, env_resource, operation): try: operations_api_util.WaitForOperation( operation, 'Waiting for [{}] to be hibernated with [{}]'.format( env_resource.RelativeName(), operation.name ), release_track=self.ReleaseTrack(), ) except command_util.Error as e: raise command_util.Error( 'Error hibernating environment [{}]: {}'.format( env_resource.RelativeName(), six.text_type(e) ) )
← Back
💻 Terminal
📤 Upload
📂
Click or Drag & Drop
📁 /snap/google-cloud-cli/current/lib/surface/composer/environments
NameSizePermModifiedActions
📁 __pycache__/-07752026-10-06 18:39🗑 Delete
📁 snapshots/-07752026-10-06 18:39🗑 Delete
📁 storage/-07752026-10-06 18:39🗑 Delete
📁 user_workloads_config_maps/-07752026-10-06 18:39🗑 Delete
📁 user_workloads_secrets/-07752026-10-06 18:39🗑 Delete
__init__.py1.3K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
check_upgrade.py5.6K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
create.py50.5K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
database_failover.py3.4K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
delete.py3.8K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
describe.py1.4K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
fetch_database_properties.py1.5K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
hibernate.py2.7K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
list.py3K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
list_packages.py7.1K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
list_upgrades.py2.4K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
list_workloads.py2.4K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
migrate.py12.8K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
restart_web_server.py2.8K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
resume.py2.7K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
run.py19.6K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
update.py24.4K06441980-01-01 08:00👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del