Ejemplo n.º 1
0
class List(base.ListCommand):
    """List vulnerability occurrences for instances.

  Lists occurrences with the "kind" field set to "PACKAGE_VULNERABILITY".
  """

    _INSTANCE_ARG = compute_flags.ResourceArgument(
        resource_name='instance',
        name='--instance',
        completer=compute_completers.InstancesCompleter,
        required=False,
        zonal_collection='compute.instances',
        short_help='The name of the instance to show vulnerabilities for.',
        zone_explanation='If not specified, it will be set to the same as zone.'
    )

    @staticmethod
    def Args(parser):
        List._INSTANCE_ARG.AddArgument(parser)

        parser.display_info.AddFormat("""\
        table(
          name.basename(),
          resource_url.basename():label=INSTANCE,
          resource_url.scope().split('/').slice(0).join(''):label=ZONE,
          noteName.basename():label=NOTE,
          vulnerabilityDetails.severity,
          vulnerabilityDetails.packageIssue.affectedLocation.package.join(','):label=PACKAGES
        )""")

    def _GetFilter(self, project, args, holder):
        filters = [
            'kind = "PACKAGE_VULNERABILITY"',  # Display only vulnerabilities
        ]

        prefix = 'https://www.googleapis.com/compute/projects/{}/zones/'.format(
            project)
        if args.instance:
            inst = List._INSTANCE_ARG.ResolveAsResource(
                args,
                holder.resources,
                scope_lister=compute_flags.GetDefaultScopeLister(
                    holder.client),
            )
            prefix = 'https://www.googleapis.com/compute/{}'.format(
                inst.RelativeName())

        filters.append('has_prefix(resource_url, "{}")'.format(prefix))

        return ' AND '.join(filters)

    def Run(self, args):
        """Yields filtered vulnerabilities."""
        project = properties.VALUES.core.project.Get()
        holder = base_classes.ComputeApiHolder(base.ReleaseTrack.ALPHA)
        resource_filter = self._GetFilter(project, args, holder)

        return containeranalysis_util.MakeOccurrenceRequest(
            project_id=project,
            resource_filter=resource_filter,
            occurrence_filter=None,
            resource_urls=None)
Ejemplo n.º 2
0
def MakeForceArg():
    return base.Argument('--force',
                         action='store_true',
                         default=False,
                         help="""\
          By default, image creation fails when it is created from a disk that
          is attached to a running instance. When this flag is used, image
          creation from disk will proceed even if the disk is in use.
          """)


REPLACEMENT_DISK_IMAGE_ARG = compute_flags.ResourceArgument(
    resource_name='disk image',
    name='--replacement',
    completer=ImagesCompleter,
    global_collection='compute.images',
    required=False,
    short_help='Specifies a Compute Engine image as a replacement.',
    detailed_help=_REPLACEMENT_DISK_DETAILED_HELP)

SOURCE_DISK_ARG = compute_flags.ResourceArgument(
    resource_name='source disk',
    name='--source-disk',
    completer=compute_completers.DisksCompleter,
    zonal_collection='compute.disks',
    short_help='The deprecation state to set on the image.',
    detailed_help=_SOURCE_DISK_DETAILED_HELP,
    zone_explanation=_SOURCE_DISK_ZONE_EXPLANATION,
    required=False)

SOURCE_IMAGE_ARG = compute_flags.ResourceArgument(
Ejemplo n.º 3
0
                                                             **kwargs)


def MakeZonalInstanceGroupArg(plural=False):
    return flags.ResourceArgument(
        resource_name='instance group',
        completer=compute_completers.InstanceGroupsCompleter,
        plural=plural,
        zonal_collection='compute.instanceGroups',
        zone_explanation=flags.ZONE_PROPERTY_EXPLANATION)


MULTISCOPE_INSTANCE_GROUP_ARG = flags.ResourceArgument(
    resource_name='instance group',
    completer=compute_completers.InstanceGroupsCompleter,
    zonal_collection='compute.instanceGroups',
    regional_collection='compute.regionInstanceGroups',
    zone_explanation=flags.ZONE_PROPERTY_EXPLANATION_NO_DEFAULT,
    region_explanation=flags.REGION_PROPERTY_EXPLANATION_NO_DEFAULT)

