def Run(self, args):
     """Runs the describe command."""
     location = resource_args.ParseAzureClusterResourceArg(args).locationsId
     with endpoint_util.GkemulticloudEndpointOverride(location):
         cluster_ref = resource_args.ParseAzureClusterResourceArg(args)
         client = api_util.ClustersClient()
         return client.Get(cluster_ref)
Ejemplo n.º 2
0
 def Run(self, args):
   """Runs the list command."""
   location_ref = args.CONCEPTS.location.Parse()
   with endpoint_util.GkemulticloudEndpointOverride(location_ref.locationsId):
     api_client = api_util.ClustersClient()
     return api_client.List(
         location_ref, page_size=args.page_size, limit=args.limit)
Ejemplo n.º 3
0
 def Run(self, args):
     """Runs the print-access-token command."""
     with endpoint_util.GkemulticloudEndpointOverride(
             resource_args.ParseAzureClusterResourceArg(args).locationsId,
             self.ReleaseTrack()):
         cluster_ref = resource_args.ParseAzureClusterResourceArg(args)
         client = api_util.ClustersClient()
         response = client.GenerateAccessToken(cluster_ref)
         if args.exec_credential:
             return kubeconfig.ExecCredential(
                 expiration_timestamp=response.expirationTime,
                 access_token=response.accessToken)
         return response
Ejemplo n.º 4
0
 def Run(self, args):
   """Runs the update command."""
   location = resource_args.ParseAzureClusterResourceArg(args).locationsId
   with endpoint_util.GkemulticloudEndpointOverride(location):
     cluster_ref = resource_args.ParseAzureClusterResourceArg(args)
     cluster_client = api_util.ClustersClient()
     message = command_util.ClusterMessage(
         cluster_ref.azureClustersId, action='Updating')
     return command_util.Update(
         resource_ref=cluster_ref,
         resource_client=cluster_client,
         args=args,
         message=message,
         kind=constants.AZURE_CLUSTER_KIND)
Ejemplo n.º 5
0
 def Run(self, args):
     """Runs the get-credentials command."""
     with endpoint_util.GkemulticloudEndpointOverride(
             resource_args.ParseAzureClusterResourceArg(args).locationsId,
             self.ReleaseTrack()):
         cluster_ref = resource_args.ParseAzureClusterResourceArg(args)
         client = api_util.ClustersClient()
         if not args.private_endpoint:
             kubeconfig.CheckClusterHasNodePools(api_util.NodePoolsClient(),
                                                 cluster_ref)
         resp = client.Get(cluster_ref)
         kubeconfig.ValidateClusterVersion(resp)
         context = kubeconfig.GenerateContext('azure',
                                              cluster_ref.projectsId,
                                              cluster_ref.locationsId,
                                              cluster_ref.azureClustersId)
         cmd_args = kubeconfig.GenerateAuthProviderCmdArgs(
             'azure', cluster_ref.azureClustersId, cluster_ref.locationsId,
             cluster_ref.projectsId)
         kubeconfig.GenerateKubeconfig(resp, context,
                                       args.auth_provider_cmd_path,
                                       cmd_args, args.private_endpoint)