Beispiel #1
0
    def Run(self, args):
        client = zones_api.Client(version=self._API_VERSION)
        perimeter_ref = args.CONCEPTS.perimeter.Parse()
        result = repeated.CachedResult.FromFunc(client.Get, perimeter_ref)
        policies.ValidateAccessPolicyArg(perimeter_ref, args)

        return self.Patch(
            client=client,
            args=args,
            result=result,
            perimeter_ref=perimeter_ref,
            description=args.description,
            title=args.title,
            perimeter_type=perimeters.GetTypeEnumMapper(
                version=self._API_VERSION).GetEnumForChoice(args.type),
            resources=perimeters.ParseResources(args, result),
            restricted_services=perimeters.ParseRestrictedServices(
                args, result),
            levels=perimeters.ParseLevels(args, result,
                                          perimeter_ref.accessPoliciesId),
            vpc_allowed_services=perimeters.ParseVpcRestriction(
                args, result, self._API_VERSION),
            enable_vpc_accessible_services=args.enable_vpc_accessible_services,
            ingress_policies=perimeters.ParseUpdateDirectionalPoliciesArgs(
                args, self._release_track, 'ingress-policies'),
            egress_policies=perimeters.ParseUpdateDirectionalPoliciesArgs(
                args, self._release_track, 'egress-policies'))
    def Patch(self, client, args, perimeter_ref, result):
        if args.clear:
            return client.Patch(perimeter_ref, clear_dry_run=True)

        resources = perimeters.ParseResources(args, result, dry_run=True)
        restricted_services = perimeters.ParseRestrictedServices(args,
                                                                 result,
                                                                 dry_run=True)
        levels = perimeters.ParseLevels(args,
                                        result,
                                        perimeter_ref.accessPoliciesId,
                                        dry_run=True)
        ingress_allowed_services = perimeters.ParseIngressRestriction(
            args, result, self._API_VERSION, dry_run=True)
        vpc_allowed_services = perimeters.ParseVpcRestriction(
            args, result, self._API_VERSION, dry_run=True)
        bridge_allowed_services = perimeters.ParseBridgeRestriction(
            args, result, self._API_VERSION, dry_run=True)
        enable_ingress_restriction = args.enable_ingress_service_restriction
        enable_vpc_restriction = args.enable_vpc_service_restriction
        enable_bridge_restriction = args.enable_bridge_service_restriction

        return client.Patch(
            perimeter_ref,
            resources=resources,
            restricted_services=restricted_services,
            levels=levels,
            ingress_allowed_services=ingress_allowed_services,
            vpc_allowed_services=vpc_allowed_services,
            bridge_allowed_services=bridge_allowed_services,
            enable_ingress_service_restriction=enable_ingress_restriction,
            enable_vpc_service_restriction=enable_vpc_restriction,
            enable_bridge_service_restriction=enable_bridge_restriction,
            apply_to_dry_run_config=True)
Beispiel #3
0
  def Patch(self, client, args, perimeter_ref, result, description, title,
            perimeter_type, resources, restricted_services, levels):
    vpc_allowed_services = perimeters.ParseVpcRestriction(
        args, result, self._API_VERSION)
    enable_vpc_restriction = args.enable_vpc_service_restriction

    return client.Patch(
        perimeter_ref,
        description=description,
        title=title,
        perimeter_type=perimeter_type,
        resources=resources,
        restricted_services=restricted_services,
        levels=levels,
        vpc_allowed_services=vpc_allowed_services,
        enable_vpc_service_restriction=enable_vpc_restriction,
    )
    def Patch(self, client, args, perimeter_ref, result):
        if args.clear:
            return client.UnsetSpec(perimeter_ref,
                                    use_explicit_dry_run_spec=False)

        resources = perimeters.ParseResources(args, result, dry_run=True)
        restricted_services = perimeters.ParseRestrictedServices(args,
                                                                 result,
                                                                 dry_run=True)
        levels = perimeters.ParseLevels(args,
                                        result,
                                        perimeter_ref.accessPoliciesId,
                                        dry_run=True)
        vpc_allowed_services = perimeters.ParseVpcRestriction(
            args, result, self._API_VERSION, dry_run=True)
        enable_vpc_accessible_services = args.enable_vpc_accessible_services

        return client.PatchDryRunConfig(
            perimeter_ref,
            resources=resources,
            restricted_services=restricted_services,
            levels=levels,
            vpc_allowed_services=vpc_allowed_services,
            enable_vpc_accessible_services=enable_vpc_accessible_services)
    def Patch(self, client, args, perimeter_ref, result):
        if args.clear:
            return client.Patch(perimeter_ref, clear_dry_run=True)

        resources = perimeters.ParseResources(args, result, dry_run=True)
        restricted_services = perimeters.ParseRestrictedServices(args,
                                                                 result,
                                                                 dry_run=True)
        levels = perimeters.ParseLevels(args,
                                        result,
                                        perimeter_ref.accessPoliciesId,
                                        dry_run=True)
        vpc_allowed_services = perimeters.ParseVpcRestriction(
            args, result, self._API_VERSION, dry_run=True)
        enable_vpc_accessible_services = args.enable_vpc_accessible_services

        return client.Patch(
            perimeter_ref,
            resources=resources,
            restricted_services=restricted_services,
            levels=levels,
            vpc_allowed_services=vpc_allowed_services,
            enable_vpc_accessible_services=enable_vpc_accessible_services,
            apply_to_dry_run_config=True)