ZONAL_INSTANCE_GROUP_MANAGER_ARG = flags.ResourceArgument(
    resource_name='managed instance group',
    completer=ZonalInstanceGroupManagersCompleter,
    zonal_collection='compute.instanceGroupManagers',
    zone_explanation=flags.ZONE_PROPERTY_EXPLANATION)

ZONAL_INSTANCE_GROUP_MANAGERS_ARG = flags.ResourceArgument(
    resource_name='managed instance group',
    plural=True,
    name='names',
    completer=ZonalInstanceGroupManagersCompleter,
Ejemplo n.º 4
0
        resource_name='forwarding rule',
        name='--next-hop-ilb',
        completer=ForwardingRulesCompleter,
        plural=False,
        required=required,
        regional_collection='compute.forwardingRules',
        short_help=
        'Target forwarding rule that will receive forwarded traffic.',
        region_explanation=compute_flags.REGION_PROPERTY_EXPLANATION)


BACKEND_SERVICE_ARG = compute_flags.ResourceArgument(
    name='--backend-service',
    required=False,
    resource_name='backend service',
    regional_collection='compute.regionBackendServices',
    global_collection='compute.targetBackendServices',
    short_help='Target backend service that will receive the traffic.',
    region_explanation=('If not specified, it will be set to the'
                        ' region of the forwarding rule.'))

NETWORK_ARG_ALPHA = compute_flags.ResourceArgument(
    name='--network',
    required=False,
    resource_name='networks',
    global_collection='compute.networks',
    short_help='Network that this forwarding rule applies to.',
    detailed_help="""\
        (Only for --load-balancing-scheme=INTERNAL or
        --load-balancing-scheme=INTERNAL_SELF_MANAGED) Network that this
        forwarding rule applies to. If this field is not specified, the default
Ejemplo n.º 5
0
# limitations under the License.
"""Flags and helpers for the compute routers commands."""

from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals

import textwrap
import enum
from googlecloudsdk.calliope import arg_parsers
from googlecloudsdk.command_lib.compute import flags as compute_flags

IP_ADDRESSES_ARG = compute_flags.ResourceArgument(
    name='--nat-external-ip-pool',
    short_help='External IP Addresses to use for NAT',
    resource_name='address',
    regional_collection='compute.addresses',
    region_hidden=True,
    plural=True,
    required=False)


class IpAllocationOption(enum.Enum):
    AUTO = 0
    MANUAL = 1


class SubnetOption(enum.Enum):
    ALL_RANGES = 0
    PRIMARY_RANGES = 1
    CUSTOM_RANGES = 2
Ejemplo n.º 6
0
        resource_name='forwarding rule',
        name='--next-hop-ilb',
        completer=ForwardingRulesCompleter,
        plural=False,
        required=required,
        regional_collection='compute.forwardingRules',
        short_help=
        'The target forwarding rule that will receive forwarded traffic.',
        region_explanation=compute_flags.REGION_PROPERTY_EXPLANATION)


BACKEND_SERVICE_ARG = compute_flags.ResourceArgument(
    name='--backend-service',
    required=False,
    resource_name='backend service',
    regional_collection='compute.regionBackendServices',
    global_collection='compute.targetBackendServices',
    short_help='The target backend service that will receive the traffic.',
    region_explanation=('If not specified it will be set the'
                        ' region of the forwarding rule.'))

NETWORK_ARG = compute_flags.ResourceArgument(
    name='--network',
    required=False,
    resource_name='networks',
    global_collection='compute.networks',
    short_help='The network that this forwarding rule applies to.',
    detailed_help="""\
        (Only for --load-balancing-scheme=INTERNAL) The network that this
        forwarding rule applies to. If this field is not specified, the default
        network will be used. In the absence of the default network, this field
Ejemplo n.º 7
0
def NetworkArgument(required=True, plural=False):
    return compute_flags.ResourceArgument(resource_name='network',
                                          completer=NetworksCompleter,
                                          plural=plural,
                                          required=required,
                                          global_collection='compute.networks')
Ejemplo n.º 8
0
def MakeNetworkEndpointGroupsArg():
    return compute_flags.ResourceArgument(
        resource_name='network endpoint group',
        zonal_collection='compute.networkEndpointGroups',
        zone_explanation=compute_flags.ZONE_PROPERTY_EXPLANATION)
Ejemplo n.º 9
0
def MakeRegionArg():
    return compute_flags.ResourceArgument(
        resource_name='region',
        completer=compute_completers.RegionsCompleter,
        global_collection='compute.regions')
        list_command='compute backend-buckets list --uri',
        **kwargs)


