コード例 #1
0
def _DetailedHelp(include_l7_internal_load_balancing):
    if include_l7_internal_load_balancing:
        return base_classes.GetMultiScopeListerHelp(
            'URL maps',
            scopes=[
                base_classes.ScopeType.global_scope,
                base_classes.ScopeType.regional_scope
            ])
    else:
        return base_classes.GetGlobalListerHelp('URL maps')
コード例 #2
0
class List(base.ListCommand):
    """List target gRPC proxies."""

    detailed_help = base_classes.GetGlobalListerHelp('target gRPC proxies')

    @classmethod
    def Args(cls, parser):
        _Args(parser)

    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        return _Run(args, holder)
コード例 #3
0
          name,
          description,
          facilityProvider
        )
    """)

  def Run(self, args):
    holder = base_classes.ComputeApiHolder(self.ReleaseTrack())

    client = holder.client.apitools_client
    messages = client.MESSAGES_MODULE

    project = properties.VALUES.core.project.GetOrFail()

    args.filter, filter_expr = filter_rewrite.Rewriter().Rewrite(args.filter)

    request = messages.ComputeInterconnectLocationsListRequest(
        project=project, filter=filter_expr)

    results = list_pager.YieldFromList(
        client.interconnectLocations,
        request,
        field='items',
        limit=args.limit,
        batch_size=None)

    for item in results:
      yield item

List.detailed_help = base_classes.GetGlobalListerHelp('interconnect locations')
コード例 #4
0
ファイル: list.py プロジェクト: dominickhera/basicTokenAuthGo
from googlecloudsdk.api_lib.compute import lister
from googlecloudsdk.calliope import base


class List(base.ListCommand):
    """List Google Compute Engine snapshots."""
    @staticmethod
    def Args(parser):
        parser.display_info.AddFormat("""\
        table(
          name,
          diskSizeGb,
          sourceDisk.scope():label=SRC_DISK,
          status
        )""")
        lister.AddBaseListerArgs(parser)

    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        client = holder.client

        request_data = lister.ParseNamesAndRegexpFlags(args, holder.resources)

        list_implementation = lister.GlobalLister(
            client, client.apitools_client.snapshots)

        return lister.Invoke(request_data, list_implementation)


List.detailed_help = base_classes.GetGlobalListerHelp('snapshots')
コード例 #5
0
ファイル: list.py プロジェクト: dominickhera/basicTokenAuthGo
from googlecloudsdk.api_lib.compute import base_classes
from googlecloudsdk.api_lib.compute import lister
from googlecloudsdk.api_lib.compute import networks_utils
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.compute.networks import flags


class List(base.ListCommand):
  """List Google Compute Engine networks."""

  @staticmethod
  def Args(parser):
    lister.AddBaseListerArgs(parser)
    parser.display_info.AddFormat(flags.DEFAULT_LIST_FORMAT)
    parser.display_info.AddCacheUpdater(flags.NetworksCompleter)

  def Run(self, args):
    holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
    client = holder.client

    request_data = lister.ParseNamesAndRegexpFlags(args, holder.resources)

    list_implementation = lister.GlobalLister(
        client, client.apitools_client.networks)

    return (networks_utils.AddModesForListFormat(resource)
            for resource in lister.Invoke(request_data, list_implementation))


List.detailed_help = base_classes.GetGlobalListerHelp('networks')
コード例 #6
0
from googlecloudsdk.api_lib.compute import base_classes
from googlecloudsdk.calliope import base
from googlecloudsdk.core import properties


class List(base.ListCommand):
    """List security policies."""
    @staticmethod
    def Args(parser):
        parser.display_info.AddFormat('table(name)')

    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())

        client = holder.client.apitools_client
        messages = client.MESSAGES_MODULE

        project = properties.VALUES.core.project.Get(required=True)

        request = messages.ComputeSecurityPoliciesListRequest(
            project=project, filter=args.filter)

        return list_pager.YieldFromList(client.securityPolicies,
                                        request,
                                        field='items',
                                        limit=args.limit,
                                        batch_size=None)


List.detailed_help = base_classes.GetGlobalListerHelp('security policies')
コード例 #7
0
ファイル: list.py プロジェクト: hiroshiyoshida1980/jpopjam
        lister.AddBaseListerArgs(parser)
        parser.display_info.AddCacheUpdater(flags.TargetHttpProxiesCompleter)

    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        client = holder.client

        request_data = lister.ParseNamesAndRegexpFlags(args, holder.resources)

        list_implementation = lister.GlobalLister(
            client, client.apitools_client.targetHttpProxies)

        return lister.Invoke(request_data, list_implementation)


List.detailed_help = base_classes.GetGlobalListerHelp('target HTTP proxies')


@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class ListAlpha(base.ListCommand):
    """List Target HTTP Proxies.."""
    @classmethod
    def Args(cls, parser):
        parser.display_info.AddFormat(flags.DEFAULT_LIST_FORMAT)
        lister.AddMultiScopeListerFlags(parser, regional=True, global_=True)
        parser.display_info.AddCacheUpdater(
            flags.TargetHttpProxiesCompleterAlpha)

    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        client = holder.client
コード例 #8
0
        filter_expr = self.GetFilterExpr(args)

        image_projects = [self.project]

        if args.standard_images:
            image_projects.extend(constants.PUBLIC_IMAGE_PROJECTS)

        if args.preview_images:
            image_projects.extend(constants.PREVIEW_IMAGE_PROJECTS)

        requests = []
        for project in image_projects:
            requests.append((self.service, 'List',
                             self.messages.ComputeImagesListRequest(
                                 filter=filter_expr,
                                 maxResults=constants.MAX_RESULTS_PER_PAGE,
                                 project=project)))

        images = request_helper.MakeRequests(requests=requests,
                                             http=self.http,
                                             batch_url=self.batch_url,
                                             errors=errors,
                                             custom_get_requests=None)

        for image in images:
            if not image.deprecated or args.show_deprecated:
                yield image


List.detailed_help = base_classes.GetGlobalListerHelp('images')
コード例 #9
0
ファイル: list.py プロジェクト: Guliux10/bchacks_deepbreath
        'EXAMPLES':
        """\
          To list all external VPN gateways, run:

              $ {command}"""
    }

    @staticmethod
    def Args(parser):
        parser.display_info.AddFormat(flags.DEFAULT_LIST_FORMAT)

    def Run(self, args):
        """Issues the request to list all external VPN gateways."""
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        client = holder.client.apitools_client
        messages = client.MESSAGES_MODULE

        project = properties.VALUES.core.project.Get(required=True)

        request = messages.ComputeExternalVpnGatewaysListRequest(
            project=project, filter=args.filter)

        return list_pager.YieldFromList(client.externalVpnGateways,
                                        request,
                                        field='items',
                                        limit=args.limit,
                                        batch_size=None)


List.detailed_help = base_classes.GetGlobalListerHelp('external VPN gateways')
コード例 #10
0
ファイル: list.py プロジェクト: hemanthk92/CaseRoutingDemo
RESOURCE_TYPE = 'firewall rules'


@base.ReleaseTracks(base.ReleaseTrack.GA)
class List(base_classes.GlobalLister):
    """List Google Compute Engine firewall rules."""
    @property
    def service(self):
        return self.compute.firewalls

    @property
    def resource_type(self):
        return 'firewalls'


List.detailed_help = base_classes.GetGlobalListerHelp(RESOURCE_TYPE)

DETAILED_HELP = {
    'brief':
    'List Google Compute Engine ' + RESOURCE_TYPE,
    'DESCRIPTION':
    """\
          *{{command}}* displays all Google Compute Engine {0} in a project.
          """.format(RESOURCE_TYPE)
}

EXAMPLE_FORMAT = """\
          To list all {0} in a project in table form, run:

            $ {{command}}
