Example #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)
Example #2
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: 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')
Example #3
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)
Example #4
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: an Operation (may be in progress or completed) to display
          or a list of Resources, if a synchronous cancel completed
          successfully.

    Raises:
      ValueError: if result is None or not a dict
    """
        messages = self.context['deploymentmanager-v2beta2-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(
                'deploymentmanagerv2beta2.resources', result)
        else:
            raise ValueError(
                'result must be an Operation or list of Resources')
Example #5
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)
Example #6
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.
    """
        list_printer.PrintResourceList('sql.instances', [result])
Example #7
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('bigquery.datasets', result)
Example #8
0
    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)
Example #9
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)
Example #10
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)
Example #11
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)
Example #12
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('container.projects.zones.clusters',
                                       result.clusters)
Example #13
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)
Example #14
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.
    """
        list_printer.PrintResourceList('sql.instances', [result])
Example #15
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])
Example #16
0
    def Display(self, unused_args, result):
        # TODO(user): 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())
Example #17
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])
Example #18
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 dict object representing the response if the api
          request was successful.
    """

        list_printer.PrintResourceList('sql.sslCerts',
                                       [result.clientCert.certInfo])
Example #19
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)
Example #20
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])
Example #21
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 Variant objects.

    Raises:
      ValueError: if result is None or not a list
    """
        list_printer.PrintResourceList('genomics.variants', result)
Example #22
0
    def Display(self, args, result):
        """Method called by Calliope to print the result of the Run() method.

    Args:
      args: The arguments that command was run with.
      result: one of:
        - a list of TestOutcome tuples (if ToolResults are available).
        - a URL string pointing to the user's raw results in GCS.
    """
        log.debug('gcloud test exit_code is: {0}'.format(self.exit_code))
        if type(result) == types.ListType:
            list_printer.PrintResourceList('test.run.outcomes', result)
        elif type(result) == types.StringType:
            log.out.Print(
                '\nMore details are available at [{0}].'.format(result))
        elif result is not None:
            log.out.Print(result)
Example #23
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)
Example #24
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 Operation objects.

    Raises:
      ValueError: if result is None or not a list
    """
        if not isinstance(result, list):
            raise ValueError('result must be a list')

        if not result:
            log.Print('No Operations were found in your project!')
            return

        if args.simple_list:
            for operation in result:
                log.Print(operation.name)
        else:
            list_printer.PrintResourceList(
                'deploymentmanagerv2beta2.operations', result)
Example #25
0
 def Display(self, args, result):
     list_printer.PrintResourceList('cloudresourcemanager.projects', result)
Example #26
0
 def Display(self, unused_args, result):
     list_printer.PrintResourceList('sql.operations', result)
Example #27
0
 def Display(self, unused_args, result):
     list_printer.PrintResourceList('sql.sslCerts', result)
Example #28
0
 def Display(self, unused_args, result):
     list_printer.PrintResourceList('sql.instances', result)
Example #29
0
 def Display(self, unused_args, result):
   instance_refs = []
   items = remote_completion.Iterate(result, instance_refs, self.GetRef)
   list_printer.PrintResourceList('sql.instances', items)
   cache = remote_completion.RemoteCompletion()
   cache.StoreInCache(instance_refs)
Example #30
0
 def Display(self, args, result):
     list_printer.PrintResourceList('dns.changes', result)