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. Raises: exceptions.ConflictingArgumentsException: If the user provides --transactional-writes and --route-any. Returns: Created resource. """ app_profile_ref = args.CONCEPTS.app_profile.Parse() try: result = app_profiles.Create( app_profile_ref, cluster=args.route_to, description=args.description, multi_cluster=args.route_any, transactional_writes=args.transactional_writes, force=args.force) except HttpError as e: util.FormatErrorMessages(e) else: log.CreatedResource(app_profile_ref.Name(), kind='app profile') return result
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. Raises: ConflictingArgumentsException: If both cluster and multi_cluster are present. If both multi_cluster and transactional_writes are present. OneOfArgumentsRequiredException: If neither cluster or multi_cluster are present. Returns: Created resource. """ app_profile_ref = args.CONCEPTS.app_profile.Parse() try: result = self._CreateAppProfile(app_profile_ref, args) except HttpError as e: util.FormatErrorMessages(e) else: log.CreatedResource(app_profile_ref.Name(), kind='app profile') return result
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. Raises: ConflictingArgumentsException: If both cluster and multi_cluster are present. If both multi_cluster and transactional_writes are present. OneOfArgumentsRequiredException: If neither cluster or multi_cluster are present. Returns: Updated resource. """ app_profile_ref = args.CONCEPTS.app_profile.Parse() try: result = self._UpdateAppProfile(app_profile_ref, args) except HttpError as e: util.FormatErrorMessages(e) else: operation_ref = util.GetOperationRef(result) if args.async_: log.UpdatedResource(operation_ref, kind='bigtable app profile {0}'.format( app_profile_ref.Name()), is_async=True) return result return util.AwaitAppProfile( operation_ref, 'Updating bigtable app profile {0}'.format( app_profile_ref.Name()))
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. Raises: exceptions.ConflictingArgumentsException: If the user provides --transactional-writes and --route-any. Returns: Created resource. """ app_profile_ref = args.CONCEPTS.app_profile.Parse() try: result = app_profiles.Update( app_profile_ref, cluster=args.route_to, description=args.description, multi_cluster=args.route_any, transactional_writes=args.transactional_writes, force=args.force) except HttpError as e: util.FormatErrorMessages(e) else: operation_ref = util.GetOperationRef(result) if args.async: log.UpdatedResource( operation_ref, kind='bigtable app-profile {0}'.format(app_profile_ref.Name()), is_async=True) return result return util.AwaitAppProfile( operation_ref, 'Updating bigtable app-profile {0}'.format(app_profile_ref.Name()))
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: Some value that we want to have printed later. """ app_profile_ref = args.CONCEPTS.app_profile.Parse() console_io.PromptContinue( 'You are about to delete app profile: [{}]'.format( app_profile_ref.Name()), throw_if_unattended=True, cancel_on_no=True) try: response = app_profiles.Delete(app_profile_ref, force=args.force) except HttpError as e: util.FormatErrorMessages(e) else: log.DeletedResource(app_profile_ref.Name(), 'app profile') return response