コード例 #11
0
        lister.AddBaseListerArgs(parser)
        parser.display_info.AddCacheUpdater(flags.SslCertificatesCompleter)

    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        client = holder.client

        request_data = lister.ParseNamesAndRegexpFlags(args, holder.resources)

        list_implementation = lister.GlobalLister(
            client, client.apitools_client.sslCertificates)

        return lister.Invoke(request_data, list_implementation)


List.detailed_help = base_classes.GetGlobalListerHelp('SSL certificates')


@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class ListAlpha(base.ListCommand):
    """List Google Compute Engine SSL certificates."""
    @classmethod
    def Args(cls, parser):
        parser.display_info.AddFormat(flags.ALPHA_LIST_FORMAT)
        lister.AddMultiScopeListerFlags(parser, regional=True, global_=True)
        parser.display_info.AddCacheUpdater(
            flags.SslCertificatesCompleterAlpha)

    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        client = holder.client
コード例 #12
0
ファイル: list.py プロジェクト: sarahdactyl71/gneiss-rocks
  @staticmethod
  def Args(parser):
    parser.display_info.AddFormat(flags.DEFAULT_LIST_FORMAT)
    lister.AddBaseListerArgs(parser)

  def Run(self, args):
    compute_holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
    cua_holder = base_classes.ComputeUserAccountsApiHolder(self.ReleaseTrack())
    compute_client = compute_holder.client
    cua_client = cua_holder.client

    request_data = lister.ParseNamesAndRegexpFlags(args,
                                                   compute_holder.resources)

    errors = []

    for item in lister.GetGlobalResourcesDicts(
        service=cua_client.groups,
        project=list(request_data.scope_set)[0].project,
        filter_expr=request_data.filter,
        http=compute_client.apitools_client.http,
        batch_url='https://www.googleapis.com/batch/',
        errors=errors):
      yield item

    if errors:
      utils.RaiseToolException(errors)


