com.pulumi.azure.apimanagement.ApiPolicy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure Show documentation
Show all versions of azure Show documentation
A Pulumi package for creating and managing Microsoft Azure cloud resources, based on the Terraform azurerm provider. We recommend using the [Azure Native provider](https://github.com/pulumi/pulumi-azure-native) to provision Azure infrastructure. Azure Native provides complete coverage of Azure resources and same-day access to new resources and resource updates.
// *** 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.ApiPolicyArgs;
import com.pulumi.azure.apimanagement.inputs.ApiPolicyState;
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 API Policy
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* 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.GetApiArgs;
* import com.pulumi.azure.apimanagement.ApiPolicy;
* import com.pulumi.azure.apimanagement.ApiPolicyArgs;
* 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 example = ApimanagementFunctions.getApi(GetApiArgs.builder()
* .name("my-api")
* .apiManagementName("example-apim")
* .resourceGroupName("search-service")
* .revision("2")
* .build());
*
* var exampleApiPolicy = new ApiPolicy("exampleApiPolicy", ApiPolicyArgs.builder()
* .apiName(example.applyValue(getApiResult -> getApiResult.name()))
* .apiManagementName(example.applyValue(getApiResult -> getApiResult.apiManagementName()))
* .resourceGroupName(example.applyValue(getApiResult -> getApiResult.resourceGroupName()))
* .xmlContent("""
*
*
*
*
*
* """)
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* API Management API Policy can be imported using the `resource id`, e.g.
*
* ```sh
* $ pulumi import azure:apimanagement/apiPolicy:ApiPolicy example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/apis/exampleId
* ```
*
*/
@ResourceType(type="azure:apimanagement/apiPolicy:ApiPolicy")
public class ApiPolicy 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 apiManagementName;
/**
* @return The name of the API Management Service. Changing this forces a new resource to be created.
*
*/
public Output apiManagementName() {
return this.apiManagementName;
}
/**
* The ID of the API Management API within the API Management Service. Changing this forces a new resource to be created.
*
*/
@Export(name="apiName", refs={String.class}, tree="[0]")
private Output apiName;
/**
* @return The ID of the API Management API within the API Management Service. Changing this forces a new resource to be created.
*
*/
public Output apiName() {
return this.apiName;
}
/**
* 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 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 resourceGroupName() {
return this.resourceGroupName;
}
/**
* The XML Content for this Policy as a string.
*
*/
@Export(name="xmlContent", refs={String.class}, tree="[0]")
private Output xmlContent;
/**
* @return The XML Content for this Policy as a string.
*
*/
public Output 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> xmlLink() {
return Codegen.optional(this.xmlLink);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public ApiPolicy(java.lang.String name) {
this(name, ApiPolicyArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public ApiPolicy(java.lang.String name, ApiPolicyArgs 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 ApiPolicy(java.lang.String name, ApiPolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:apimanagement/apiPolicy:ApiPolicy", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private ApiPolicy(java.lang.String name, Output id, @Nullable ApiPolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:apimanagement/apiPolicy:ApiPolicy", name, state, makeResourceOptions(options, id), false);
}
private static ApiPolicyArgs makeArgs(ApiPolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? ApiPolicyArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output 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 ApiPolicy get(java.lang.String name, Output id, @Nullable ApiPolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new ApiPolicy(name, id, state, options);
}
}