Beispiel #1
0
    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        attachment_ref = self.INTERCONNECT_ATTACHMENT_ARG.ResolveAsResource(
            args,
            holder.resources,
            scope_lister=compute_flags.GetDefaultScopeLister(holder.client))

        interconnect_attachment = client.InterconnectAttachment(
            attachment_ref, compute_client=holder.client)

        if args.router_region is None:
            args.router_region = attachment_ref.region

        if args.router_region != attachment_ref.region:
            raise parser_errors.ArgumentException(
                'router-region must be same as the attachment region.')

        router_ref = None
        if args.router is not None:
            router_ref = self.ROUTER_ARG.ResolveAsResource(
                args, holder.resources)

        admin_enabled = attachment_flags.GetAdminEnabledFlag(args)

        attachment = interconnect_attachment.CreateAlpha(
            description=args.description,
            router=router_ref,
            attachment_type='PARTNER',
            edge_availability_domain=args.edge_availability_domain,
            admin_enabled=admin_enabled,
            validate_only=getattr(args, 'dry_run', None),
            mtu=getattr(args, 'mtu', None))
        self._pairing_key = attachment.pairingKey
        return attachment
Beispiel #2
0
 def Run(self, args):
     interconnect_attachment = self._get_attachment(args)
     admin_enabled = attachment_flags.GetAdminEnabledFlag(args)
     return interconnect_attachment.PatchGa(description=args.description,
                                            admin_enabled=admin_enabled,
                                            bandwidth=getattr(
                                                args, 'bandwidth', None))
Beispiel #3
0
    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        attachment_ref = self.INTERCONNECT_ATTACHMENT_ARG.ResolveAsResource(
            args,
            holder.resources,
            scope_lister=compute_flags.GetDefaultScopeLister(holder.client))

        interconnect_attachment = client.InterconnectAttachment(
            attachment_ref, compute_client=holder.client)

        labels = None
        label_fingerprint = None
        labels_diff = labels_util.Diff.FromUpdateArgs(args)
        if labels_diff.MayHaveUpdates():
            old_attachment = interconnect_attachment.Describe()
            labels_cls = holder.client.messages.InterconnectAttachment.LabelsValue
            labels = labels_diff.Apply(
                labels_cls, labels=old_attachment.labels).GetOrNone()
            if labels is not None:
                label_fingerprint = old_attachment.labelFingerprint
        admin_enabled = attachment_flags.GetAdminEnabledFlag(args)

        return interconnect_attachment.PatchAlphaAndBeta(
            description=args.description,
            admin_enabled=admin_enabled,
            labels=labels,
            label_fingerprint=label_fingerprint,
            mtu=getattr(args, 'mtu', None))
    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        interconnect_attachment = self._get_attachment(args)

        labels = None
        label_fingerprint = None
        labels_diff = labels_util.Diff.FromUpdateArgs(args)
        if labels_diff.MayHaveUpdates():
            old_attachment = interconnect_attachment.Describe()
            labels_cls = holder.client.messages.InterconnectAttachment.LabelsValue
            labels = labels_diff.Apply(
                labels_cls, labels=old_attachment.labels).GetOrNone()
            if labels is not None:
                label_fingerprint = old_attachment.labelFingerprint
        admin_enabled = attachment_flags.GetAdminEnabledFlag(args)

        return interconnect_attachment.PatchAlphaAndBeta(
            description=args.description,
            admin_enabled=admin_enabled,
            labels=labels,
            label_fingerprint=label_fingerprint,
            bandwidth=getattr(args, 'bandwidth', None),
            mtu=getattr(args, 'mtu', None),
            stack_type=getattr(args, 'stack_type', None),
            candidate_ipv6_subnets=getattr(args, 'candidate_ipv6_subnets',
                                           None),
            cloud_router_ipv6_interface_id=getattr(
                args, 'cloud_router_ipv6_interface_id', None),
            customer_router_ipv6_interface_id=getattr(
                args, 'customer_router_ipv6_interface_id', None))