List.detailed_help = base_classes.GetGlobalListerHelp('groups')
コード例 #13
0
from googlecloudsdk.core import log


@base.ReleaseTracks(base.ReleaseTrack.GA, base.ReleaseTrack.BETA)
class List(base_classes.GlobalLister):
    """List Google Compute Engine firewall rules."""
    @property
    def service(self):
        return self.compute.firewalls

    @property
    def resource_type(self):
        return 'firewalls'


List.detailed_help = base_classes.GetGlobalListerHelp('firewall rules')


@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class ListAlpha(List):
    """List Google Compute Engine firewall rules."""
    def Run(self, args):
        log.status.Print(flags.LIST_NOTICE)

        return super(ListAlpha, self).Run(args)

    def Collection(self):
        return 'compute.firewalls.alpha'


RESOURCE_TYPE = 'firewall rules'
コード例 #14
0
ファイル: list.py プロジェクト: wsong/google-cloud-sdk
# Copyright 2015 Google Inc. All Rights Reserved.
"""Command for listing users."""
from googlecloudsdk.api_lib.compute import base_classes


class List(base_classes.GlobalLister):
    """List Google Compute Engine users."""
    @property
    def service(self):
        return self.clouduseraccounts.users

    @property
    def resource_type(self):
        return 'users'

    @property
    def messages(self):
        return self.clouduseraccounts.MESSAGES_MODULE


List.detailed_help = base_classes.GetGlobalListerHelp('users')
コード例 #15
0
# 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 regions."""
from googlecloudsdk.api_lib.compute import base_classes


class List(base_classes.GlobalLister):
    """List Google Compute Engine regions."""
    @property
    def service(self):
        return self.compute.regions

    @property
    def resource_type(self):
        return 'regions'


List.detailed_help = base_classes.GetGlobalListerHelp('regions')
コード例 #16
0
# Copyright 2014 Google Inc. All Rights Reserved.
"""Command for listing backend services."""
from googlecloudsdk.api_lib.compute import base_classes


class List(base_classes.GlobalLister):
  """List backend services."""

  @property
  def service(self):
    return self.compute.backendServices

  @property
  def resource_type(self):
    return 'backendServices'


List.detailed_help = base_classes.GetGlobalListerHelp('backend services')
コード例 #17
0
ファイル: list.py プロジェクト: hiroshiyoshida1980/jpopjam
        """The service used to list regional resources."""
        return None

    @property
    def aggregation_service(self):
        """The service used to get aggregated list of resources."""
        return self.compute.healthChecks

    def GetResources(self, args, errors):
        health_checks = super(ListAlpha, self).GetResources(args, errors)

        # If a protocol is specified, check that it is one we support, and convert
        # it to a number.
        protocol_value = None
        if args.protocol is not None:
            protocol_value = self._ConvertProtocolArgToValue(args)
            if protocol_value not in self._ProtocolWhitelist():
                # TODO(b/111311137): Replace with InvalidArgumentException.
                raise exceptions.ToolException(
                    'Invalid health check protocol ' + args.protocol + '.')

        for health_check in health_checks:
            if (protocol_value is None
                    or health_check['type'] == args.protocol.upper()):
                yield health_check


List.detailed_help = base_classes.GetGlobalListerHelp('health checks')
ListBeta.detailed_help = base_classes.GetGlobalListerHelp('health checks')
ListAlpha.detailed_help = base_classes.GetGlobalListerHelp('health checks')
コード例 #18
0
        lister.AddBaseListerArgs(parser)
        parser.display_info.AddCacheUpdater(flags.UrlMapsCompleter)

    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        client = holder.client

        request_data = lister.ParseNamesAndRegexpFlags(args, holder.resources)

        list_implementation = lister.GlobalLister(
            client, client.apitools_client.urlMaps)

        return lister.Invoke(request_data, list_implementation)


List.detailed_help = base_classes.GetGlobalListerHelp('URL maps')


@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class ListAlpha(base.ListCommand):
    """List URL maps."""
    @staticmethod
    def Args(parser):
        parser.display_info.AddFormat(flags.DEFAULT_LIST_FORMAT)
        lister.AddMultiScopeListerFlags(parser, regional=True, global_=True)
        parser.display_info.AddCacheUpdater(flags.UrlMapsCompleterAlpha)

    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        client = holder.client
コード例 #19
0
"""Command for listing backend buckets."""
from googlecloudsdk.api_lib.compute import base_classes
from googlecloudsdk.api_lib.compute import lister
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.compute import completers
from googlecloudsdk.command_lib.compute.backend_buckets import flags


