// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.gcp.accesscontextmanager;

import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import com.pulumi.gcp.Utilities;
import com.pulumi.gcp.accesscontextmanager.ServicePerimeterEgressPolicyArgs;
import com.pulumi.gcp.accesscontextmanager.inputs.ServicePerimeterEgressPolicyState;
import com.pulumi.gcp.accesscontextmanager.outputs.ServicePerimeterEgressPolicyEgressFrom;
import com.pulumi.gcp.accesscontextmanager.outputs.ServicePerimeterEgressPolicyEgressTo;
import java.lang.String;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * EgressPolicies match requests based on egressFrom and egressTo stanzas.
 * For an EgressPolicy to match, both egressFrom and egressTo stanzas must be matched.
 * If an EgressPolicy matches a request, the request is allowed to span the ServicePerimeter
 * boundary. For example, an EgressPolicy can be used to allow VMs on networks
 * within the ServicePerimeter to access a defined set of projects outside the
 * perimeter in certain contexts (e.g. to read data from a Cloud Storage bucket
 * or query against a BigQuery dataset).
 * 
 * To get more information about ServicePerimeterEgressPolicy, see:
 * 
 * * [API documentation](https://cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies.servicePerimeters#egresspolicy)
 * 
 * ## Import
 * 
 * ServicePerimeterEgressPolicy can be imported using any of these accepted formats
 * 
 * ```sh
 *  $ pulumi import gcp:accesscontextmanager/servicePerimeterEgressPolicy:ServicePerimeterEgressPolicy default {{perimeter}}
 * ```
 * 
 */
@ResourceType(type="gcp:accesscontextmanager/servicePerimeterEgressPolicy:ServicePerimeterEgressPolicy")
public class ServicePerimeterEgressPolicy extends com.pulumi.resources.CustomResource {
    /**
     * Defines conditions on the source of a request causing this `EgressPolicy` to apply.
     * Structure is documented below.
     * 
     */
    @Export(name="egressFrom", type=ServicePerimeterEgressPolicyEgressFrom.class, parameters={})
    private Output</* @Nullable */ ServicePerimeterEgressPolicyEgressFrom> egressFrom;

    /**
     * @return Defines conditions on the source of a request causing this `EgressPolicy` to apply.
     * Structure is documented below.
     * 
     */
    public Output<Optional<ServicePerimeterEgressPolicyEgressFrom>> egressFrom() {
        return Codegen.optional(this.egressFrom);
    }
    /**
     * Defines the conditions on the `ApiOperation` and destination resources that
     * cause this `EgressPolicy` to apply.
     * Structure is documented below.
     * 
     */
    @Export(name="egressTo", type=ServicePerimeterEgressPolicyEgressTo.class, parameters={})
    private Output</* @Nullable */ ServicePerimeterEgressPolicyEgressTo> egressTo;

    /**
     * @return Defines the conditions on the `ApiOperation` and destination resources that
     * cause this `EgressPolicy` to apply.
     * Structure is documented below.
     * 
     */
    public Output<Optional<ServicePerimeterEgressPolicyEgressTo>> egressTo() {
        return Codegen.optional(this.egressTo);
    }
    /**
     * The name of the Service Perimeter to add this resource to.
     * 
     * ***
     * 
     */
    @Export(name="perimeter", type=String.class, parameters={})
    private Output<String> perimeter;

    /**
     * @return The name of the Service Perimeter to add this resource to.
     * 
     * ***
     * 
     */
    public Output<String> perimeter() {
        return this.perimeter;
    }

    /**
     *
     * @param name The _unique_ name of the resulting resource.
     */
    public ServicePerimeterEgressPolicy(String name) {
        this(name, ServicePerimeterEgressPolicyArgs.Empty);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     */
    public ServicePerimeterEgressPolicy(String name, ServicePerimeterEgressPolicyArgs args) {
        this(name, args, null);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     * @param options A bag of options that control this resource's behavior.
     */
    public ServicePerimeterEgressPolicy(String name, ServicePerimeterEgressPolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("gcp:accesscontextmanager/servicePerimeterEgressPolicy:ServicePerimeterEgressPolicy", name, args == null ? ServicePerimeterEgressPolicyArgs.Empty : args, makeResourceOptions(options, Codegen.empty()));
    }

    private ServicePerimeterEgressPolicy(String name, Output<String> id, @Nullable ServicePerimeterEgressPolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("gcp:accesscontextmanager/servicePerimeterEgressPolicy:ServicePerimeterEgressPolicy", name, state, makeResourceOptions(options, id));
    }

    private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output<String> id) {
        var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
            .version(Utilities.getVersion())
            .build();
        return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
    }

    /**
     * Get an existing Host resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state
     * @param options Optional settings to control the behavior of the CustomResource.
     */
    public static ServicePerimeterEgressPolicy get(String name, Output<String> id, @Nullable ServicePerimeterEgressPolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        return new ServicePerimeterEgressPolicy(name, id, state, options);
    }
}
