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.FunctionAppFunctionArgs.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.appservice.kotlin
import com.pulumi.azure.appservice.FunctionAppFunctionArgs.builder
import com.pulumi.azure.appservice.kotlin.inputs.FunctionAppFunctionFileArgs
import com.pulumi.azure.appservice.kotlin.inputs.FunctionAppFunctionFileArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName
/**
* 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"
* ```
* @property configJson The config for this Function in JSON format.
* @property enabled Should this function be enabled. Defaults to `true`.
* @property files A `file` block as detailed below. Changing this forces a new resource to be created.
* @property functionAppId The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.
* @property language 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.
* @property name The name of the function. Changing this forces a new resource to be created.
* @property testData The test data for the function.
*/
public data class FunctionAppFunctionArgs(
public val configJson: Output? = null,
public val enabled: Output? = null,
public val files: Output>? = null,
public val functionAppId: Output? = null,
public val language: Output? = null,
public val name: Output? = null,
public val testData: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.azure.appservice.FunctionAppFunctionArgs =
com.pulumi.azure.appservice.FunctionAppFunctionArgs.builder()
.configJson(configJson?.applyValue({ args0 -> args0 }))
.enabled(enabled?.applyValue({ args0 -> args0 }))
.files(files?.applyValue({ args0 -> args0.map({ args0 -> args0.let({ args0 -> args0.toJava() }) }) }))
.functionAppId(functionAppId?.applyValue({ args0 -> args0 }))
.language(language?.applyValue({ args0 -> args0 }))
.name(name?.applyValue({ args0 -> args0 }))
.testData(testData?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [FunctionAppFunctionArgs].
*/
@PulumiTagMarker
public class FunctionAppFunctionArgsBuilder internal constructor() {
private var configJson: Output? = null
private var enabled: Output? = null
private var files: Output>? = null
private var functionAppId: Output? = null
private var language: Output? = null
private var name: Output? = null
private var testData: Output? = null
/**
* @param value The config for this Function in JSON format.
*/
@JvmName("cigsbdvvkvsdjvtr")
public suspend fun configJson(`value`: Output) {
this.configJson = value
}
/**
* @param value Should this function be enabled. Defaults to `true`.
*/
@JvmName("akjujyoxhormtmxh")
public suspend fun enabled(`value`: Output) {
this.enabled = value
}
/**
* @param value A `file` block as detailed below. Changing this forces a new resource to be created.
*/
@JvmName("ggfhbtirkmoypslk")
public suspend fun files(`value`: Output>) {
this.files = value
}
@JvmName("bfdrvajosrenlhbx")
public suspend fun files(vararg values: Output) {
this.files = Output.all(values.asList())
}
/**
* @param values A `file` block as detailed below. Changing this forces a new resource to be created.
*/
@JvmName("wgbjnwodahfdvkvi")
public suspend fun files(values: List>) {
this.files = Output.all(values)
}
/**
* @param value The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.
*/
@JvmName("tlaxnfmqrtnslrba")
public suspend fun functionAppId(`value`: Output) {
this.functionAppId = value
}
/**
* @param value 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.
*/
@JvmName("pvnkhbwtsdcryxhm")
public suspend fun language(`value`: Output) {
this.language = value
}
/**
* @param value The name of the function. Changing this forces a new resource to be created.
*/
@JvmName("mliqilarcfyatpcp")
public suspend fun name(`value`: Output) {
this.name = value
}
/**
* @param value The test data for the function.
*/
@JvmName("etwjyrgdilmofera")
public suspend fun testData(`value`: Output) {
this.testData = value
}
/**
* @param value The config for this Function in JSON format.
*/
@JvmName("thhkikpxccyloqou")
public suspend fun configJson(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.configJson = mapped
}
/**
* @param value Should this function be enabled. Defaults to `true`.
*/
@JvmName("aespqekjmkjxwbag")
public suspend fun enabled(`value`: Boolean?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.enabled = mapped
}
/**
* @param value A `file` block as detailed below. Changing this forces a new resource to be created.
*/
@JvmName("ygadeaqyhnxlkpow")
public suspend fun files(`value`: List?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.files = mapped
}
/**
* @param argument A `file` block as detailed below. Changing this forces a new resource to be created.
*/
@JvmName("ocuugyvalnxieyxp")
public suspend fun files(argument: List Unit>) {
val toBeMapped = argument.toList().map {
FunctionAppFunctionFileArgsBuilder().applySuspend {
it()
}.build()
}
val mapped = of(toBeMapped)
this.files = mapped
}
/**
* @param argument A `file` block as detailed below. Changing this forces a new resource to be created.
*/
@JvmName("jpjrjxfucchiauoq")
public suspend fun files(vararg argument: suspend FunctionAppFunctionFileArgsBuilder.() -> Unit) {
val toBeMapped = argument.toList().map {
FunctionAppFunctionFileArgsBuilder().applySuspend {
it()
}.build()
}
val mapped = of(toBeMapped)
this.files = mapped
}
/**
* @param argument A `file` block as detailed below. Changing this forces a new resource to be created.
*/
@JvmName("vmqsgxtjoskinfrl")
public suspend fun files(argument: suspend FunctionAppFunctionFileArgsBuilder.() -> Unit) {
val toBeMapped = listOf(
FunctionAppFunctionFileArgsBuilder().applySuspend {
argument()
}.build(),
)
val mapped = of(toBeMapped)
this.files = mapped
}
/**
* @param values A `file` block as detailed below. Changing this forces a new resource to be created.
*/
@JvmName("apbjcyytsxyxasdw")
public suspend fun files(vararg values: FunctionAppFunctionFileArgs) {
val toBeMapped = values.toList()
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.files = mapped
}
/**
* @param value The ID of the Function App in which this function should reside. Changing this forces a new resource to be created.
*/
@JvmName("bgdvmdrfhektdwfm")
public suspend fun functionAppId(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.functionAppId = mapped
}
/**
* @param value 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.
*/
@JvmName("vxacrwujlrgbnehy")
public suspend fun language(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.language = mapped
}
/**
* @param value The name of the function. Changing this forces a new resource to be created.
*/
@JvmName("ebxmkmjkpbtbabch")
public suspend fun name(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.name = mapped
}
/**
* @param value The test data for the function.
*/
@JvmName("lmokgetkroyeyaxe")
public suspend fun testData(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.testData = mapped
}
internal fun build(): FunctionAppFunctionArgs = FunctionAppFunctionArgs(
configJson = configJson,
enabled = enabled,
files = files,
functionAppId = functionAppId,
language = language,
name = name,
testData = testData,
)
}