Beispiel #1
0
    def Display(self, args, result):
        """This method is called to print the result of the Run() method.

    Args:
      args: The arguments that command was run with.
      result: The value returned from the Run() method.
    """
        if not (args.log or args.service or args.only_project_sinks):
            list_printer.PrintResourceList('logging.typedSinks', result)
            if self._truncated:
                sdk_log.Print(
                    ('Some entries were truncated. '
                     'Use "logging sinks describe" for full details.'))
        else:
            list_printer.PrintResourceList('logging.sinks', result)
Beispiel #2
0
    def Display(self, unused_args, deployment):
        """Display prints information about what just happened to stdout.

    Args:
      unused_args: The same as the args in Run.

      deployment: a Deployment to print

    Raises:
      ValueError: if result is None or not a deployment
    """
        client = self.context['deploymentmanager-client']
        messages = self.context['deploymentmanager-messages']
        if not isinstance(deployment, messages.Deployment):
            raise ValueError('result must be a Deployment')

        # Get resources belonging to the deployment to display
        project = properties.VALUES.core.project.Get(required=True)
        resources = None
        try:
            response = client.resources.List(
                messages.DeploymentmanagerResourcesListRequest(
                    project=project, deployment=deployment.name))
            resources = response.resources
        except apitools_base.HttpError:
            pass  # Couldn't get resources, skip adding them to the table.
        resource_printer.Print(resources=deployment,
                               print_format=unused_args.format or 'yaml',
                               out=log.out)
        if resources:
            log.Print('resources:')
            list_printer.PrintResourceList('deploymentmanagerv2.resources',
                                           resources)
Beispiel #3
0
 def Display(self, _, result):
   instance_refs = []
   items = remote_completion.Iterate(result, instance_refs, self.ToSelfLink)
   list_printer.PrintResourceList(
       'cloudbilling.billingAccount',
       items,
   )
Beispiel #4
0
 def Display(self, args, result):
   instance_refs = []
   items = remote_completion.Iterate(result, instance_refs,
                                     self.ProjectIdToLink)
   list_printer.PrintResourceList('cloudresourcemanager.projects', items)
   cache = remote_completion.RemoteCompletion()
   cache.StoreInCache(instance_refs)
    def Display(self, unused_args, result):
        """Display prints information about what just happened to stdout.

    Args:
      unused_args: The same as the args in Run.

      result: an Operation (may be in progress or completed) to display
        or a list of Resources, if a synchronous preview or create completed.

    Raises:
      ValueError: if result is not a list of Resources or an Operation
    """
        messages = self.context['deploymentmanager-messages']
        if isinstance(result, messages.Operation):
            resource_printer.Print(resources=result,
                                   print_format=unused_args.format or 'yaml',
                                   out=log.out)
        elif isinstance(result, list) and not result:
            log.Print('No Deployments were found in your project!')
        elif isinstance(result, list) and isinstance(result[0],
                                                     messages.Resource):
            list_printer.PrintResourceList('deploymentmanagerv2.resources',
                                           result)
        else:
            raise ValueError(
                'result must be an Operation or list of Resources')
    def Display(self, unused_args, result):
        """Display prints information about what just happened to stdout.

    Args:
      unused_args: The same as the args in Run.

      result: an Operation (may be in progress or completed) to display
          or a list of Resources, if a synchronous stop completed
          successfully.

    Raises:
      ValueError: if result is None or not a dict
    """
        messages = self.context['deploymentmanager-messages']
        if isinstance(result, messages.Operation):
            resource_printer.Print(resources=result,
                                   print_format=unused_args.format or 'yaml',
                                   out=log.out)
        elif isinstance(result, list) and (not result or isinstance(
                result[0], messages.Resource)):
            list_printer.PrintResourceList('deploymentmanagerv2.resources',
                                           result)
        else:
            raise ValueError(
                'result must be an Operation or list of Resources')
Beispiel #7
0
  def Display(self, args, repos):
    """This method is called to print the result of the Run() method.

    Args:
      args: The arguments that command was run with.
      repos: The iterator over Repo messages returned from the Run() method.
    """
    list_printer.PrintResourceList('source.jobs.list', repos)
