All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.apimanagement.kotlin.Service.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.14.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.apimanagement.kotlin

import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceAdditionalLocation
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceCertificate
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceDelegation
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceHostnameConfiguration
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceIdentity
import com.pulumi.azure.apimanagement.kotlin.outputs.ServicePolicy
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceProtocols
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceSecurity
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceSignIn
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceSignUp
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceTenantAccess
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceVirtualNetworkConfiguration
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceAdditionalLocation.Companion.toKotlin as serviceAdditionalLocationToKotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceCertificate.Companion.toKotlin as serviceCertificateToKotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceDelegation.Companion.toKotlin as serviceDelegationToKotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceHostnameConfiguration.Companion.toKotlin as serviceHostnameConfigurationToKotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceIdentity.Companion.toKotlin as serviceIdentityToKotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ServicePolicy.Companion.toKotlin as servicePolicyToKotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceProtocols.Companion.toKotlin as serviceProtocolsToKotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceSecurity.Companion.toKotlin as serviceSecurityToKotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceSignIn.Companion.toKotlin as serviceSignInToKotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceSignUp.Companion.toKotlin as serviceSignUpToKotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceTenantAccess.Companion.toKotlin as serviceTenantAccessToKotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ServiceVirtualNetworkConfiguration.Companion.toKotlin as serviceVirtualNetworkConfigurationToKotlin

/**
 * Builder for [Service].
 */
@PulumiTagMarker
public class ServiceResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ServiceArgs = ServiceArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend ServiceArgsBuilder.() -> Unit) {
        val builder = ServiceArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): Service {
        val builtJavaResource = com.pulumi.azure.apimanagement.Service(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Service(builtJavaResource)
    }
}

/**
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleService = new azure.apimanagement.Service("example", {
 *     name: "example-apim",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     publisherName: "My Company",
 *     publisherEmail: "[email protected]",
 *     skuName: "Developer_1",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_service = azure.apimanagement.Service("example",
 *     name="example-apim",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     publisher_name="My Company",
 *     publisher_email="[email protected]",
 *     sku_name="Developer_1")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleService = new Azure.ApiManagement.Service("example", new()
 *     {
 *         Name = "example-apim",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         PublisherName = "My Company",
 *         PublisherEmail = "[email protected]",
 *         SkuName = "Developer_1",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/apimanagement"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = apimanagement.NewService(ctx, "example", &apimanagement.ServiceArgs{
 * 			Name:              pulumi.String("example-apim"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			PublisherName:     pulumi.String("My Company"),
 * 			PublisherEmail:    pulumi.String("[email protected]"),
 * 			SkuName:           pulumi.String("Developer_1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.apimanagement.Service;
 * import com.pulumi.azure.apimanagement.ServiceArgs;
 * 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) {
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleService = new Service("exampleService", ServiceArgs.builder()
 *             .name("example-apim")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .publisherName("My Company")
 *             .publisherEmail("[email protected]")
 *             .skuName("Developer_1")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleService:
 *     type: azure:apimanagement:Service
 *     name: example
 *     properties:
 *       name: example-apim
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       publisherName: My Company
 *       publisherEmail: [email protected]
 *       skuName: Developer_1
 * ```
 * 
 * ## Import
 * API Management Services can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:apimanagement/service:Service example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ApiManagement/service/instance1
 * ```
 */