def BackendBucketArgument(plural=False):
  return compute_flags.ResourceArgument(
      name='backend_bucket_name',
      resource_name='backend bucket',
      plural=plural,
      completer=BackendBucketsCompleter,
      global_collection='compute.backendBuckets')

GCS_BUCKET_ARG = compute_flags.ResourceArgument(
    resource_name='backend bucket',
    completer=BackendBucketsCompleter,
    name='--gcs-bucket-name',
    plural=False,
    required=False,
    global_collection='compute.backendBuckets',
    detailed_help=_GCS_BUCKET_DETAILED_HELP)

REQUIRED_GCS_BUCKET_ARG = compute_flags.ResourceArgument(
    resource_name='backend bucket',
    completer=BackendBucketsCompleter,
    name='--gcs-bucket-name',
    plural=False,
    global_collection='compute.backendBuckets',
    detailed_help=_GCS_BUCKET_DETAILED_HELP)


def BackendBucketArgumentForUrlMap(required=True):
  return compute_flags.ResourceArgument(
Ejemplo n.º 11
0
def MakeNodeGroupArg():
    return compute_flags.ResourceArgument(
        resource_name='node group',
        zonal_collection='compute.nodeGroups',
        zone_explanation=compute_flags.ZONE_PROPERTY_EXPLANATION)
Ejemplo n.º 12
0
# Copyright 2017 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.
"""Flags and helpers for the compute snapshots commands."""

from googlecloudsdk.command_lib.compute import flags as compute_flags

SNAPSHOT_ARG = compute_flags.ResourceArgument(
    resource_name='snapshot',
    completion_resource_id='compute.snapshots',
    global_collection='compute.snapshots')
Ejemplo n.º 13
0
def MakePublicDelegatedPrefixesArg():
    return compute_flags.ResourceArgument(
        resource_name='public delegated prefix',
        regional_collection='compute.publicDelegatedPrefixes',
        global_collection='compute.globalPublicDelegatedPrefixes')
Ejemplo n.º 14
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.
"""Flags for the `compute public-delegated-prefixes` commands."""

from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals

from googlecloudsdk.command_lib.compute import flags as compute_flags

PUBLIC_DELEGATED_PREFIX_FLAG_ARG = compute_flags.ResourceArgument(
    name='--public-delegated-prefix',
    resource_name='public delegated prefix',
    global_collection='compute.globalPublicDelegatedPrefixes',
    regional_collection='compute.publicDelegatedPrefixes',
    region_explanation=compute_flags.REGION_PROPERTY_EXPLANATION)


def MakePublicDelegatedPrefixesArg():
    return compute_flags.ResourceArgument(
        resource_name='public delegated prefix',
        regional_collection='compute.publicDelegatedPrefixes',
        global_collection='compute.globalPublicDelegatedPrefixes')


def AddCreatePdpArgsToParser(parser):
    """Adds flags for public delegated prefixes create command."""
    parser.add_argument(
        '--public-advertised-prefix',
Ejemplo n.º 15
0
#    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.
"""Flags and helpers for the compute backend-services commands."""

import argparse
from googlecloudsdk.calliope import arg_parsers
from googlecloudsdk.command_lib.compute import flags as compute_flags

ZONAL_INSTANCE_GROUP_ARG = compute_flags.ResourceArgument(
    name='--instance-group',
    resource_name='instance group',
    completion_resource_id='compute.instanceGroups',
    zonal_collection='compute.instanceGroups',
    zone_explanation=compute_flags.ZONE_PROPERTY_EXPLANATION)

MULTISCOPE_INSTANCE_GROUP_ARG = compute_flags.ResourceArgument(
    name='--instance-group',
    resource_name='instance group',
    completion_resource_id='compute.instanceGroups',
    zonal_collection='compute.instanceGroups',
    regional_collection='compute.regionInstanceGroups',
    zone_explanation=compute_flags.ZONE_PROPERTY_EXPLANATION,
    region_explanation=compute_flags.REGION_PROPERTY_EXPLANATION)

GLOBAL_BACKEND_SERVICE_ARG = compute_flags.ResourceArgument(
    resource_name='backend service',
    completion_resource_id='compute.backendServices',
Ejemplo n.º 16
0
def MakeInstanceTemplateArg(plural=False):
    return flags.ResourceArgument(
        resource_name='instance template',
        completer=completers.InstanceTemplatesCompleter,
        plural=plural,
        global_collection='compute.instanceTemplates')
Ejemplo n.º 17
0
        resource_name='disk',
        completer=compute_completers.DisksCompleter,
        plural=plural,
        name='DISK_NAME',
        zonal_collection='compute.disks',
        zone_explanation=compute_flags.ZONE_PROPERTY_EXPLANATION)


def MakeDiskArgZonalOrRegional(plural):
    return compute_flags.ResourceArgument(
        resource_name='disk',
        completer=compute_completers.DisksCompleter,
        plural=plural,
        name='DISK_NAME',
        zonal_collection='compute.disks',
        regional_collection='compute.regionDisks',
        zone_explanation=compute_flags.ZONE_PROPERTY_EXPLANATION,
        region_explanation=compute_flags.REGION_PROPERTY_EXPLANATION)


SOURCE_SNAPSHOT_ARG = compute_flags.ResourceArgument(
    resource_name='snapshot',
    completer=SnapshotsCompleter,
    name='--source-snapshot',
    plural=False,
    required=False,
    global_collection='compute.snapshots',
    short_help='A source snapshot used to create the disks.',
    detailed_help=_DETAILED_SOURCE_SNAPSHOT_HELP,
)
Ejemplo n.º 18
0
        list_command=('compute backend-services list --global --uri'),
        **kwargs)


class BackendServicesCompleter(completers.MultiResourceCompleter):

  def __init__(self, **kwargs):
    super(BackendServicesCompleter, self).__init__(
        completers=[RegionalBackendServicesCompleter,
                    GlobalBackendServicesCompleter],
        **kwargs)


ZONAL_INSTANCE_GROUP_ARG = compute_flags.ResourceArgument(
    name='--instance-group',
    resource_name='instance group',
    completer=compute_completers.InstanceGroupsCompleter,
    zonal_collection='compute.instanceGroups',
    zone_explanation=compute_flags.ZONE_PROPERTY_EXPLANATION)


MULTISCOPE_INSTANCE_GROUP_ARG = compute_flags.ResourceArgument(
    name='--instance-group',
    resource_name='instance group',
    completer=compute_completers.InstanceGroupsCompleter,
    zonal_collection='compute.instanceGroups',
    regional_collection='compute.regionInstanceGroups',
    zone_explanation=compute_flags.ZONE_PROPERTY_EXPLANATION,
    region_explanation=compute_flags.REGION_PROPERTY_EXPLANATION)


NETWORK_ENDPOINT_GROUP_ARG = compute_flags.ResourceArgument(
Ejemplo n.º 19
0
def MakeResourcePolicyArg():
  return compute_flags.ResourceArgument(
      resource_name='resource policy',
      regional_collection='compute.resourcePolicies',
      region_explanation=compute_flags.REGION_PROPERTY_EXPLANATION)
Ejemplo n.º 20
0
# limitations under the License.
"""Flags and helpers for the compute routers commands."""

from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals

import textwrap
import enum
from googlecloudsdk.calliope import arg_parsers
from googlecloudsdk.command_lib.compute import flags as compute_flags

IP_ADDRESSES_ARG = compute_flags.ResourceArgument(
    name='--nat-external-ip-pool',
    short_help='External IP Addresses to use for NAT',
    resource_name='address',
    regional_collection='compute.addresses',
    region_hidden=True,
    plural=True,
    required=False)

DRAIN_NAT_IP_ADDRESSES_ARG = compute_flags.ResourceArgument(
    name='--drain-nat-ips',
    detailed_help=textwrap.dedent("""\
       External IP Addresses to be drained

       These IPs must be valid external IPs that have been used as NAT IPs
       """),
    resource_name='address',
    regional_collection='compute.addresses',
    region_hidden=True,
    plural=True,
Ejemplo n.º 21
0
    return compute_flags.ResourceArgument(
        resource_name='forwarding rule',
        name='--next-hop-ilb',
        completer=ForwardingRulesCompleter,
        plural=False,
        required=required,
        regional_collection='compute.forwardingRules',
        short_help='Target forwarding rule that receives forwarded traffic.',
        region_explanation=compute_flags.REGION_PROPERTY_EXPLANATION)


BACKEND_SERVICE_ARG = compute_flags.ResourceArgument(
    name='--backend-service',
    required=False,
    resource_name='backend service',
    regional_collection='compute.regionBackendServices',
    global_collection='compute.targetBackendServices',
    short_help='Target backend service that receives the traffic.',
    region_explanation=('If not specified, the region is set to the'
                        ' region of the forwarding rule.'))


def NetworkArg(include_l7_internal_load_balancing):
    """Returns the network parameter."""

    load_balancing_scheme = ('--load-balancing-scheme=INTERNAL or ' +
                             '--load-balancing-scheme=INTERNAL_SELF_MANAGED')

    if include_l7_internal_load_balancing:
        load_balancing_scheme += ' or --load-balancing-scheme=INTERNAL_MANAGED'
Ejemplo n.º 22
0
def MakeNodeTemplateArg():
    return compute_flags.ResourceArgument(
        resource_name='node templates',
        regional_collection='compute.nodeTemplates',
        region_explanation=compute_flags.REGION_PROPERTY_EXPLANATION)
Ejemplo n.º 23
0
            collection='compute.backendServices',
            list_command=('compute backend-services list --global --uri'),
            **kwargs)


class BackendServicesCompleter(completers.MultiResourceCompleter):
    def __init__(self, **kwargs):
        super(BackendServicesCompleter, self).__init__(completers=[
            RegionalBackendServicesCompleter, GlobalBackendServicesCompleter
        ],
                                                       **kwargs)


ZONAL_INSTANCE_GROUP_ARG = compute_flags.ResourceArgument(
    name='--instance-group',
    resource_name='instance group',
    completer=compute_completers.InstanceGroupsCompleter,
    zonal_collection='compute.instanceGroups',
    zone_explanation=compute_flags.ZONE_PROPERTY_EXPLANATION)

MULTISCOPE_INSTANCE_GROUP_ARG = compute_flags.ResourceArgument(
    name='--instance-group',
    resource_name='instance group',
    completer=compute_completers.InstanceGroupsCompleter,
    zonal_collection='compute.instanceGroups',
    regional_collection='compute.regionInstanceGroups',
    zone_explanation=compute_flags.ZONE_PROPERTY_EXPLANATION,
    region_explanation=compute_flags.REGION_PROPERTY_EXPLANATION)

NETWORK_ENDPOINT_GROUP_ARG = compute_flags.ResourceArgument(
    name='--network-endpoint-group',
    resource_name='network endpoint group',
Ejemplo n.º 24
0
def ForwardingRuleArgumentPlural(required=True):
    return compute_flags.ResourceArgument(
        resource_name='forwarding rule',
        completer=ForwardingRulesCompleter,
        plural=True,
        required=required,
        regional_collection='compute.forwardingRules',
        global_collection='compute.globalForwardingRules',
        region_explanation=compute_flags.REGION_PROPERTY_EXPLANATION)


BACKEND_SERVICE_ARG = compute_flags.ResourceArgument(
    name='--backend-service',
    required=False,
    resource_name='backend service',
    regional_collection='compute.regionBackendServices',
    global_collection='compute.targetBackendServices',
    short_help='The target backend service that will receive the traffic.',
    region_explanation=('If not specified it will be set the'
                        ' region of the forwarding rule.'))

NETWORK_ARG = compute_flags.ResourceArgument(
    name='--network',
    required=False,
    resource_name='networks',
    global_collection='compute.networks',
    short_help='The network that this forwarding rule applies to.',
    detailed_help="""\
        (Only for Internal Load Balancing) The network that this forwarding
        rule applies to. If this field is not specified, the default network
        will be used. In the absence of the default network, this field must
Ejemplo n.º 25
0

class ZonalOperationsCompleter(compute_completers.ListCommandCompleter):
    def __init__(self, **kwargs):
        super(ZonalOperationsCompleter, self).__init__(
            collection='compute.zoneOperations',
            list_command='compute operations list --uri --filter=zone:*',
            **kwargs)


class OperationsCompleter(completers.MultiResourceCompleter):
    def __init__(self, **kwargs):
        super(OperationsCompleter, self).__init__(completers=[
            GlobalOperationsCompleter, RegionalOperationsCompleter,
            ZonalOperationsCompleter
        ],
                                                  **kwargs)


COMPUTE_OPERATION_ARG = compute_flags.ResourceArgument(
    resource_name='operation',
    completer=OperationsCompleter,
    global_collection='compute.globalOperations',
    regional_collection='compute.regionOperations',
    zonal_collection='compute.zoneOperations',
    required=True,
    plural=False,
    short_help='Name of the operation returned by an asynchronous command. '
    'Use `gcloud compute operations list` to display recent '
    'operations.')
Ejemplo n.º 26
0
def MakeForceCreateArg():
    return base.Argument('--force-create',
                         action='store_true',
                         default=False,
                         help="""\
          By default, image creation fails when it is created from a disk that
          is attached to a running instance. When this flag is used, image
          creation from disk will proceed even if the disk is in use.
          """)


REPLACEMENT_DISK_IMAGE_ARG = compute_flags.ResourceArgument(
    resource_name='disk image',
    name='--replacement',
    completion_resource_id='compute.images',
    global_collection='compute.images',
    required=False,
    short_help='Specifies a Compute Engine image as a replacement.',
    detailed_help=_REPLACEMENT_DISK_DETAILED_HELP)

SOURCE_DISK_ARG = compute_flags.ResourceArgument(
    resource_name='source disk',
    name='--source-disk',
    completion_resource_id='compute.disks',
    zonal_collection='compute.disks',
    short_help='The deprecation state to set on the image.',
    detailed_help=_SOURCE_DISK_DETAILED_HELP,
    zone_explanation=_SOURCE_DISK_ZONE_EXPLANATION,
    required=False)

Ejemplo n.º 27
0
            collection='compute.regionOperations',
            list_command='compute operations list --uri --filter=region:*',
            **kwargs)


class ZonalOperationsCompleter(compute_completers.ListCommandCompleter):
    def __init__(self, **kwargs):
        super(ZonalOperationsCompleter, self).__init__(
            collection='compute.zoneOperations',
            list_command='compute operations list --uri --filter=zone:*',
            **kwargs)


class OperationsCompleter(completers.MultiResourceCompleter):
    def __init__(self, **kwargs):
        super(OperationsCompleter, self).__init__(completers=[
            GlobalOperationsCompleter, RegionalOperationsCompleter,
            ZonalOperationsCompleter
        ],
                                                  **kwargs)


COMPUTE_OPERATION_ARG = compute_flags.ResourceArgument(
    resource_name='operation',
    completer=OperationsCompleter,
    global_collection='compute.globalOperations',
    regional_collection='compute.regionOperations',
    zonal_collection='compute.zoneOperations',
    required=True,
    plural=False)
Ejemplo n.º 28
0
def MakeDiskImageArg(plural=False):
    return compute_flags.ResourceArgument(
        resource_name='disk image',
        completion_resource_id='compute.images',
        plural=plural,
        global_collection='compute.images')
Ejemplo n.º 29
0
def MakeMachineTypeArg():
    return compute_flags.ResourceArgument(
        resource_name='machine type',
        completer=completers.MachineTypesCompleter,
        zonal_collection='compute.machineTypes',
        zone_explanation=compute_flags.ZONE_PROPERTY_EXPLANATION)
Ejemplo n.º 30
0
def AddMultiWriterFlag(parser):
    return parser.add_argument('--multi-writer',
                               action='store_true',
                               help="""
      Create the disk in multi-writer mode so that it can be attached
      with read-write access to multiple VMs. Can only be used with
      zonal SSD persistent disks. Disks in multi-writer mode do not support
      resize and snapshot operations.
      """)


SOURCE_SNAPSHOT_ARG = compute_flags.ResourceArgument(
    resource_name='snapshot',
    completer=SnapshotsCompleter,
    name='--source-snapshot',
    plural=False,
    required=False,
    global_collection='compute.snapshots',
    short_help='Source snapshot used to create the disks.',
    detailed_help=_DETAILED_SOURCE_SNAPSHOT_HELP,
)

SOURCE_INSTANT_SNAPSHOT_ARG = compute_flags.ResourceArgument(
    resource_name='source instant snapshot',
    completer=compute_completers.InstantSnapshotsCompleter,
    name='--source-instant-snapshot',
    zonal_collection='compute.zoneInstantSnapshots',
    regional_collection='compute.regionInstantSnapshots',
    plural=False,
    required=False,
    short_help='Source instant snapshot used to create the disks.',
    detailed_help=_DETAILED_SOURCE_INSTANT_SNAPSHOT_HELP,