コード例 #1
0
 def Run(self, args):
     api = GetApiAdapter(self.ReleaseTrack())
     queues_client = api.queues
     queue_ref = parsers.ParseQueue(args.queue, args.location)
     location_ref = parsers.ExtractLocationRefFromQueueRef(queue_ref)
     queue_config = parsers.ParseCreateOrUpdateQueueArgs(
         args,
         constants.PUSH_QUEUE,
         api.messages,
         release_track=self.ReleaseTrack())
     if not self.is_alpha:
         create_response = queues_client.Create(
             location_ref,
             queue_ref,
             retry_config=queue_config.retryConfig,
             rate_limits=queue_config.rateLimits,
             app_engine_http_queue=queue_config.appEngineHttpQueue,
             stackdriver_logging_config=queue_config.
             stackdriverLoggingConfig)
     else:
         create_response = queues_client.Create(
             location_ref,
             queue_ref,
             retry_config=queue_config.retryConfig,
             rate_limits=queue_config.rateLimits,
             app_engine_http_target=queue_config.appEngineHttpTarget)
     log.CreatedResource(
         parsers.GetConsolePromptString(queue_ref.RelativeName()), 'queue')
     return create_response
コード例 #2
0
 def Run(self, args):
     api = GetApiAdapter(self.ReleaseTrack())
     queues_client = api.queues
     queue_ref = parsers.ParseQueue(args.queue, args.location)
     location_ref = parsers.ExtractLocationRefFromQueueRef(queue_ref)
     queue_config = parsers.ParseCreateOrUpdateQueueArgs(
         args,
         constants.PULL_QUEUE,
         api.messages,
         release_track=self.ReleaseTrack())
     if self.ReleaseTrack() == base.ReleaseTrack.ALPHA:
         create_response = queues_client.Create(
             location_ref,
             queue_ref,
             retry_config=queue_config.retryConfig,
             rate_limits=queue_config.rateLimits,
             pull_target=queue_config.pullTarget)
     else:
         create_response = queues_client.Create(
             location_ref,
             queue_ref,
             retry_config=queue_config.retryConfig,
             rate_limits=queue_config.rateLimits,
             queue_type=queue_config.type)
     log.CreatedResource(
         parsers.GetConsolePromptString(queue_ref.RelativeName()), 'queue')
     return create_response
コード例 #3
0
 def Run(self, args):
     queues_client = GetApiAdapter(self.ReleaseTrack()).queues
     queue_ref = parsers.ParseQueue(args.queue, args.location)
     queue_short = parsers.GetConsolePromptString(queue_ref.RelativeName())
     console_io.PromptContinue(
         cancel_on_no=True,
         prompt_string='Are you sure you want to purge: [{}]'.format(
             queue_short))
     queues_client.Purge(queue_ref)
     log.status.Print('Purged queue [{}].'.format(queue_short))
コード例 #4
0
 def Run(self, args):
     if self.ReleaseTrack() == base.ReleaseTrack.BETA:
         queue_type = args.type
     else:
         queue_type = constants.PUSH_QUEUE
     parsers.CheckUpdateArgsSpecified(args,
                                      queue_type,
                                      release_track=self.ReleaseTrack())
     api = GetApiAdapter(self.ReleaseTrack())
     queues_client = api.queues
     queue_ref = parsers.ParseQueue(args.queue, args.location)
     queue_config = parsers.ParseCreateOrUpdateQueueArgs(
         args,
         queue_type,
         api.messages,
         is_update=True,
         release_track=self.ReleaseTrack())
     updated_fields = parsers.GetSpecifiedFieldsMask(
         args, queue_type, release_track=self.ReleaseTrack())
     if self.ReleaseTrack() == base.ReleaseTrack.ALPHA:
         app_engine_routing_override = (
             queue_config.appEngineHttpTarget.appEngineRoutingOverride
             if queue_config.appEngineHttpTarget is not None else None)
         update_response = queues_client.Patch(
             queue_ref,
             updated_fields,
             retry_config=queue_config.retryConfig,
             rate_limits=queue_config.rateLimits,
             app_engine_routing_override=app_engine_routing_override)
     elif self.ReleaseTrack() == base.ReleaseTrack.BETA:
         app_engine_routing_override = (
             queue_config.appEngineHttpQueue.appEngineRoutingOverride
             if queue_config.appEngineHttpQueue is not None else None)
         update_response = queues_client.Patch(
             queue_ref,
             updated_fields,
             retry_config=queue_config.retryConfig,
             rate_limits=queue_config.rateLimits,
             app_engine_routing_override=app_engine_routing_override,
             stackdriver_logging_config=queue_config.
             stackdriverLoggingConfig,
             queue_type=queue_config.type)
     else:
         app_engine_routing_override = queue_config.appEngineRoutingOverride
         update_response = queues_client.Patch(
             queue_ref,
             updated_fields,
             retry_config=queue_config.retryConfig,
             rate_limits=queue_config.rateLimits,
             app_engine_routing_override=app_engine_routing_override,
             stackdriver_logging_config=queue_config.
             stackdriverLoggingConfig)
     log.status.Print('Updated queue [{}].'.format(
         parsers.GetConsolePromptString(queue_ref.RelativeName())))
     return update_response
