Beispiel #1
0
 def Run(self, args):
     """Obtain details about a given configuration."""
     conn_context = connection_context.GetConnectionContext(args)
     configuration_ref = args.CONCEPTS.configuration.Parse()
     with serverless_operations.Connect(conn_context) as client:
         conf = client.GetConfiguration(configuration_ref)
     if not conf:
         raise flags.ArgumentError('Cannot find configuration [{}]'.format(
             configuration_ref.configurationsId))
     return conf
Beispiel #2
0
 def Run(self, args):
     """Obtain details about a given service."""
     cluster_ref = args.CONCEPTS.cluster.Parse()
     service_ref = flags.GetService(args)
     with serverless_operations.Connect(cluster_ref) as client:
         serv = client.GetService(service_ref)
     if not serv:
         raise flags.ArgumentError('Cannot find service [{}]'.format(
             service_ref.servicesId))
     return serv
Beispiel #3
0
 def Run(self, args):
     """Obtain details about a given service."""
     conn_context = connection_context.GetConnectionContext(args)
     service_ref = flags.GetService(args)
     with serverless_operations.Connect(conn_context) as client:
         serv = client.GetService(service_ref)
     if not serv:
         raise flags.ArgumentError('Cannot find service [{}]'.format(
             service_ref.servicesId))
     return serv
Beispiel #4
0
    def Run(self, args):
        """Show details about a revision."""
        cluster_ref = args.CONCEPTS.cluster.Parse()
        revision_ref = args.CONCEPTS.revision.Parse()

        with serverless_operations.Connect(cluster_ref) as client:
            wrapped_revision = client.GetRevision(revision_ref)

        if not wrapped_revision:
            raise flags.ArgumentError('Cannot find revision [{}]'.format(
                revision_ref.revisionsId))
        return wrapped_revision
Beispiel #5
0
def GetConnectionContext(args):
    """Gets the regional or GKE connection context.

  Args:
    args: Namespace, the args namespace.

  Raises:
    ConfigurationError if cluster is specified without a location.

  Returns:
    A GKE or regional ConnectionInfo object.
  """

    cluster_ref = args.CONCEPTS.cluster.Parse()
    if cluster_ref:
        return _GKEConnectionContext(cluster_ref)

    flags.ValidateClusterArgs(args)
    region = flags.GetRegion(args, prompt=True)
    if not region:
        raise flags.ArgumentError(
            'You must specify either a cluster or a region.')
    return _RegionalConnectionContext(region)