![JAR search and dependency download from the Maven repository](/logo.png)
com.pulumi.azure.apimanagement.kotlin.ApiOperation.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-kotlin Show documentation
Show all versions of pulumi-azure-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.apimanagement.kotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ApiOperationRequest
import com.pulumi.azure.apimanagement.kotlin.outputs.ApiOperationResponse
import com.pulumi.azure.apimanagement.kotlin.outputs.ApiOperationTemplateParameter
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 com.pulumi.azure.apimanagement.kotlin.outputs.ApiOperationRequest.Companion.toKotlin as apiOperationRequestToKotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ApiOperationResponse.Companion.toKotlin as apiOperationResponseToKotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ApiOperationTemplateParameter.Companion.toKotlin as apiOperationTemplateParameterToKotlin
/**
* Builder for [ApiOperation].
*/
@PulumiTagMarker
public class ApiOperationResourceBuilder internal constructor() {
public var name: String? = null
public var args: ApiOperationArgs = ApiOperationArgs()
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 ApiOperationArgsBuilder.() -> Unit) {
val builder = ApiOperationArgsBuilder()
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(): ApiOperation {
val builtJavaResource = com.pulumi.azure.apimanagement.ApiOperation(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return ApiOperation(builtJavaResource)
}
}
/**
* Manages an API Operation within an API Management Service.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = azure.apimanagement.getApi({
* name: "search-api",
* apiManagementName: "search-api-management",
* resourceGroupName: "search-service",
* revision: "2",
* });
* const exampleApiOperation = new azure.apimanagement.ApiOperation("example", {
* operationId: "user-delete",
* apiName: example.then(example => example.name),
* apiManagementName: example.then(example => example.apiManagementName),
* resourceGroupName: example.then(example => example.resourceGroupName),
* displayName: "Delete User Operation",
* method: "DELETE",
* urlTemplate: "/users/{id}/delete",
* description: "This can only be done by the logged in user.",
* templateParameters: [{
* name: "id",
* type: "number",
* required: true,
* }],
* responses: [{
* statusCode: 200,
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.apimanagement.get_api(name="search-api",
* api_management_name="search-api-management",
* resource_group_name="search-service",
* revision="2")
* example_api_operation = azure.apimanagement.ApiOperation("example",
* operation_id="user-delete",
* api_name=example.name,
* api_management_name=example.api_management_name,
* resource_group_name=example.resource_group_name,
* display_name="Delete User Operation",
* method="DELETE",
* url_template="/users/{id}/delete",
* description="This can only be done by the logged in user.",
* template_parameters=[{
* "name": "id",
* "type": "number",
* "required": True,
* }],
* responses=[{
* "status_code": 200,
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var example = Azure.ApiManagement.GetApi.Invoke(new()
* {
* Name = "search-api",
* ApiManagementName = "search-api-management",
* ResourceGroupName = "search-service",
* Revision = "2",
* });
* var exampleApiOperation = new Azure.ApiManagement.ApiOperation("example", new()
* {
* OperationId = "user-delete",
* ApiName = example.Apply(getApiResult => getApiResult.Name),
* ApiManagementName = example.Apply(getApiResult => getApiResult.ApiManagementName),
* ResourceGroupName = example.Apply(getApiResult => getApiResult.ResourceGroupName),
* DisplayName = "Delete User Operation",
* Method = "DELETE",
* UrlTemplate = "/users/{id}/delete",
* Description = "This can only be done by the logged in user.",
* TemplateParameters = new[]
* {
* new Azure.ApiManagement.Inputs.ApiOperationTemplateParameterArgs
* {
* Name = "id",
* Type = "number",
* Required = true,
* },
* },
* Responses = new[]
* {
* new Azure.ApiManagement.Inputs.ApiOperationResponseArgs
* {
* StatusCode = 200,
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/apimanagement"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := apimanagement.LookupApi(ctx, &apimanagement.LookupApiArgs{
* Name: "search-api",
* ApiManagementName: "search-api-management",
* ResourceGroupName: "search-service",
* Revision: "2",
* }, nil)
* if err != nil {
* return err
* }
* _, err = apimanagement.NewApiOperation(ctx, "example", &apimanagement.ApiOperationArgs{
* OperationId: pulumi.String("user-delete"),
* ApiName: pulumi.String(example.Name),
* ApiManagementName: pulumi.String(example.ApiManagementName),
* ResourceGroupName: pulumi.String(example.ResourceGroupName),
* DisplayName: pulumi.String("Delete User Operation"),
* Method: pulumi.String("DELETE"),
* UrlTemplate: pulumi.String("/users/{id}/delete"),
* Description: pulumi.String("This can only be done by the logged in user."),
* TemplateParameters: apimanagement.ApiOperationTemplateParameterArray{
* &apimanagement.ApiOperationTemplateParameterArgs{
* Name: pulumi.String("id"),
* Type: pulumi.String("number"),
* Required: pulumi.Bool(true),
* },
* },
* Responses: apimanagement.ApiOperationResponseArray{
* &apimanagement.ApiOperationResponseArgs{
* StatusCode: pulumi.Int(200),
* },
* },
* })
* 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.apimanagement.ApimanagementFunctions;
* import com.pulumi.azure.apimanagement.inputs.GetApiArgs;
* import com.pulumi.azure.apimanagement.ApiOperation;
* import com.pulumi.azure.apimanagement.ApiOperationArgs;
* import com.pulumi.azure.apimanagement.inputs.ApiOperationTemplateParameterArgs;
* import com.pulumi.azure.apimanagement.inputs.ApiOperationResponseArgs;
* 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("search-api")
* .apiManagementName("search-api-management")
* .resourceGroupName("search-service")
* .revision("2")
* .build());
* var exampleApiOperation = new ApiOperation("exampleApiOperation", ApiOperationArgs.builder()
* .operationId("user-delete")
* .apiName(example.applyValue(getApiResult -> getApiResult.name()))
* .apiManagementName(example.applyValue(getApiResult -> getApiResult.apiManagementName()))
* .resourceGroupName(example.applyValue(getApiResult -> getApiResult.resourceGroupName()))
* .displayName("Delete User Operation")
* .method("DELETE")
* .urlTemplate("/users/{id}/delete")
* .description("This can only be done by the logged in user.")
* .templateParameters(ApiOperationTemplateParameterArgs.builder()
* .name("id")
* .type("number")
* .required(true)
* .build())
* .responses(ApiOperationResponseArgs.builder()
* .statusCode(200)
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* exampleApiOperation:
* type: azure:apimanagement:ApiOperation
* name: example
* properties:
* operationId: user-delete
* apiName: ${example.name}
* apiManagementName: ${example.apiManagementName}
* resourceGroupName: ${example.resourceGroupName}
* displayName: Delete User Operation
* method: DELETE
* urlTemplate: /users/{id}/delete
* description: This can only be done by the logged in user.
* templateParameters:
* - name: id
* type: number
* required: true
* responses:
* - statusCode: 200
* variables:
* example:
* fn::invoke:
* Function: azure:apimanagement:getApi
* Arguments:
* name: search-api
* apiManagementName: search-api-management
* resourceGroupName: search-service
* revision: '2'
* ```
*
* ## Import
* API Management API Operation's can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:apimanagement/apiOperation:ApiOperation example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ApiManagement/service/instance1/apis/api1/operations/operation1
* ```
*/
public class ApiOperation internal constructor(
override val javaResource: com.pulumi.azure.apimanagement.ApiOperation,
) : KotlinCustomResource(javaResource, ApiOperationMapper) {
/**
* The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.
*/
public val apiManagementName: Output
get() = javaResource.apiManagementName().applyValue({ args0 -> args0 })
/**
* The name of the API within the API Management Service where this API Operation should be created. Changing this forces a new resource to be created.
*/
public val apiName: Output
get() = javaResource.apiName().applyValue({ args0 -> args0 })
/**
* A description for this API Operation, which may include HTML formatting tags.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The Display Name for this API Management Operation.
*/
public val displayName: Output
get() = javaResource.displayName().applyValue({ args0 -> args0 })
/**
* The HTTP Method used for this API Management Operation, like `GET`, `DELETE`, `PUT` or `POST` - but not limited to these values.
*/
public val method: Output
get() = javaResource.method().applyValue({ args0 -> args0 })
/**
* A unique identifier for this API Operation. Changing this forces a new resource to be created.
*/
public val operationId: Output
get() = javaResource.operationId().applyValue({ args0 -> args0 })
/**
* A `request` block as defined below.
*/
public val request: Output
get() = javaResource.request().applyValue({ args0 ->
args0.let({ args0 ->
apiOperationRequestToKotlin(args0)
})
})
/**
* The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* One or more `response` blocks as defined below.
*/
public val responses: Output>?
get() = javaResource.responses().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> apiOperationResponseToKotlin(args0) })
})
}).orElse(null)
})
/**
* One or more `template_parameter` blocks as defined below. Required if `url_template` contains one or more parameters.
*/
public val templateParameters: Output>?
get() = javaResource.templateParameters().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
apiOperationTemplateParameterToKotlin(args0)
})
})
}).orElse(null)
})
/**
* The relative URL Template identifying the target resource for this operation, which may include parameters.
*/
public val urlTemplate: Output
get() = javaResource.urlTemplate().applyValue({ args0 -> args0 })
}
public object ApiOperationMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.apimanagement.ApiOperation::class == javaResource::class
override fun map(javaResource: Resource): ApiOperation = ApiOperation(
javaResource as
com.pulumi.azure.apimanagement.ApiOperation,
)
}
/**
* @see [ApiOperation].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [ApiOperation].
*/
public suspend fun apiOperation(
name: String,
block: suspend ApiOperationResourceBuilder.() -> Unit,
): ApiOperation {
val builder = ApiOperationResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [ApiOperation].
* @param name The _unique_ name of the resulting resource.
*/
public fun apiOperation(name: String): ApiOperation {
val builder = ApiOperationResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy