예제 #1
0
    def Run(self, args):
        client = certificate_maps.CertificateMapClient()
        map_ref = args.CONCEPTS.map.Parse()

        new_description = None
        if args.IsSpecified('description'):
            new_description = args.description

        labels_update = None
        labels_diff = labels_util.Diff.FromUpdateArgs(args)
        if labels_diff.MayHaveUpdates():
            orig_resource = client.Get(map_ref)
            labels_update = labels_diff.Apply(
                client.messages.CertificateMap.LabelsValue,
                orig_resource.labels).GetOrNone()

        if new_description is None and labels_update is None:
            raise exceptions.Error('Nothing to update.')
        response = client.Patch(map_ref,
                                labels=labels_update,
                                description=new_description)
        response = util.WaitForOperation(response, is_async=args.async_)
        log.UpdatedResource(map_ref.Name(),
                            'certificate map',
                            is_async=args.async_)
        return response
  def Run(self, args):
    client = certificate_maps.CertificateMapClient()
    map_ref = args.CONCEPTS.map.Parse()

    console_io.PromptContinue(
        'You are about to delete certificate map \'{}\''.format(
            map_ref.certificateMapsId),
        throw_if_unattended=True,
        cancel_on_no=True)

    response = client.Delete(map_ref)

    response = util.WaitForOperation(response, is_async=args.async_)
    log.DeletedResource(map_ref.Name(), 'map', is_async=args.async_)
    return response
예제 #3
0
    def Run(self, args):
        client = certificate_maps.CertificateMapClient()
        map_ref = args.CONCEPTS.map.Parse()
        location_ref = map_ref.Parent()
        labels = labels_util.ParseCreateArgs(
            args, client.messages.CertificateMap.LabelsValue)

        response = client.Create(location_ref,
                                 map_ref.certificateMapsId,
                                 description=args.description,
                                 labels=labels)
        operation_response = util.WaitForOperation(response,
                                                   is_async=args.async_)
        log.CreatedResource(map_ref.Name(),
                            'certificate map',
                            is_async=args.async_)
        return operation_response
 def Run(self, args):
   client = certificate_maps.CertificateMapClient()
   location_ref = args.CONCEPTS.location.Parse()
   return client.List(location_ref, args.limit, args.page_size)
예제 #5
0
 def Run(self, args):
     client = certificate_maps.CertificateMapClient()
     return client.Get(args.CONCEPTS.map.Parse())