Beispiel #5
0
    def _Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        attachment_ref = self.INTERCONNECT_ATTACHMENT_ARG.ResolveAsResource(
            args,
            holder.resources,
            scope_lister=compute_flags.GetDefaultScopeLister(holder.client))

        interconnect_attachment = client.InterconnectAttachment(
            attachment_ref, compute_client=holder.client)

        interconnect_ref = None
        if args.interconnect is not None:
            interconnect_ref = self.INTERCONNECT_ARG.ResolveAsResource(
                args, holder.resources)

        if args.router_region is None:
            args.router_region = attachment_ref.region

        if args.router_region != attachment_ref.region:
            raise parser_errors.ArgumentException(
                'router-region must be same as the attachment region.')

        router_ref = None
        if args.router is not None:
            router_ref = self.ROUTER_ARG.ResolveAsResource(
                args, holder.resources)

        admin_enabled = attachment_flags.GetAdminEnabledFlag(args)

        ipsec_internal_addresses_urls = None
        region = attachment_ref.region
        if args.ipsec_internal_addresses is not None:
            ipsec_internal_addresses_urls = [
                attachment_flags.GetAddressRef(
                    holder.resources, name, region,
                    attachment_ref.project).SelfLink()
                for name in args.ipsec_internal_addresses
            ]

        return interconnect_attachment.CreateAlpha(
            description=args.description,
            interconnect=interconnect_ref,
            attachment_type='DEDICATED',
            router=router_ref,
            vlan_tag_802_1q=args.vlan,
            admin_enabled=admin_enabled,
            candidate_subnets=args.candidate_subnets,
            bandwidth=getattr(args, 'bandwidth', None),
            validate_only=getattr(args, 'dry_run', None),
            mtu=getattr(args, 'mtu', None),
            encryption=getattr(args, 'encryption', None),
            ipsec_internal_addresses=ipsec_internal_addresses_urls,
            stack_type=getattr(args, 'stack_type', None),
            candidate_ipv6_subnets=args.candidate_ipv6_subnets,
            cloud_router_ipv6_interface_id=getattr(
                args, 'cloud_router_ipv6_interface_id', None),
            customer_router_ipv6_interface_id=getattr(
                args, 'customer_router_ipv6_interface_id', None))
Beispiel #6
0
    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        attachment_ref = self.INTERCONNECT_ATTACHMENT_ARG.ResolveAsResource(
            args,
            holder.resources,
            scope_lister=compute_flags.GetDefaultScopeLister(holder.client))

        interconnect_attachment = client.InterconnectAttachment(
            attachment_ref, compute_client=holder.client)
        admin_enabled = attachment_flags.GetAdminEnabledFlag(args)

        return interconnect_attachment.PatchGa(description=args.description,
                                               admin_enabled=admin_enabled)
 def Run(self, args):
     interconnect_attachment = self._get_attachment(args)
     admin_enabled = attachment_flags.GetAdminEnabledFlag(args)
     return interconnect_attachment.PatchGa(
         description=args.description,
         admin_enabled=admin_enabled,
         bandwidth=getattr(args, 'bandwidth', None),
         mtu=getattr(args, 'mtu', None),
         stack_type=getattr(args, 'stack_type', None),
         candidate_ipv6_subnets=getattr(args, 'candidate_ipv6_subnets',
                                        None),
         cloud_router_ipv6_interface_id=getattr(
             args, 'cloud_router_ipv6_interface_id', None),
         customer_router_ipv6_interface_id=getattr(
             args, 'customer_router_ipv6_interface_id', None))
Beispiel #8
0
    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        attachment_ref = self.INTERCONNECT_ATTACHMENT_ARG.ResolveAsResource(
            args,
            holder.resources,
            scope_lister=compute_flags.GetDefaultScopeLister(holder.client))

        interconnect_attachment = client.InterconnectAttachment(
            attachment_ref, compute_client=holder.client)

        interconnect_ref = None
        if args.interconnect is not None:
            interconnect_ref = self.INTERCONNECT_ARG.ResolveAsResource(
                args, holder.resources)

        if args.router_region is None:
            args.router_region = attachment_ref.region

        if args.router_region != attachment_ref.region:
            raise parser_errors.ArgumentException(
                'router-region must be same as the attachment region.')

        router_ref = None
        if args.router is not None:
            router_ref = self.ROUTER_ARG.ResolveAsResource(
                args, holder.resources)

        admin_enabled = attachment_flags.GetAdminEnabledFlag(args)

        return interconnect_attachment.CreateAlpha(
            description=args.description,
            interconnect=interconnect_ref,
            attachment_type='DEDICATED',
            router=router_ref,
            vlan_tag_802_1q=args.vlan,
            admin_enabled=admin_enabled,
            candidate_subnets=args.candidate_subnets,
            bandwidth=getattr(args, 'bandwidth', None),
            validate_only=getattr(args, 'dry_run', None),
            mtu=getattr(args, 'mtu', None))