コード例 #5
0
 def Run(self, args):
   queues_client = GetApiAdapter(self.ReleaseTrack()).queues
   queue_ref = parsers.ParseQueue(args.queue, args.location)
   queue_short = parsers.GetConsolePromptString(queue_ref.RelativeName())
   console_io.PromptContinue(
       cancel_on_no=True,
       prompt_string=(
           'Deleted queues can not be re-created for a duration of up to 7 '
           'days. Are you sure you want to delete: [{}]'.format(queue_short)))
   queues_client.Delete(queue_ref)
   log.DeletedResource(queue_short, 'queue')
 def Run(self, args):
   parsers.CheckUpdateArgsSpecified(args, constants.PULL_QUEUE,
                                    release_track=self.ReleaseTrack())
   api = GetApiAdapter(self.ReleaseTrack())
   queues_client = api.queues
   queue_ref = parsers.ParseQueue(args.queue, args.location)
   queue_config = parsers.ParseCreateOrUpdateQueueArgs(
       args,
       constants.PULL_QUEUE,
       api.messages,
       is_update=True,
       release_track=self.ReleaseTrack())
   updated_fields = parsers.GetSpecifiedFieldsMask(
       args, constants.PULL_QUEUE, release_track=self.ReleaseTrack())
   update_response = queues_client.Patch(
       queue_ref, updated_fields, retry_config=queue_config.retryConfig)
   log.status.Print('Updated queue [{}].'.format(
       parsers.GetConsolePromptString(queue_ref.RelativeName())))
   return update_response
コード例 #7
0
 def Run(self, args):
     if self.ReleaseTrack() == base.ReleaseTrack.BETA:
         queue_type = args.type
     else:
         queue_type = constants.PUSH_QUEUE
     api = GetApiAdapter(self.ReleaseTrack())
     queues_client = api.queues
     queue_ref = parsers.ParseQueue(args.queue, args.location)
     location_ref = parsers.ExtractLocationRefFromQueueRef(queue_ref)
     queue_config = parsers.ParseCreateOrUpdateQueueArgs(
         args, queue_type, api.messages, release_track=self.ReleaseTrack())
     if self.ReleaseTrack() == base.ReleaseTrack.ALPHA:
         create_response = queues_client.Create(
             location_ref,
             queue_ref,
             retry_config=queue_config.retryConfig,
             rate_limits=queue_config.rateLimits,
             app_engine_http_target=queue_config.appEngineHttpTarget)
     elif self.ReleaseTrack() == base.ReleaseTrack.BETA:
         create_response = queues_client.Create(
             location_ref,
             queue_ref,
             retry_config=queue_config.retryConfig,
             rate_limits=queue_config.rateLimits,
             app_engine_http_queue=queue_config.appEngineHttpQueue,
             stackdriver_logging_config=queue_config.
             stackdriverLoggingConfig,
             queue_type=queue_config.type)
     else:
         create_response = queues_client.Create(
             location_ref,
             queue_ref,
             retry_config=queue_config.retryConfig,
             rate_limits=queue_config.rateLimits,
             app_engine_routing_override=queue_config.
             appEngineRoutingOverride,
             stackdriver_logging_config=queue_config.
             stackdriverLoggingConfig)
     log.CreatedResource(
         parsers.GetConsolePromptString(queue_ref.RelativeName()), 'queue')
     return create_response
コード例 #8
0
 def Run(self, args):
   queues_client = GetApiAdapter(self.ReleaseTrack()).queues
   queue_ref = parsers.ParseQueue(args.queue, args.location)
   queues_client.Resume(queue_ref)
   log.status.Print('Resumed queue [{}].'.format(
       parsers.GetConsolePromptString(queue_ref.RelativeName())))