Beispiel #8
0
    def Display(self, args, result):
        """Method called by Calliope to print the result of the Run() method.

    Args:
      args: The arguments that the command was run with.
      result: The Run() method's result, which is a list of AndroidModels.
    """
        list_printer.PrintResourceList('test.android.devices', result)
  def Display(self, args, jobs):
    """This method is called to print the result of the Run() method.

    Args:
      args: all the arguments that were provided to this command invocation.
      jobs: The iterator over Job messages returned from the Run() method.
    """
    list_printer.PrintResourceList('dataflow.jobs', jobs)
Beispiel #10
0
  def Display(self, args, result):
    """This method is called to print the result of the Run() method.

    Args:
      args: The arguments that command was run with.
      result: The value returned from the Run() method.
    """
    list_printer.PrintResourceList('cloudresourcemanager.projects', [result])
    def Display(self, args, result):
        """This method is called to print the result of the Run() method.

    Args:
      args: The arguments that command was run with.
      result: The value returned from the Run() method.
    """
        list_printer.PrintResourceList('bigquery.datasets', result)
    def Display(self, args, targets):
        """This method is called to print the result of the Run() method.

    Args:
      args: The arguments that command was run with.
      targets: The value returned from the Run() method.
    """
        list_printer.PrintResourceList('debug.targets', targets)
    def Display(self, args, captures):
        """This method is called to print the result of the Run() method.

    Args:
      args: The arguments that command was run with.
      captures: The value returned from the Run() method.
    """
        list_printer.PrintResourceList('source.captures.list', captures)
Beispiel #14
0
    def Display(self, unused_args, result):
        """This method is called to print the result of the Run() method.

    Args:
      unused_args: The arguments that command was run with.
      result: The value returned from the Run() method.
    """
        list_printer.PrintResourceList('logging.typedSinks', [result])
Beispiel #15
0
    def Display(self, unused_args, result):
        """This method is called to print the result of the Run() method.

    Args:
      unused_args: The arguments that command was run with.
      result: The value returned from the Run() method.
    """
        list_printer.PrintResourceList('logging.sinks', [result])
        util.PrintPermissionInstructions(result.destination)
Beispiel #16
0
    def Display(self, unused_args, result):
        """This method is called to print the result of the Run() method.

    Args:
      unused_args: The arguments that command was run with.
      result: The value returned from the Run() method.
    """
        list_printer.PrintResourceList('functions.projects.regions.functions',
                                       result)
Beispiel #17
0
  def Display(self, unused_args, result):
    """Display prints information about what just happened to stdout.

    Args:
      unused_args: The same as the args in Run.
      result: A dict object representing the response if the api
          request was successful.
    """

    list_printer.PrintResourceList('sql.sslCerts', [result.clientCert.certInfo])
Beispiel #18
0
  def Display(self, args, job):
    """This method is called to print the result of the Run() method.

    Args:
      args: The arguments that command was run with.
      job: A Job message.
    """
    info = job_display.DisplayInfo(job)
    # Print information in the form of a one-row table:
    list_printer.PrintResourceList('bigquery.jobs.describe', [info])
Beispiel #19
0
    def Display(self, unused_args, result):
        # TODO(dczajka): Consider getting rid of instance group manager in api.
        def CoalescedInstanceGroupGenerator():
            for item in result:
                if item.instanceGroup:
                    item.instanceGroupManager = item.instanceGroup
                yield item

        list_printer.PrintResourceList('replicapoolupdater.rollingUpdates',
                                       CoalescedInstanceGroupGenerator())
Beispiel #20
0
    def Display(self, args, tables):
        """This method is called to print the result of the Run() method.

    Args:
      args: The arguments that command was run with.
      tables: An iterator over TableList.TablesValueListEntry messages.
    """
        try:
            list_printer.PrintResourceList('bigquery.tables.list', tables)
        except apitools_base.HttpError as server_error:
            raise bigquery.Error.ForHttpError(server_error)
Beispiel #21
0
  def Display(self, unused_args, result):
    """This method is called to print the result of the Run() method.

    Args:
      unused_args: The arguments that command was run with.
      result: The value returned from the Run() method.
    """
    try:
      list_printer.PrintResourceList('logging.metrics', result)
    except apitools_base.HttpError as error:
      raise exceptions.HttpException(util.GetError(error))
