Ejemplo n.º 1
0
  def Run(self, args):
    client = certificate_map_entries.CertificateMapEntryClient()
    entry_ref = args.CONCEPTS.entry.Parse()

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

    response = client.Delete(entry_ref)

    response = util.WaitForOperation(response, is_async=args.async_)
    log.DeletedResource(entry_ref.Name(), 'map entry', is_async=args.async_)
    return response
    def Run(self, args):
        client = certificate_map_entries.CertificateMapEntryClient()
        entry_ref = args.CONCEPTS.entry.Parse()
        map_ref = entry_ref.Parent()
        cert_refs = args.CONCEPTS.certificates.Parse()
        labels = labels_util.ParseCreateArgs(
            args, client.messages.CertificateMapEntry.LabelsValue)

        response = client.Create(map_ref,
                                 entry_ref.certificateMapEntriesId,
                                 hostname=args.hostname,
                                 cert_refs=cert_refs,
                                 description=args.description,
                                 labels=labels)
        operation_response = util.WaitForOperation(response,
                                                   is_async=args.async_)
        log.CreatedResource(entry_ref.Name(),
                            'certificate map entry',
                            is_async=args.async_)
        return operation_response
Ejemplo n.º 3
0
  def Run(self, args):
    client = certificate_map_entries.CertificateMapEntryClient()
    entry_ref = args.CONCEPTS.entry.Parse()

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

    new_certs = None
    if args.IsSpecified('certificates'):
      new_certs = args.CONCEPTS.certificates.Parse()
      console_io.PromptContinue(
          'You are about to overwrite certificates from map entry \'{}\''
          .format(entry_ref.certificateMapEntriesId),
          throw_if_unattended=True,
          cancel_on_no=True)

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

    if new_description is None and labels_update is None and new_certs is None:
      raise exceptions.Error('Nothing to update.')
    response = client.Patch(
        entry_ref,
        labels=labels_update,
        description=new_description,
        cert_refs=new_certs)
    response = util.WaitForOperation(response, is_async=args.async_)
    log.UpdatedResource(
        entry_ref.Name(), 'certificate map entry', is_async=args.async_)
    return response
 def Run(self, args):
     client = certificate_map_entries.CertificateMapEntryClient()
     return client.Get(args.CONCEPTS.entry.Parse())
Ejemplo n.º 5
0
 def Run(self, args):
     client = certificate_map_entries.CertificateMapEntryClient()
     map_ref = args.CONCEPTS.map.Parse()
     return client.List(map_ref, args.limit, args.page_size)