class List(base.ListCommand):
  """List backend buckets."""

  @staticmethod
  def Args(parser):
    parser.display_info.AddFormat(flags.DEFAULT_LIST_FORMAT)
    lister.AddBaseListerArgs(parser)
    parser.display_info.AddCacheUpdater(completers.InstancesCompleter)

  def Run(self, args):
    holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
    client = holder.client

    request_data = lister.ParseNamesAndRegexpFlags(args, holder.resources)

    list_implementation = lister.GlobalLister(
        client, client.apitools_client.backendBuckets)

    return lister.Invoke(request_data, list_implementation)


List.detailed_help = base_classes.GetGlobalListerHelp('backend buckets')
コード例 #20
0
    """Lists Compute Engine public delegated prefixes."""
    @staticmethod
    def Args(parser):
        parser.display_info.AddFormat("""\
      table(
        name,
        selfLink.scope().segment(-3).yesno(no="global"):label=LOCATION,
        parentPrefix.basename():label=PARENT_PREFIX,
        ipCidrRange:label=RANGE,
        status
      )""")

    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,
            regional_service=client.apitools_client.publicDelegatedPrefixes,
            global_service=client.apitools_client.
            globalPublicDelegatedPrefixes,
            aggregation_service=client.apitools_client.publicDelegatedPrefixes)

        return lister.Invoke(request_data, list_implementation)


List.detailed_help = base_classes.GetGlobalListerHelp(
    'public delegated prefixes')
コード例 #21
0
from googlecloudsdk.api_lib.compute import base_classes
from googlecloudsdk.api_lib.compute import lister
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.compute import completers
from googlecloudsdk.command_lib.compute.https_health_checks import flags


class List(base.ListCommand):
    """List HTTPS health checks."""
    @staticmethod
    def Args(parser):
        parser.display_info.AddFormat(flags.DEFAULT_LIST_FORMAT)
        lister.AddBaseListerArgs(parser)
        parser.display_info.AddCacheUpdater(
            completers.HttpsHealthChecksCompleter)

    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        client = holder.client

        request_data = lister.ParseNamesAndRegexpFlags(args, holder.resources)

        list_implementation = lister.GlobalLister(
            client, client.apitools_client.httpsHealthChecks)

        return lister.Invoke(request_data, list_implementation)


List.detailed_help = base_classes.GetGlobalListerHelp('HTTPS health checks')
コード例 #22
0
ファイル: list.py プロジェクト: hiroshiyoshida1980/jpopjam
      synthesized_network = resource_projector.MakeSerializable(network)
      for peering in synthesized_network['peerings']:
        peering['source_network'] = network.selfLink
      yield synthesized_network


@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class ListAlpha(List):
  """List Google Compute Engine network peerings."""

  @staticmethod
  def Args(parser):
    parser.display_info.AddFormat("""
        table(peerings:format="table(
            name,
            source_network.basename():label=NETWORK,
            network.map().scope(projects).segment(0):label=PEER_PROJECT,
            network.basename():label=PEER_NETWORK,
            autoCreateRoutes,
            importCustomRoutes,
            exportCustomRoutes,
            state,
            stateDetails
       )")
    """)
    parser.add_argument(
        '--network', help='Only show peerings of a specific network.')


List.detailed_help = base_classes.GetGlobalListerHelp('peerings')
コード例 #23
0
from googlecloudsdk.core import properties


class List(base.ListCommand):
  """List Google Compute Engine SSL policies."""

  @staticmethod
  def Args(parser):
    parser.display_info.AddFormat(flags.DEFAULT_LIST_FORMAT)

  def Run(self, args):
    """Issues the request to list all SSL policies."""
    holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
    client = holder.client.apitools_client
    messages = client.MESSAGES_MODULE

    project = properties.VALUES.core.project.Get(required=True)

    request = messages.ComputeSslPoliciesListRequest(
        project=project, filter=args.filter)

    return list_pager.YieldFromList(
        client.sslPolicies,
        request,
        field='items',
        limit=args.limit,
        batch_size=None)


List.detailed_help = base_classes.GetGlobalListerHelp('SSL policies')
コード例 #24
0
from googlecloudsdk.calliope import base


class List(base.ListCommand):
  """Lists Google Compute Engine public advertised prefixes."""

  @staticmethod
  def Args(parser):
    parser.display_info.AddFormat("""\
      table(
        name,
        ipCidrRange:label=RANGE,
        dnsVerificationIp,
        status
      )""")

  def Run(self, args):
    holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
    client = holder.client

    request_data = lister.ParseNamesAndRegexpFlags(
        args, holder.resources, client.messages.PublicAdvertisedPrefix)
    list_implementation = lister.GlobalLister(
        client, client.apitools_client.publicAdvertisedPrefixes)

    return lister.Invoke(request_data, list_implementation)


List.detailed_help = base_classes.GetGlobalListerHelp(
    'public advertised prefixes')