# Copyright 2014 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Command for listing instances.""" from googlecloudsdk.api_lib.compute import base_classes class List(base_classes.ZonalLister): """List Google Compute Engine virtual machine instances.""" @property def service(self): return self.compute.instances @property def resource_type(self): return 'instances' List.detailed_help = base_classes.GetZonalListerHelp('instances')
size ) """) def Run(self, args): holder = base_classes.ComputeApiHolder(self.ReleaseTrack()) client = holder.client request_data = lister.ParseMultiScopeFlags(args, holder.resources) list_implementation = lister.MultiScopeLister( client, aggregation_service=client.apitools_client.networkEndpointGroups) return lister.Invoke(request_data, list_implementation) List.detailed_help = base_classes.GetZonalListerHelp('network endpoint groups') @base.ReleaseTracks(base.ReleaseTrack.ALPHA) class ListAlpha(base.ListCommand): """Lists Google Compute Engine network endpoint groups.""" @staticmethod def Args(parser): parser.display_info.AddFormat("""\ table( name, selfLink.scope().segment(-3).yesno(no="global"):label=LOCATION, networkEndpointType:label=ENDPOINT_TYPE, size )
# Copyright 2014 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Command for listing disk types.""" from googlecloudsdk.api_lib.compute import base_classes class List(base_classes.ZonalLister): """List Google Compute Engine disk types.""" @property def service(self): return self.compute.diskTypes @property def resource_type(self): return 'diskTypes' List.detailed_help = base_classes.GetZonalListerHelp('disk types')
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Command for listing private hosts.""" from googlecloudsdk.api_lib.compute import base_classes class List(base_classes.ZonalLister): """List Google Compute Engine private hosts.""" @property def service(self): return self.compute.hosts @property def resource_type(self): return 'hosts' List.detailed_help = base_classes.GetZonalListerHelp('hosts')
network.basename(), network.segment(-4):label=NETWORK_PROJECT, isManaged:label=MANAGED, size:label=INSTANCES ) """) parser.display_info.AddUriFunc(utils.MakeGetUriFunc()) lister.AddZonalListerArgs(parser) def Run(self, args): holder = base_classes.ComputeApiHolder(self.ReleaseTrack()) client = holder.client request_data = lister.ParseZonalFlags(args, holder.resources) list_implementation = lister.ZonalLister( client, client.apitools_client.instanceGroups) results = lister.Invoke(request_data, list_implementation) results = (resource for resource in results if 'zone' in resource) return instance_groups_utils.ComputeInstanceGroupManagerMembership( compute_holder=holder, items=results, filter_mode=instance_groups_utils.InstanceGroupFilteringMode. ONLY_UNMANAGED_GROUPS) List.detailed_help = base_classes.GetZonalListerHelp('unmanaged ' 'instance groups')
from googlecloudsdk.calliope import base from googlecloudsdk.core import properties class List(base.ListCommand): """List Google Compute Engine accelerator types.""" @staticmethod def Args(parser): parser.display_info.AddFormat(""" table( name, zone.basename(), description ) """) def Run(self, args): holder = base_classes.ComputeApiHolder(self.ReleaseTrack()) client = holder.client.apitools_client messages = client.MESSAGES_MODULE request = messages.ComputeAcceleratorTypesAggregatedListRequest( project=properties.VALUES.core.project.Get(required=True)) return holder.client.MakeRequests([(client.acceleratorTypes, 'AggregatedList', request)]) List.detailed_help = base_classes.GetZonalListerHelp('accelerator types')
class List(base.ListCommand): """List Google Compute Engine machine types.""" @staticmethod def Args(parser): parser.display_info.AddFormat("""\ table( name, zone.basename(), guestCpus:label=CPUS, memoryMb.size(units_in=MiB, units_out=GiB, precision=2):label=MEMORY_GB, deprecated.state:label=DEPRECATED ) """) parser.display_info.AddUriFunc(utils.MakeGetUriFunc()) parser.display_info.AddCacheUpdater(completers.MachineTypesCompleter) lister.AddZonalListerArgs(parser) def Run(self, args): holder = base_classes.ComputeApiHolder(self.ReleaseTrack()) client = holder.client request_data = lister.ParseZonalFlags(args, holder.resources) list_implementation = lister.ZonalLister( client, client.apitools_client.machineTypes) return lister.Invoke(request_data, list_implementation) List.detailed_help = base_classes.GetZonalListerHelp('machine types')
# Copyright 2014 Google Inc. All Rights Reserved. """Command for listing networks.""" from googlecloudsdk.api_lib.compute import base_classes from googlecloudsdk.api_lib.compute import networks_utils class List(base_classes.GlobalLister): """List Google Compute Engine networks.""" @property def service(self): return self.compute.networks @property def resource_type(self): return 'networks' def ComputeDynamicProperties(self, args, items): return networks_utils.AddMode(items) List.detailed_help = base_classes.GetZonalListerHelp('networks')