예제 #1
0
    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        pap_client = public_advertised_prefixes.PublicAdvertisedPrefixesClient(
            holder.client, holder.client.messages, holder.resources)
        pap_ref = flags.MakePublicAdvertisedPrefixesArg().ResolveAsResource(
            args,
            holder.resources,
            scope_lister=compute_flags.GetDefaultScopeLister(holder.client))

        if self.support_pdp_scope_input:
            result = pap_client.Create(
                pap_ref,
                ip_cidr_range=args.range,
                dns_verification_ip=args.dns_verification_ip,
                description=args.description,
                pdp_scope=holder.client.messages.PublicAdvertisedPrefix.
                PdpScopeValueValuesEnum(args.pdp_scope)
                if args.pdp_scope else None)
        else:
            result = pap_client.Create(
                pap_ref,
                ip_cidr_range=args.range,
                dns_verification_ip=args.dns_verification_ip,
                description=args.description,
                pdp_scope=None)
        log.CreatedResource(pap_ref.Name(), 'public advertised prefix')
        return result
예제 #2
0
    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        client = holder.client
        messages = holder.client.messages
        resources = holder.resources

        pap_ref = flags.MakePublicAdvertisedPrefixesArg().ResolveAsResource(
            args,
            resources,
            scope_lister=compute_flags.GetDefaultScopeLister(holder.client))

        pap_client = public_advertised_prefixes.PublicAdvertisedPrefixesClient(
            client, messages, resources)
        return pap_client.Patch(pap_ref, status=args.status)
예제 #3
0
    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        pap_client = public_advertised_prefixes.PublicAdvertisedPrefixesClient(
            holder.client, holder.client.messages, holder.resources)

        pap_ref = flags.MakePublicAdvertisedPrefixesArg().ResolveAsResource(
            args,
            holder.resources,
            scope_lister=compute_flags.GetDefaultScopeLister(holder.client))
        console_io.PromptContinue(
            'You are about to delete public advertised prefix: [{}]'.format(
                pap_ref.Name()),
            throw_if_unattended=True,
            cancel_on_no=True)

        result = pap_client.Delete(pap_ref)
        log.DeletedResource(pap_ref.Name(), 'public advertised prefix')
        return result
    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        client = holder.client
        messages = holder.client.messages
        resources = holder.resources

        pap_ref = flags.MakePublicAdvertisedPrefixesArg().ResolveAsResource(
            args,
            resources,
            scope_lister=compute_flags.GetDefaultScopeLister(holder.client))

        pap_client = public_advertised_prefixes.PublicAdvertisedPrefixesClient(
            client, messages, resources)

        if self.support_pap_announce_withdraw:
            if args.status is not None:
                return pap_client.Patch(pap_ref, status=args.status)
            if args.announce_prefix:
                return pap_client.Announce(pap_ref)
            if args.withdraw_prefix:
                return pap_client.Withdraw(pap_ref)
        else:
            return pap_client.Patch(pap_ref, status=args.status)