// *** 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.azure.apimanagement;

import com.pulumi.azure.Utilities;
import com.pulumi.azure.apimanagement.ProductPolicyArgs;
import com.pulumi.azure.apimanagement.inputs.ProductPolicyState;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Manages an API Management Product Policy
 * 
 * ## Example Usage
 * ```java
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.apimanagement.ApimanagementFunctions;
 * import com.pulumi.azure.apimanagement.inputs.GetProductArgs;
 * import com.pulumi.azure.apimanagement.ProductPolicy;
 * import com.pulumi.azure.apimanagement.ProductPolicyArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * 
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 * 
 *     public static void stack(Context ctx) {
 *         final var exampleProduct = ApimanagementFunctions.getProduct(GetProductArgs.builder()
 *             .productId(&#34;my-product&#34;)
 *             .apiManagementName(&#34;example-apim&#34;)
 *             .resourceGroupName(&#34;search-service&#34;)
 *             .build());
 * 
 *         var exampleProductPolicy = new ProductPolicy(&#34;exampleProductPolicy&#34;, ProductPolicyArgs.builder()        
 *             .productId(exampleProduct.applyValue(getProductResult -&gt; getProductResult.productId()))
 *             .apiManagementName(exampleProduct.applyValue(getProductResult -&gt; getProductResult.apiManagementName()))
 *             .resourceGroupName(exampleProduct.applyValue(getProductResult -&gt; getProductResult.resourceGroupName()))
 *             .xmlContent(&#34;&#34;&#34;
 * &lt;policies&gt;
 *   &lt;inbound&gt;
 *     &lt;find-and-replace from=&#34;xyz&#34; to=&#34;abc&#34; /&gt;
 *   &lt;/inbound&gt;
 * &lt;/policies&gt;
 *             &#34;&#34;&#34;)
 *             .build());
 * 
 *     }
 * }
 * ```
 * 
 * ## Import
 * 
 * API Management Product Policy can be imported using the `resource id`, e.g.
 * 
 * ```sh
 *  $ pulumi import azure:apimanagement/productPolicy:ProductPolicy example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/products/exampleId/policies/policy
 * ```
 * 
 */
@ResourceType(type="azure:apimanagement/productPolicy:ProductPolicy")
public class ProductPolicy extends com.pulumi.resources.CustomResource {
    /**
     * The name of the API Management Service. Changing this forces a new resource to be created.
     * 
     */
    @Export(name="apiManagementName", refs={String.class}, tree="[0]")
    private Output<String> apiManagementName;

    /**
     * @return The name of the API Management Service. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> apiManagementName() {
        return this.apiManagementName;
    }
    /**
     * The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
     * 
     */
    @Export(name="productId", refs={String.class}, tree="[0]")
    private Output<String> productId;

    /**
     * @return The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> productId() {
        return this.productId;
    }
    /**
     * The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
     * 
     */
    @Export(name="resourceGroupName", refs={String.class}, tree="[0]")
    private Output<String> resourceGroupName;

    /**
     * @return The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> resourceGroupName() {
        return this.resourceGroupName;
    }
    /**
     * The XML Content for this Policy.
     * 
     */
    @Export(name="xmlContent", refs={String.class}, tree="[0]")
    private Output<String> xmlContent;

    /**
     * @return The XML Content for this Policy.
     * 
     */
    public Output<String> xmlContent() {
        return this.xmlContent;
    }
    /**
     * A link to a Policy XML Document, which must be publicly available.
     * 
     */
    @Export(name="xmlLink", refs={String.class}, tree="[0]")
    private Output</* @Nullable */ String> xmlLink;

    /**
     * @return A link to a Policy XML Document, which must be publicly available.
     * 
     */
    public Output<Optional<String>> xmlLink() {
        return Codegen.optional(this.xmlLink);
    }

    /**
     *
     * @param name The _unique_ name of the resulting resource.
     */
    public ProductPolicy(String name) {
        this(name, ProductPolicyArgs.Empty);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     */
    public ProductPolicy(String name, ProductPolicyArgs 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 ProductPolicy(String name, ProductPolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("azure:apimanagement/productPolicy:ProductPolicy", name, args == null ? ProductPolicyArgs.Empty : args, makeResourceOptions(options, Codegen.empty()));
    }

    private ProductPolicy(String name, Output<String> id, @Nullable ProductPolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("azure:apimanagement/productPolicy:ProductPolicy", 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 ProductPolicy get(String name, Output<String> id, @Nullable ProductPolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        return new ProductPolicy(name, id, state, options);
    }
}