Beispiel #22
0
    def Display(self, unused_args, result):
        """Display prints information about what just happened to stdout.

    Args:
      unused_args: The same as the args in Run.
      result: The database created, or the operation if async.
    """
        if result.kind == 'sql#instance':
            list_printer.PrintResourceList('sql.instances.v1beta4', [result])
        else:
            self.format(result)
Beispiel #23
0
  def Display(self, unused_args, result):
    """Display prints information about what just happened to stdout.

    Args:
      unused_args: The same as the args in Run.
      result: A dict object representing the operations resource describing the
      clone operation if the clone was successful.
    """
    if result.kind == 'sql#instance':
      list_printer.PrintResourceList('sql.instances.v1beta4', [result])
    else:
      self.format(result)
    def Display(self, args, result):
        """Display prints information about what just happened to stdout.

    Args:
      args: The same as the args in Run.

      result: a list of Dataset objects.

    Raises:
      ValueError: if result is None or not a list
    """
        list_printer.PrintResourceList('genomics.datasets', result)
Beispiel #25
0
  def Display(self, args, jobs):
    """This method is called to print the result of the Run() method.

    Args:
      args: The arguments that command was run with.
      jobs: The iterator over JobsValueListEntry messages returned from the
        Run()
        method.
    """
    list_printer.PrintResourceList(
        'bigquery.jobs.list',
        [job_display.DisplayInfo(entry) for entry in jobs])
Beispiel #26
0
  def Display(self, args, result):
    """Display prints information about what just happened to stdout.

    Args:
      args: The same as the args in Run.

      result: a generator of Deployment objects.

    Raises:
      ValueError: if result is None or not a generator
    """
    if args.simple_list:
      empty_generator = True
      for deployment in result:
        empty_generator = False
        log.Print(deployment.name)
      if empty_generator:
        log.Print('No Deployments were found in your project!')
    else:
      list_printer.PrintResourceList('deploymentmanagerv2.deployments', result)
Beispiel #27
0
    def Display(self, args, result):
        """Display prints information about what just happened to stdout.

    Args:
      args: The same as the args in Run.

      result: a list of ManagedService objects.

    Raises:
      ValueError: if result is None or not a list
    """
        if not result:
            log.status.write(
                ('No managed services were found in your project: {0}\n'
                 ).format(self._GetValidatedProject(args.project)))
            return
        if args.simple_list:
            for service in result:
                log.Print(service.serviceName)
        else:
            list_printer.PrintResourceList('servicemanagement-v1.services',
                                           result)
Beispiel #28
0
    def Display(self, args, job):
        """This method is called to print the result of the Run() method.

    Args:
      args: The arguments that command was run with.
      job: A Job message.

    Raises:
      bigquery.BackendError: if job has failed.
    """
        info = job_display.DisplayInfo(job)
        # Print information in the form of a one-row table:
        list_printer.PrintResourceList('bigquery.jobs.wait', [info])
        if job_control.IsFailedJob(job):
            if args.ignore_error:
                log.err.Print('\nFAILURE (ignored): {0}'.format(
                    job.status.errorResult.message))
            else:
                log.err.Print()
                raise bigquery.BackendError(job.status.errorResult.message,
                                            job.status.errorResult, [],
                                            job.jobReference)
Beispiel #29
0
    def Display(self, args, result):
        """Display prints information about what just happened to stdout.

    Args:
      args: The same as the args in Run.

      result: a generator of Resource objects.

    Raises:
      ValueError: if result is None or not a generator
    """
        if not isinstance(result, types.GeneratorType):
            raise ValueError('result must be a generator')

        if args.simple_list:
            empty_generator = True
            for resource in result:
                empty_generator = False
                log.Print(resource.name)
            if empty_generator:
                log.Print('No Resources were found in your deployment!')
        else:
            list_printer.PrintResourceList('deploymentmanagerv2.resources',
                                           result)
Beispiel #30
0
 def Display(self, args, result):
     list_printer.PrintResourceList('dataproc.operations', result)