public class Service internal constructor(
    override val javaResource: com.pulumi.azure.apimanagement.Service,
) : KotlinCustomResource(javaResource, ServiceMapper) {
    /**
     * One or more `additional_location` blocks as defined below.
     */
    public val additionalLocations: Output>?
        get() = javaResource.additionalLocations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        serviceAdditionalLocationToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * One or more `certificate` blocks (up to 10) as defined below.
     */
    public val certificates: Output>?
        get() = javaResource.certificates().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> serviceCertificateToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * Enforce a client certificate to be presented on each request to the gateway? This is only supported when SKU type is `Consumption`.
     */
    public val clientCertificateEnabled: Output?
        get() = javaResource.clientCertificateEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A `delegation` block as defined below.
     */
    public val delegation: Output
        get() = javaResource.delegation().applyValue({ args0 ->
            args0.let({ args0 ->
                serviceDelegationToKotlin(args0)
            })
        })

    /**
     * The URL for the Developer Portal associated with this API Management service.
     */
    public val developerPortalUrl: Output
        get() = javaResource.developerPortalUrl().applyValue({ args0 -> args0 })

    /**
     * Disable the gateway in main region? This is only supported when `additional_location` is set.
     */
    public val gatewayDisabled: Output?
        get() = javaResource.gatewayDisabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The URL of the Regional Gateway for the API Management Service in the specified region.
     */
    public val gatewayRegionalUrl: Output
        get() = javaResource.gatewayRegionalUrl().applyValue({ args0 -> args0 })

    /**
     * The URL of the Gateway for the API Management Service.
     */
    public val gatewayUrl: Output
        get() = javaResource.gatewayUrl().applyValue({ args0 -> args0 })

    /**
     * A `hostname_configuration` block as defined below.
     */
    public val hostnameConfiguration: Output
        get() = javaResource.hostnameConfiguration().applyValue({ args0 ->
            args0.let({ args0 ->
                serviceHostnameConfigurationToKotlin(args0)
            })
        })

    /**
     * An `identity` block as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    serviceIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The Azure location where the API Management Service exists. Changing this forces a new resource to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The URL for the Management API associated with this API Management service.
     */
    public val managementApiUrl: Output
        get() = javaResource.managementApiUrl().applyValue({ args0 -> args0 })

    /**
     * The version which the control plane API calls to API Management service are limited with version equal to or newer than.
     */
    public val minApiVersion: Output?
        get() = javaResource.minApiVersion().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the API Management Service. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Email address from which the notification will be sent.
     */
    public val notificationSenderEmail: Output
        get() = javaResource.notificationSenderEmail().applyValue({ args0 -> args0 })

    /**
     * A `policy` block as defined below.
     */
    public val policy: Output
        get() = javaResource.policy().applyValue({ args0 ->
            args0.let({ args0 ->
                servicePolicyToKotlin(args0)
            })
        })

    /**
     * The URL for the Publisher Portal associated with this API Management service.
     */
    public val portalUrl: Output
        get() = javaResource.portalUrl().applyValue({ args0 -> args0 })

    /**
     * The Private IP addresses of the API Management Service. Available only when the API Manager instance is using Virtual Network mode.
     */
    public val privateIpAddresses: Output>
        get() = javaResource.privateIpAddresses().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * A `protocols` block as defined below.
     */
    public val protocols: Output
        get() = javaResource.protocols().applyValue({ args0 ->
            args0.let({ args0 ->
                serviceProtocolsToKotlin(args0)
            })
        })

    /**
     * ID of a standard SKU IPv4 Public IP.
     * > **NOTE:** Custom public IPs are only supported on the `Premium` and `Developer` tiers when deployed in a virtual network.
     */
    public val publicIpAddressId: Output?
        get() = javaResource.publicIpAddressId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Public Static Load Balanced IP addresses of the API Management service in the additional location. Available only for Basic, Standard and Premium SKU.
     */
    public val publicIpAddresses: Output>
        get() = javaResource.publicIpAddresses().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * Is public access to the service allowed? Defaults to `true`.
     * > **NOTE:** This option is applicable only to the Management plane, not the API gateway or Developer portal. It is required to be `true` on the creation.
     */
    public val publicNetworkAccessEnabled: Output?
        get() = javaResource.publicNetworkAccessEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The email of publisher/company.
     */
    public val publisherEmail: Output
        get() = javaResource.publisherEmail().applyValue({ args0 -> args0 })

    /**
     * The name of publisher/company.
     */
    public val publisherName: Output
        get() = javaResource.publisherName().applyValue({ args0 -> args0 })

    /**
     * The name of the Resource Group in which the API Management Service should be exist. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * The URL for the SCM (Source Code Management) Endpoint associated with this API Management service.
     */
    public val scmUrl: Output
        get() = javaResource.scmUrl().applyValue({ args0 -> args0 })

    /**
     * A `security` block as defined below.
     */
    public val security: Output
        get() = javaResource.security().applyValue({ args0 ->
            args0.let({ args0 ->
                serviceSecurityToKotlin(args0)
            })
        })

    /**
     * A `sign_in` block as defined below.
     */
    public val signIn: Output
        get() = javaResource.signIn().applyValue({ args0 ->
            args0.let({ args0 ->
                serviceSignInToKotlin(args0)
            })
        })

    /**
     * A `sign_up` block as defined below.
     */
    public val signUp: Output
        get() = javaResource.signUp().applyValue({ args0 ->
            args0.let({ args0 ->
                serviceSignUpToKotlin(args0)
            })
        })

    /**
     * `sku_name` is a string consisting of two parts separated by an underscore(\_). The first part is the `name`, valid values include: `Consumption`, `Developer`, `Basic`, `Standard` and `Premium`. The second part is the `capacity` (e.g. the number of deployed units of the `sku`), which must be a positive `integer` (e.g. `Developer_1`).
     * > **NOTE:** Premium SKU's are limited to a default maximum of 12 (i.e. `Premium_12`), this can, however, be increased via support request.
     * > **NOTE:** Consumption SKU capacity should be 0 (e.g. `Consumption_0`) as this tier includes automatic scaling.
     */
    public val skuName: Output
        get() = javaResource.skuName().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags assigned to the resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * A `tenant_access` block as defined below.
     */
    public val tenantAccess: Output
        get() = javaResource.tenantAccess().applyValue({ args0 ->
            args0.let({ args0 ->
                serviceTenantAccessToKotlin(args0)
            })
        })

    /**
     * A `virtual_network_configuration` block as defined below. Required when `virtual_network_type` is `External` or `Internal`.
     */
    public val virtualNetworkConfiguration: Output?
        get() = javaResource.virtualNetworkConfiguration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> serviceVirtualNetworkConfigurationToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The type of virtual network you want to use, valid values include: `None`, `External`, `Internal`. Defaults to `None`.
     * > **NOTE:** Please ensure that in the subnet, inbound port 3443 is open when `virtual_network_type` is `Internal` or `External`. And please ensure other necessary ports are open according to [api management network configuration](https://learn.microsoft.com/azure/api-management/virtual-network-reference).
     */
    public val virtualNetworkType: Output?
        get() = javaResource.virtualNetworkType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies a list of Availability Zones in which this API Management service should be located.
     * > **NOTE:** Availability zones are only supported in the Premium tier.
     */
    public val zones: Output>?
        get() = javaResource.zones().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })
}

public object ServiceMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.apimanagement.Service::class == javaResource::class

    override fun map(javaResource: Resource): Service = Service(
        javaResource as
            com.pulumi.azure.apimanagement.Service,
    )
}

/**
 * @see [Service].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Service].
 */
public suspend fun service(name: String, block: suspend ServiceResourceBuilder.() -> Unit):
    Service {
    val builder = ServiceResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Service].
 * @param name The _unique_ name of the resulting resource.
 */
public fun service(name: String): Service {
    val builder = ServiceResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy