def Run(self, args): """Run 'api-gateway gateways delete'. Args: args: argparse.Namespace, The arguments that this command was invoked with. Raises: OperationCancelledError Returns: The response from the Delete API call. """ gateway_ref = args.CONCEPTS.gateway.Parse() # Prompt with a warning before continuing. console_io.PromptContinue( message='Are you sure? This will delete the gateway \'{}\', ' 'along with all of the associated consumer ' 'information.'.format(gateway_ref.RelativeName()), prompt_string='Continue anyway', default=True, throw_if_unattended=True, cancel_on_no=True) resp = gateways.GatewayClient().Delete(gateway_ref) wait = 'Waiting for API Gateway [{}] to be deleted'.format( gateway_ref.Name()) return operations_util.PrintOperationResult( resp.name, operations.OperationsClient(), wait_string=wait, is_async=args.async_)
def Run(self, args): parent_ref = args.CONCEPTS.location.Parse() return gateways.GatewayClient().List(parent_ref.RelativeName(), filters=args.filter, limit=args.limit, page_size=args.page_size, sort_by=args.sort_by)
def Run(self, args): gateway_ref = args.CONCEPTS.gateway.Parse() gateways_client = gateways.GatewayClient() gateway, mask = self.ProcessUpdates(gateways_client.Get(gateway_ref), args) resp = gateways_client.Update(gateway, update_mask=mask) op_client = operations.OperationsClient() return op_client.GetOperationResult(resp, is_async=args.async_)
def Run(self, args): gateway_ref = args.CONCEPTS.gateway.Parse() api_config_ref = args.CONCEPTS.api_config.Parse() gateways_client = gateways.GatewayClient() resp = gateways_client.Create(gateway_ref, api_config_ref, display_name=args.display_name, labels=args.labels) op_client = operations.OperationsClient() return op_client.GetOperationResult(resp, is_async=args.async_)
def Run(self, args): gateway_ref = args.CONCEPTS.gateway.Parse() gateways_client = gateways.GatewayClient() gateway, mask = self.ProcessUpdates(gateways_client.Get(gateway_ref), args) resp = gateways_client.Update(gateway, update_mask=mask) wait = 'Waiting for API Gateway [{}] to be updated'.format( gateway_ref.Name()) return operations_util.PrintOperationResult( resp.name, operations.OperationsClient(), service=gateways_client.service, wait_string=wait, is_async=args.async_)
def Run(self, args): gateway_ref = args.CONCEPTS.gateway.Parse() api_config_ref = args.CONCEPTS.api_config.Parse() gateways_client = gateways.GatewayClient() resp = gateways_client.Create(gateway_ref, api_config_ref, display_name=args.display_name, labels=args.labels) wait = 'Waiting for API Gateway [{}] to be created with [{}] config'.format( gateway_ref.Name(), api_config_ref.RelativeName()) return operations_util.PrintOperationResult( resp.name, operations.OperationsClient(), service=gateways_client.service, wait_string=wait, is_async=args.async_)
def Run(self, args): """Run 'api-gateway gateways delete'. Args: args: argparse.Namespace, The arguments that this command was invoked with. Raises: OperationCancelledError Returns: The response from the Delete API call. """ gateway_ref = args.CONCEPTS.gateway.Parse() # Prompt with a warning before continuing. console_io.PromptContinue( message='Are you sure? This will delete the gateway \'{}\', ' 'along with all of the associated consumer ' 'information.'.format(gateway_ref.RelativeName()), prompt_string='Continue anyway', default=True, throw_if_unattended=True, cancel_on_no=True) resp = gateways.GatewayClient().Delete(gateway_ref.RelativeName()) operation_ref = resources.REGISTRY.Parse( resp.name, collection='apigateway.projects.locations.operations') # If async operation, simply log and return the result on passed in object if args.async_: operations_util.PrintOperationResultWithWaitEpilogue( operation_ref, 'Asynchronous operation is in progress') return resp op_client = operations.OperationsClient() return op_client.WaitForOperation( operation_ref, 'Waiting for API Gateway [{}] to be deleted'.format( gateway_ref.Name()))
def Run(self, args): gateway_ref = args.CONCEPTS.gateway.Parse() gateways_client = gateways.GatewayClient() gateway, mask = self.ProcessUpdates(gateways_client.Get(gateway_ref), args) resp = gateways_client.Update(gateway, update_mask=mask) operation_ref = resources.REGISTRY.Parse( resp.name, collection='apigateway.projects.locations.operations') # If async operation, simply log and return the result on passed in object if args.async_: operations_util.PrintOperationResultWithWaitEpilogue( operation_ref, 'Asynchronous operation is in progress') return resp op_client = operations.OperationsClient() return op_client.WaitForOperation( operation_ref, 'Waiting for API Gateway [{}] to be updated'.format( gateway_ref.Name()), gateways_client.client.projects_locations_gateways)
def Run(self, args): gateway_ref = args.CONCEPTS.gateway.Parse() return gateways.GatewayClient().Get(gateway_ref)
def Run(self, args): gateway_ref = args.CONCEPTS.gateway.Parse() return gateways.GatewayClient().AddIamPolicyBinding( gateway_ref, args.member, args.role)