Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.azure.appservice.kotlin.FunctionAppFunction.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.appservice.kotlin
import com.pulumi.azure.appservice.kotlin.outputs.FunctionAppFunctionFile
import com.pulumi.azure.appservice.kotlin.outputs.FunctionAppFunctionFile.Companion.toKotlin
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
/**
* Builder for [FunctionAppFunction].
*/
@PulumiTagMarker
public class FunctionAppFunctionResourceBuilder internal constructor() {
public var name: String? = null
public var args: FunctionAppFunctionArgs = FunctionAppFunctionArgs()
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 FunctionAppFunctionArgsBuilder.() -> Unit) {
val builder = FunctionAppFunctionArgsBuilder()
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(): FunctionAppFunction {
val builtJavaResource = com.pulumi.azure.appservice.FunctionAppFunction(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return FunctionAppFunction(builtJavaResource)
}
}
/**
* Manages a Function App Function.
* ## Example Usage
* ### Basic HTTP Trigger
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.core.ResourceGroup("example", {
* name: "example-group",
* location: "West Europe",
* });
* const exampleAccount = new azure.storage.Account("example", {
* name: "examplesa",
* resourceGroupName: example.name,
* location: example.location,
* accountTier: "Standard",
* accountReplicationType: "LRS",
* });
* const exampleServicePlan = new azure.appservice.ServicePlan("example", {
* name: "example-service-plan",
* location: example.location,
* resourceGroupName: example.name,
* osType: "Linux",
* skuName: "S1",
* });
* const exampleLinuxFunctionApp = new azure.appservice.LinuxFunctionApp("example", {
* name: "example-function-app",
* location: example.location,
* resourceGroupName: example.name,
* servicePlanId: exampleServicePlan.id,
* storageAccountName: exampleAccount.name,
* storageAccountAccessKey: exampleAccount.primaryAccessKey,
* siteConfig: {
* applicationStack: {
* pythonVersion: "3.9",
* },
* },
* });
* const exampleFunctionAppFunction = new azure.appservice.FunctionAppFunction("example", {
* name: "example-function-app-function",
* functionAppId: exampleLinuxFunctionApp.id,
* language: "Python",
* testData: JSON.stringify({
* name: "Azure",
* }),
* configJson: JSON.stringify({
* bindings: [
* {
* authLevel: "function",
* direction: "in",
* methods: [
* "get",
* "post",
* ],
* name: "req",
* type: "httpTrigger",
* },
* {
* direction: "out",
* name: "$return",
* type: "http",
* },
* ],
* }),
* });
* ```
* ```python
* import pulumi
* import json
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-group",
* location="West Europe")
* example_account = azure.storage.Account("example",
* name="examplesa",
* resource_group_name=example.name,
* location=example.location,
* account_tier="Standard",
* account_replication_type="LRS")
* example_service_plan = azure.appservice.ServicePlan("example",
* name="example-service-plan",
* location=example.location,
* resource_group_name=example.name,
* os_type="Linux",
* sku_name="S1")
* example_linux_function_app = azure.appservice.LinuxFunctionApp("example",
* name="example-function-app",
* location=example.location,
* resource_group_name=example.name,
* service_plan_id=example_service_plan.id,
* storage_account_name=example_account.name,
* storage_account_access_key=example_account.primary_access_key,
* site_config={
* "application_stack": {
* "python_version": "3.9",
* },
* })
* example_function_app_function = azure.appservice.FunctionAppFunction("example",
* name="example-function-app-function",
* function_app_id=example_linux_function_app.id,
* language="Python",
* test_data=json.dumps({
* "name": "Azure",
* }),
* config_json=json.dumps({
* "bindings": [
* {
* "authLevel": "function",
* "direction": "in",
* "methods": [
* "get",
* "post",
* ],
* "name": "req",
* "type": "httpTrigger",
* },
* {
* "direction": "out",
* "name": "$return",
* "type": "http",
* },
* ],
* }))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using System.Text.Json;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var example = new Azure.Core.ResourceGroup("example", new()
* {
* Name = "example-group",
* Location = "West Europe",
* });
* var exampleAccount = new Azure.Storage.Account("example", new()
* {
* Name = "examplesa",
* ResourceGroupName = example.Name,
* Location = example.Location,
* AccountTier = "Standard",
* AccountReplicationType = "LRS",
* });
* var exampleServicePlan = new Azure.AppService.ServicePlan("example", new()
* {
* Name = "example-service-plan",
* Location = example.Location,
* ResourceGroupName = example.Name,
* OsType = "Linux",
* SkuName = "S1",
* });
* var exampleLinuxFunctionApp = new Azure.AppService.LinuxFunctionApp("example", new()
* {
* Name = "example-function-app",
* Location = example.Location,
* ResourceGroupName = example.Name,
* ServicePlanId = exampleServicePlan.Id,
* StorageAccountName = exampleAccount.Name,
* StorageAccountAccessKey = exampleAccount.PrimaryAccessKey,
* SiteConfig = new Azure.AppService.Inputs.LinuxFunctionAppSiteConfigArgs
* {
* ApplicationStack = new Azure.AppService.Inputs.LinuxFunctionAppSiteConfigApplicationStackArgs
* {
* PythonVersion = "3.9",
* },
* },
* });
* var exampleFunctionAppFunction = new Azure.AppService.FunctionAppFunction("example", new()
* {
* Name = "example-function-app-function",
* FunctionAppId = exampleLinuxFunctionApp.Id,
* Language = "Python",
* TestData = JsonSerializer.Serialize(new Dictionary
* {
* ["name"] = "Azure",
* }),
* ConfigJson = JsonSerializer.Serialize(new Dictionary
* {
* ["bindings"] = new[]
* {
* new Dictionary
* {
* ["authLevel"] = "function",
* ["direction"] = "in",
* ["methods"] = new[]
* {
* "get",
* "post",
* },
* ["name"] = "req",
* ["type"] = "httpTrigger",
* },
* new Dictionary
* {
* ["direction"] = "out",
* ["name"] = "$return",
* ["type"] = "http",
* },
* },
* }),
* });
* });
* ```
* ```go
* package main
* import (
* "encoding/json"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appservice"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
* "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-group"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
* Name: pulumi.String("examplesa"),
* ResourceGroupName: example.Name,
* Location: example.Location,
* AccountTier: pulumi.String("Standard"),
* AccountReplicationType: pulumi.String("LRS"),
* })
* if err != nil {
* return err
* }
* exampleServicePlan, err := appservice.NewServicePlan(ctx, "example", &appservice.ServicePlanArgs{
* Name: pulumi.String("example-service-plan"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* OsType: pulumi.String("Linux"),
* SkuName: pulumi.String("S1"),
* })
* if err != nil {
* return err
* }
* exampleLinuxFunctionApp, err := appservice.NewLinuxFunctionApp(ctx, "example", &appservice.LinuxFunctionAppArgs{
* Name: pulumi.String("example-function-app"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* ServicePlanId: exampleServicePlan.ID(),
* StorageAccountName: exampleAccount.Name,
* StorageAccountAccessKey: exampleAccount.PrimaryAccessKey,
* SiteConfig: &appservice.LinuxFunctionAppSiteConfigArgs{
* ApplicationStack: &appservice.LinuxFunctionAppSiteConfigApplicationStackArgs{
* PythonVersion: pulumi.String("3.9"),
* },
* },
* })
* if err != nil {
* return err
* }
* tmpJSON0, err := json.Marshal(map[string]interface{}{
* "name": "Azure",
* })
* if err != nil {
* return err
* }
* json0 := string(tmpJSON0)
* tmpJSON1, err := json.Marshal(map[string]interface{}{
* "bindings": []interface{}{
* map[string]interface{}{
* "authLevel": "function",
* "direction": "in",
* "methods": []string{
* "get",
* "post",
* },
* "name": "req",
* "type": "httpTrigger",
* },
* map[string]interface{}{
* "direction": "out",
* "name": "$return",
* "type": "http",
* },
* },
* })
* if err != nil {
* return err
* }
* json1 := string(tmpJSON1)
* _, err = appservice.NewFunctionAppFunction(ctx, "example", &appservice.FunctionAppFunctionArgs{
* Name: pulumi.String("example-function-app-function"),
* FunctionAppId: exampleLinuxFunctionApp.ID(),
* Language: pulumi.String("Python"),
* TestData: pulumi.String(json0),
* ConfigJson: pulumi.String(json1),
* })
* 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.storage.Account;
* import com.pulumi.azure.storage.AccountArgs;
* import com.pulumi.azure.appservice.ServicePlan;
* import com.pulumi.azure.appservice.ServicePlanArgs;
* import com.pulumi.azure.appservice.LinuxFunctionApp;
* import com.pulumi.azure.appservice.LinuxFunctionAppArgs;
* import com.pulumi.azure.appservice.inputs.LinuxFunctionAppSiteConfigArgs;
* import com.pulumi.azure.appservice.inputs.LinuxFunctionAppSiteConfigApplicationStackArgs;
* import com.pulumi.azure.appservice.FunctionAppFunction;
* import com.pulumi.azure.appservice.FunctionAppFunctionArgs;
* import static com.pulumi.codegen.internal.Serialization.*;
* 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-group")
* .location("West Europe")
* .build());
* var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
* .name("examplesa")
* .resourceGroupName(example.name())
* .location(example.location())
* .accountTier("Standard")
* .accountReplicationType("LRS")
* .build());
* var exampleServicePlan = new ServicePlan("exampleServicePlan", ServicePlanArgs.builder()
* .name("example-service-plan")
* .location(example.location())
* .resourceGroupName(example.name())
* .osType("Linux")
* .skuName("S1")
* .build());
* var exampleLinuxFunctionApp = new LinuxFunctionApp("exampleLinuxFunctionApp", LinuxFunctionAppArgs.builder()
* .name("example-function-app")
* .location(example.location())
* .resourceGroupName(example.name())
* .servicePlanId(exampleServicePlan.id())
* .storageAccountName(exampleAccount.name())
* .storageAccountAccessKey(exampleAccount.primaryAccessKey())
* .siteConfig(LinuxFunctionAppSiteConfigArgs.builder()
* .applicationStack(LinuxFunctionAppSiteConfigApplicationStackArgs.builder()
* .pythonVersion("3.9")
* .build())
* .build())
* .build());
* var exampleFunctionAppFunction = new FunctionAppFunction("exampleFunctionAppFunction", FunctionAppFunctionArgs.builder()
* .name("example-function-app-function")
* .functionAppId(exampleLinuxFunctionApp.id())
* .language("Python")
* .testData(serializeJson(
* jsonObject(
* jsonProperty("name", "Azure")
* )))
* .configJson(serializeJson(
* jsonObject(
* jsonProperty("bindings", jsonArray(
* jsonObject(
* jsonProperty("authLevel", "function"),
* jsonProperty("direction", "in"),
* jsonProperty("methods", jsonArray(
* "get",
* "post"
* )),
* jsonProperty("name", "req"),
* jsonProperty("type", "httpTrigger")
* ),
* jsonObject(
* jsonProperty("direction", "out"),
* jsonProperty("name", "$return"),
* jsonProperty("type", "http")
* )
* ))
* )))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-group
* location: West Europe
* exampleAccount:
* type: azure:storage:Account
* name: example
* properties:
* name: examplesa
* resourceGroupName: ${example.name}
* location: ${example.location}
* accountTier: Standard
* accountReplicationType: LRS
* exampleServicePlan:
* type: azure:appservice:ServicePlan
* name: example
* properties:
* name: example-service-plan
* location: ${example.location}
* resourceGroupName: ${example.name}
* osType: Linux
* skuName: S1
* exampleLinuxFunctionApp:
* type: azure:appservice:LinuxFunctionApp
* name: example
* properties:
* name: example-function-app
* location: ${example.location}
* resourceGroupName: ${example.name}
* servicePlanId: ${exampleServicePlan.id}
* storageAccountName: ${exampleAccount.name}
* storageAccountAccessKey: ${exampleAccount.primaryAccessKey}
* siteConfig:
* applicationStack:
* pythonVersion: '3.9'
* exampleFunctionAppFunction:
* type: azure:appservice:FunctionAppFunction
* name: example
* properties:
* name: example-function-app-function
* functionAppId: ${exampleLinuxFunctionApp.id}
* language: Python
* testData:
* fn::toJSON:
* name: Azure
* configJson:
* fn::toJSON:
* bindings:
* - authLevel: function
* direction: in
* methods:
* - get
* - post
* name: req
* type: httpTrigger
* - direction: out
* name: $return
* type: http
* ```
*
* ### HTTP Trigger With Code Upload
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* import * as std from "@pulumi/std";
* const example = new azure.core.ResourceGroup("example", {
* name: "example-group",
* location: "West Europe",
* });
* const exampleAccount = new azure.storage.Account("example", {
* name: "examplesa",
* resourceGroupName: example.name,
* location: example.location,
* accountTier: "Standard",
* accountReplicationType: "LRS",
* });
* const exampleServicePlan = new azure.appservice.ServicePlan("example", {
* name: "example-service-plan",
* location: example.location,
* resourceGroupName: example.name,
* osType: "Windows",
* skuName: "S1",
* });
* const exampleWindowsFunctionApp = new azure.appservice.WindowsFunctionApp("example", {
* name: "example-function-app",
* location: example.location,
* resourceGroupName: example.name,
* servicePlanId: exampleServicePlan.id,
* storageAccountName: exampleAccount.name,
* storageAccountAccessKey: exampleAccount.primaryAccessKey,
* siteConfig: {
* applicationStack: {
* dotnetVersion: "6",
* },
* },
* });
* const exampleFunctionAppFunction = new azure.appservice.FunctionAppFunction("example", {
* name: "example-function-app-function",
* functionAppId: exampleWindowsFunctionApp.id,
* language: "CSharp",
* files: [{
* name: "run.csx",
* content: std.file({
* input: "exampledata/run.csx",
* }).then(invoke => invoke.result),
* }],
* testData: JSON.stringify({
* name: "Azure",
* }),
* configJson: JSON.stringify({
* bindings: [
* {
* authLevel: "function",
* direction: "in",
* methods: [
* "get",
* "post",
* ],
* name: "req",
* type: "httpTrigger",
* },
* {
* direction: "out",
* name: "$return",
* type: "http",
* },
* ],
* }),
* });
* ```
* ```python
* import pulumi
* import json
* import pulumi_azure as azure
* import pulumi_std as std
* example = azure.core.ResourceGroup("example",
* name="example-group",
* location="West Europe")
* example_account = azure.storage.Account("example",
* name="examplesa",
* resource_group_name=example.name,
* location=example.location,
* account_tier="Standard",
* account_replication_type="LRS")
* example_service_plan = azure.appservice.ServicePlan("example",
* name="example-service-plan",
* location=example.location,
* resource_group_name=example.name,
* os_type="Windows",
* sku_name="S1")
* example_windows_function_app = azure.appservice.WindowsFunctionApp("example",
* name="example-function-app",
* location=example.location,
* resource_group_name=example.name,
* service_plan_id=example_service_plan.id,
* storage_account_name=example_account.name,
* storage_account_access_key=example_account.primary_access_key,
* site_config={
* "application_stack": {
* "dotnet_version": "6",
* },
* })
* example_function_app_function = azure.appservice.FunctionAppFunction("example",
* name="example-function-app-function",
* function_app_id=example_windows_function_app.id,
* language="CSharp",
* files=[{
* "name": "run.csx",
* "content": std.file(input="exampledata/run.csx").result,
* }],
* test_data=json.dumps({
* "name": "Azure",
* }),
* config_json=json.dumps({
* "bindings": [
* {
* "authLevel": "function",
* "direction": "in",
* "methods": [
* "get",
* "post",
* ],
* "name": "req",
* "type": "httpTrigger",
* },
* {
* "direction": "out",
* "name": "$return",
* "type": "http",
* },
* ],
* }))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using System.Text.Json;
* using Pulumi;
* using Azure = Pulumi.Azure;
* using Std = Pulumi.Std;
* return await Deployment.RunAsync(() =>
* {
* var example = new Azure.Core.ResourceGroup("example", new()
* {
* Name = "example-group",
* Location = "West Europe",
* });
* var exampleAccount = new Azure.Storage.Account("example", new()
* {
* Name = "examplesa",
* ResourceGroupName = example.Name,
* Location = example.Location,
* AccountTier = "Standard",
* AccountReplicationType = "LRS",
* });
* var exampleServicePlan = new Azure.AppService.ServicePlan("example", new()
* {
* Name = "example-service-plan",
* Location = example.Location,
* ResourceGroupName = example.Name,
* OsType = "Windows",
* SkuName = "S1",
* });
* var exampleWindowsFunctionApp = new Azure.AppService.WindowsFunctionApp("example", new()
* {
* Name = "example-function-app",
* Location = example.Location,
* ResourceGroupName = example.Name,
* ServicePlanId = exampleServicePlan.Id,
* StorageAccountName = exampleAccount.Name,
* StorageAccountAccessKey = exampleAccount.PrimaryAccessKey,
* SiteConfig = new Azure.AppService.Inputs.WindowsFunctionAppSiteConfigArgs
* {
* ApplicationStack = new Azure.AppService.Inputs.WindowsFunctionAppSiteConfigApplicationStackArgs
* {
* DotnetVersion = "6",
* },
* },
* });
* var exampleFunctionAppFunction = new Azure.AppService.FunctionAppFunction("example", new()
* {
* Name = "example-function-app-function",
* FunctionAppId = exampleWindowsFunctionApp.Id,
* Language = "CSharp",
* Files = new[]
* {
* new Azure.AppService.Inputs.FunctionAppFunctionFileArgs
* {
* Name = "run.csx",
* Content = Std.File.Invoke(new()
* {
* Input = "exampledata/run.csx",
* }).Apply(invoke => invoke.Result),
* },
* },
* TestData = JsonSerializer.Serialize(new Dictionary
* {
* ["name"] = "Azure",
* }),
* ConfigJson = JsonSerializer.Serialize(new Dictionary
* {
* ["bindings"] = new[]
* {
* new Dictionary
* {
* ["authLevel"] = "function",
* ["direction"] = "in",
* ["methods"] = new[]
* {
* "get",
* "post",
* },
* ["name"] = "req",
* ["type"] = "httpTrigger",
* },
* new Dictionary
* {
* ["direction"] = "out",
* ["name"] = "$return",
* ["type"] = "http",
* },
* },
* }),
* });
* });
* ```
* ```go
* package main
* import (
* "encoding/json"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appservice"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
* "github.com/pulumi/pulumi-std/sdk/go/std"
* "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-group"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
* Name: pulumi.String("examplesa"),
* ResourceGroupName: example.Name,
* Location: example.Location,
* AccountTier: pulumi.String("Standard"),
* AccountReplicationType: pulumi.String("LRS"),
* })
* if err != nil {
* return err
* }
* exampleServicePlan, err := appservice.NewServicePlan(ctx, "example", &appservice.ServicePlanArgs{
* Name: pulumi.String("example-service-plan"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* OsType: pulumi.String("Windows"),
* SkuName: pulumi.String("S1"),
* })
* if err != nil {
* return err
* }
* exampleWindowsFunctionApp, err := appservice.NewWindowsFunctionApp(ctx, "example", &appservice.WindowsFunctionAppArgs{
* Name: pulumi.String("example-function-app"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* ServicePlanId: exampleServicePlan.ID(),
* StorageAccountName: exampleAccount.Name,
* StorageAccountAccessKey: exampleAccount.PrimaryAccessKey,
* SiteConfig: &appservice.WindowsFunctionAppSiteConfigArgs{
* ApplicationStack: &appservice.WindowsFunctionAppSiteConfigApplicationStackArgs{
* DotnetVersion: pulumi.String("6"),
* },
* },
* })
* if err != nil {
* return err
* }
* invokeFile, err := std.File(ctx, &std.FileArgs{
* Input: "exampledata/run.csx",
* }, nil)
* if err != nil {
* return err
* }
* tmpJSON0, err := json.Marshal(map[string]interface{}{
* "name": "Azure",
* })
* if err != nil {
* return err
* }
* json0 := string(tmpJSON0)
* tmpJSON1, err := json.Marshal(map[string]interface{}{
* "bindings": []interface{}{
* map[string]interface{}{
* "authLevel": "function",
* "direction": "in",
* "methods": []string{
* "get",
* "post",
* },
* "name": "req",
* "type": "httpTrigger",
* },
* map[string]interface{}{
* "direction": "out",
* "name": "$return",
* "type": "http",
* },
* },
* })
* if err != nil {
* return err
* }
* json1 := string(tmpJSON1)
* _, err = appservice.NewFunctionAppFunction(ctx, "example", &appservice.FunctionAppFunctionArgs{
* Name: pulumi.String("example-function-app-function"),
* FunctionAppId: exampleWindowsFunctionApp.ID(),
* Language: pulumi.String("CSharp"),
* Files: appservice.FunctionAppFunctionFileArray{
* &appservice.FunctionAppFunctionFileArgs{
* Name: pulumi.String("run.csx"),
* Content: pulumi.String(invokeFile.Result),
* },
* },
* TestData: pulumi.String(json0),
* ConfigJson: pulumi.String(json1),
* })
* 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.storage.Account;
* import com.pulumi.azure.storage.AccountArgs;
* import com.pulumi.azure.appservice.ServicePlan;
* import com.pulumi.azure.appservice.ServicePlanArgs;
* import com.pulumi.azure.appservice.WindowsFunctionApp;
* import com.pulumi.azure.appservice.WindowsFunctionAppArgs;
* import com.pulumi.azure.appservice.inputs.WindowsFunctionAppSiteConfigArgs;
* import com.pulumi.azure.appservice.inputs.WindowsFunctionAppSiteConfigApplicationStackArgs;
* import com.pulumi.azure.appservice.FunctionAppFunction;
* import com.pulumi.azure.appservice.FunctionAppFunctionArgs;
* import com.pulumi.azure.appservice.inputs.FunctionAppFunctionFileArgs;
* import static com.pulumi.codegen.internal.Serialization.*;
* 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-group")
* .location("West Europe")
* .build());
* var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
* .name("examplesa")
* .resourceGroupName(example.name())
* .location(example.location())
* .accountTier("Standard")
* .accountReplicationType("LRS")
* .build());
* var exampleServicePlan = new ServicePlan("exampleServicePlan", ServicePlanArgs.builder()
* .name("example-service-plan")
* .location(example.location())
* .resourceGroupName(example.name())
* .osType("Windows")
* .skuName("S1")
* .build());
* var exampleWindowsFunctionApp = new WindowsFunctionApp("exampleWindowsFunctionApp", WindowsFunctionAppArgs.builder()
* .name("example-function-app")
* .location(example.location())
* .resourceGroupName(example.name())
* .servicePlanId(exampleServicePlan.id())
* .storageAccountName(exampleAccount.name())
* .storageAccountAccessKey(exampleAccount.primaryAccessKey())
* .siteConfig(WindowsFunctionAppSiteConfigArgs.builder()
* .applicationStack(WindowsFunctionAppSiteConfigApplicationStackArgs.builder()
* .dotnetVersion("6")
* .build())
* .build())
* .build());
* var exampleFunctionAppFunction = new FunctionAppFunction("exampleFunctionAppFunction", FunctionAppFunctionArgs.builder()
* .name("example-function-app-function")
* .functionAppId(exampleWindowsFunctionApp.id())
* .language("CSharp")
* .files(FunctionAppFunctionFileArgs.builder()
* .name("run.csx")
* .content(StdFunctions.file(FileArgs.builder()
* .input("exampledata/run.csx")
* .build()).result())
* .build())
* .testData(serializeJson(
* jsonObject(
* jsonProperty("name", "Azure")
* )))
* .configJson(serializeJson(
* jsonObject(
* jsonProperty("bindings", jsonArray(
* jsonObject(
* jsonProperty("authLevel", "function"),
* jsonProperty("direction", "in"),
* jsonProperty("methods", jsonArray(
* "get",
* "post"
* )),
* jsonProperty("name", "req"),
* jsonProperty("type", "httpTrigger")
* ),
* jsonObject(
* jsonProperty("direction", "out"),
* jsonProperty("name", "$return"),
* jsonProperty("type", "http")
* )
* ))
* )))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-group
* location: West Europe
* exampleAccount:
* type: azure:storage:Account
* name: example
* properties:
* name: examplesa
* resourceGroupName: ${example.name}
* location: ${example.location}
* accountTier: Standard
* accountReplicationType: LRS
* exampleServicePlan:
* type: azure:appservice:ServicePlan
* name: example
* properties:
* name: example-service-plan
* location: ${example.location}
* resourceGroupName: ${example.name}
* osType: Windows
* skuName: S1
* exampleWindowsFunctionApp:
* type: azure:appservice:WindowsFunctionApp
* name: example
* properties:
* name: example-function-app
* location: ${example.location}
* resourceGroupName: ${example.name}
* servicePlanId: ${exampleServicePlan.id}
* storageAccountName: ${exampleAccount.name}
* storageAccountAccessKey: ${exampleAccount.primaryAccessKey}
* siteConfig:
* applicationStack:
* dotnetVersion: '6'
* exampleFunctionAppFunction:
* type: azure:appservice:FunctionAppFunction
* name: example
* properties:
* name: example-function-app-function
* functionAppId: ${exampleWindowsFunctionApp.id}
* language: CSharp
* files:
* - name: run.csx
* content:
* fn::invoke:
* Function: std:file
* Arguments:
* input: exampledata/run.csx
* Return: result
* testData:
* fn::toJSON:
* name: Azure
* configJson:
* fn::toJSON:
* bindings:
* - authLevel: function
* direction: in
* methods:
* - get
* - post
* name: req
* type: httpTrigger
* - direction: out
* name: $return
* type: http
* ```
*
* ## Import
* a Function App Function can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:appservice/functionAppFunction:FunctionAppFunction example "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/sites/site1/functions/function1"
* ```
*/
public class FunctionAppFunction internal constructor(
override val javaResource: com.pulumi.azure.appservice.FunctionAppFunction,
) : KotlinCustomResource(javaResource, FunctionAppFunctionMapper) {
/**
* The config for this Function in JSON format.
*/
public val configJson: Output
get() = javaResource.configJson().applyValue({ args0 -> args0 })
/**
* The URL of the configuration JSON.
*/
public val configUrl: Output
get() = javaResource.configUrl().applyValue({ args0 -> args0 })
/**
* Should this function be enabled. Defaults to `true`.
*/
public val enabled: Output?
get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* A `file` block as detailed below. Changing this forces a new resource to be created.
*/
public val files: Output>?
get() = javaResource.files().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> toKotlin(args0) })
})
}).orElse(null)
})
/**
* The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.
*/
public val functionAppId: Output
get() = javaResource.functionAppId().applyValue({ args0 -> args0 })
/**
* The invocation URL.
*/
public val invocationUrl: Output
get() = javaResource.invocationUrl().applyValue({ args0 -> args0 })
/**
* The language the Function is written in. Possible values are `CSharp`, `Custom`, `Java`, `Javascript`, `Python`, `PowerShell`, and `TypeScript`.
* > **NOTE:** when using `Custom` language, you must specify the code handler in the `host.json` file for your function. See the [official docs](https://docs.microsoft.com/azure/azure-functions/functions-custom-handlers#hostjson) for more information.
*/
public val language: Output?
get() = javaResource.language().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The name of the function. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The Script root path URL.
*/
public val scriptRootPathUrl: Output
get() = javaResource.scriptRootPathUrl().applyValue({ args0 -> args0 })
/**
* The script URL.
*/
public val scriptUrl: Output
get() = javaResource.scriptUrl().applyValue({ args0 -> args0 })
/**
* The URL for the Secrets File.
*/
public val secretsFileUrl: Output
get() = javaResource.secretsFileUrl().applyValue({ args0 -> args0 })
/**
* The test data for the function.
*/
public val testData: Output?
get() = javaResource.testData().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The Test data URL.
*/
public val testDataUrl: Output
get() = javaResource.testDataUrl().applyValue({ args0 -> args0 })
/**
* The function URL.
*/
public val url: Output
get() = javaResource.url().applyValue({ args0 -> args0 })
}
public object FunctionAppFunctionMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.appservice.FunctionAppFunction::class == javaResource::class
override fun map(javaResource: Resource): FunctionAppFunction = FunctionAppFunction(
javaResource
as com.pulumi.azure.appservice.FunctionAppFunction,
)
}
/**
* @see [FunctionAppFunction].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [FunctionAppFunction].
*/
public suspend fun functionAppFunction(
name: String,
block: suspend FunctionAppFunctionResourceBuilder.() -> Unit,
): FunctionAppFunction {
val builder = FunctionAppFunctionResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [FunctionAppFunction].
* @param name The _unique_ name of the resulting resource.
*/
public fun functionAppFunction(name: String): FunctionAppFunction {
val builder = FunctionAppFunctionResourceBuilder()
builder.name(name)
return builder.build()
}