예제 #1
0
    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        pdp_client = public_delegated_prefixes.PublicDelegatedPrefixesClient(
            holder.client, holder.client.messages, holder.resources)

        pdp_ref = flags.MakePublicDelegatedPrefixesArg().ResolveAsResource(
            args,
            holder.resources,
            scope_lister=compute_flags.GetDefaultScopeLister(holder.client))

        return pdp_client.Get(pdp_ref)
예제 #2
0
    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        client = holder.client
        messages = holder.client.messages
        resources = holder.resources

        pdp_ref = flags.PUBLIC_DELEGATED_PREFIX_FLAG_ARG.ResolveAsResource(
            args,
            resources,
            scope_lister=compute_flags.GetDefaultScopeLister(holder.client))

        pdp_client = public_delegated_prefixes.PublicDelegatedPrefixesClient(
            client, messages, resources)

        return pdp_client.RemoveSubPrefix(pdp_ref, args.name)
예제 #3
0
    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        pdp_client = public_delegated_prefixes.PublicDelegatedPrefixesClient(
            holder.client, holder.client.messages, holder.resources)
        pdp_ref = flags.MakePublicDelegatedPrefixesArg().ResolveAsResource(
            args,
            holder.resources,
            scope_lister=compute_flags.GetDefaultScopeLister(holder.client))

        result = pdp_client.Create(pdp_ref,
                                   parent_prefix=args.public_advertised_prefix,
                                   ip_cidr_range=args.range,
                                   description=args.description)
        log.CreatedResource(pdp_ref.Name(), 'public delegated prefix')
        return result
예제 #4
0
    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        pdp_client = public_delegated_prefixes.PublicDelegatedPrefixesClient(
            holder.client, holder.client.messages, holder.resources)

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

        result = pdp_client.Delete(pdp_ref)
        log.DeletedResource(pdp_ref.Name(), 'public delegated prefix')
        return result