1. Packages
  2. Packages
  3. Alibaba Cloud Provider
  4. API Docs
  5. apigateway
  6. BackendModel
Viewing docs for Alibaba Cloud v3.104.0
published on Thursday, Jun 25, 2026 by Pulumi
alicloud logo
Viewing docs for Alibaba Cloud v3.104.0
published on Thursday, Jun 25, 2026 by Pulumi

    Provides a Api Gateway Backend Model resource.

    For information about Api Gateway Backend Model and how to use it, see What is Backend Model.

    NOTE: Available since v1.279.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf_example";
    const _default = new alicloud.apigateway.Backend("default", {
        backendName: name,
        description: name,
        backendType: "HTTP",
    });
    const defaultBackendModel = new alicloud.apigateway.BackendModel("default", {
        backendId: _default.id,
        backendType: "HTTP",
        stageName: "RELEASE",
        description: name,
        backendModelData: JSON.stringify({
            ServiceAddress: "http://apigateway.alicloudapi.com:8080",
            HttpTargetHostName: "www.example.com",
        }),
    });
    
    import pulumi
    import json
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf_example"
    default = alicloud.apigateway.Backend("default",
        backend_name=name,
        description=name,
        backend_type="HTTP")
    default_backend_model = alicloud.apigateway.BackendModel("default",
        backend_id=default.id,
        backend_type="HTTP",
        stage_name="RELEASE",
        description=name,
        backend_model_data=json.dumps({
            "ServiceAddress": "http://apigateway.alicloudapi.com:8080",
            "HttpTargetHostName": "www.example.com",
        }))
    
    package main
    
    import (
    	"encoding/json"
    
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/apigateway"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "tf_example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := apigateway.NewBackend(ctx, "default", &apigateway.BackendArgs{
    			BackendName: pulumi.String(name),
    			Description: pulumi.String(name),
    			BackendType: pulumi.String("HTTP"),
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"ServiceAddress":     "http://apigateway.alicloudapi.com:8080",
    			"HttpTargetHostName": "www.example.com",
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		_, err = apigateway.NewBackendModel(ctx, "default", &apigateway.BackendModelArgs{
    			BackendId:        _default.ID(),
    			BackendType:      pulumi.String("HTTP"),
    			StageName:        pulumi.String("RELEASE"),
    			Description:      pulumi.String(name),
    			BackendModelData: pulumi.String(json0),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf_example";
        var @default = new AliCloud.ApiGateway.Backend("default", new()
        {
            BackendName = name,
            Description = name,
            BackendType = "HTTP",
        });
    
        var defaultBackendModel = new AliCloud.ApiGateway.BackendModel("default", new()
        {
            BackendId = @default.Id,
            BackendType = "HTTP",
            StageName = "RELEASE",
            Description = name,
            BackendModelData = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["ServiceAddress"] = "http://apigateway.alicloudapi.com:8080",
                ["HttpTargetHostName"] = "www.example.com",
            }),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.apigateway.Backend;
    import com.pulumi.alicloud.apigateway.BackendArgs;
    import com.pulumi.alicloud.apigateway.BackendModel;
    import com.pulumi.alicloud.apigateway.BackendModelArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 config = ctx.config();
            final var name = config.get("name").orElse("tf_example");
            var default_ = new Backend("default", BackendArgs.builder()
                .backendName(name)
                .description(name)
                .backendType("HTTP")
                .build());
    
            var defaultBackendModel = new BackendModel("defaultBackendModel", BackendModelArgs.builder()
                .backendId(default_.id())
                .backendType("HTTP")
                .stageName("RELEASE")
                .description(name)
                .backendModelData(serializeJson(
                    jsonObject(
                        jsonProperty("ServiceAddress", "http://apigateway.alicloudapi.com:8080"),
                        jsonProperty("HttpTargetHostName", "www.example.com")
                    )))
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf_example
    resources:
      default:
        type: alicloud:apigateway:Backend
        properties:
          backendName: ${name}
          description: ${name}
          backendType: HTTP
      defaultBackendModel:
        type: alicloud:apigateway:BackendModel
        name: default
        properties:
          backendId: ${default.id}
          backendType: HTTP
          stageName: RELEASE
          description: ${name}
          backendModelData:
            fn::toJSON:
              ServiceAddress: http://apigateway.alicloudapi.com:8080
              HttpTargetHostName: www.example.com
    
    pulumi {
      required_providers {
        alicloud = {
          source = "pulumi/alicloud"
        }
      }
    }
    
    resource "alicloud_apigateway_backend" "default" {
      backend_name = var.name
      description  = var.name
      backend_type = "HTTP"
    }
    resource "alicloud_apigateway_backendmodel" "default" {
      backend_id   = alicloud_apigateway_backend.default.id
      backend_type = "HTTP"
      stage_name   = "RELEASE"
      description  = var.name
      backend_model_data = jsonencode({
        "ServiceAddress"     = "http://apigateway.alicloudapi.com:8080"
        "HttpTargetHostName" = "www.example.com"
      })
    }
    variable "name" {
      type    = string
      default = "tf_example"
    }
    

    📚 Need more examples? VIEW MORE EXAMPLES

    Create BackendModel Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new BackendModel(name: string, args: BackendModelArgs, opts?: CustomResourceOptions);
    @overload
    def BackendModel(resource_name: str,
                     args: BackendModelArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def BackendModel(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     backend_id: Optional[str] = None,
                     backend_model_data: Optional[str] = None,
                     backend_type: Optional[str] = None,
                     stage_name: Optional[str] = None,
                     description: Optional[str] = None)
    func NewBackendModel(ctx *Context, name string, args BackendModelArgs, opts ...ResourceOption) (*BackendModel, error)
    public BackendModel(string name, BackendModelArgs args, CustomResourceOptions? opts = null)
    public BackendModel(String name, BackendModelArgs args)
    public BackendModel(String name, BackendModelArgs args, CustomResourceOptions options)
    
    type: alicloud:apigateway:BackendModel
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "alicloud_apigateway_backendmodel" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args BackendModelArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args BackendModelArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args BackendModelArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args BackendModelArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args BackendModelArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var backendModelResource = new AliCloud.ApiGateway.BackendModel("backendModelResource", new()
    {
        BackendId = "string",
        BackendModelData = "string",
        BackendType = "string",
        StageName = "string",
        Description = "string",
    });
    
    example, err := apigateway.NewBackendModel(ctx, "backendModelResource", &apigateway.BackendModelArgs{
    	BackendId:        pulumi.String("string"),
    	BackendModelData: pulumi.String("string"),
    	BackendType:      pulumi.String("string"),
    	StageName:        pulumi.String("string"),
    	Description:      pulumi.String("string"),
    })
    
    resource "alicloud_apigateway_backendmodel" "backendModelResource" {
      backend_id         = "string"
      backend_model_data = "string"
      backend_type       = "string"
      stage_name         = "string"
      description        = "string"
    }
    
    var backendModelResource = new BackendModel("backendModelResource", BackendModelArgs.builder()
        .backendId("string")
        .backendModelData("string")
        .backendType("string")
        .stageName("string")
        .description("string")
        .build());
    
    backend_model_resource = alicloud.apigateway.BackendModel("backendModelResource",
        backend_id="string",
        backend_model_data="string",
        backend_type="string",
        stage_name="string",
        description="string")
    
    const backendModelResource = new alicloud.apigateway.BackendModel("backendModelResource", {
        backendId: "string",
        backendModelData: "string",
        backendType: "string",
        stageName: "string",
        description: "string",
    });
    
    type: alicloud:apigateway:BackendModel
    properties:
        backendId: string
        backendModelData: string
        backendType: string
        description: string
        stageName: string
    

    BackendModel Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The BackendModel resource accepts the following input properties:

    BackendId string
    The ID of the Backend.
    BackendModelData string
    The backend model data in JSON format. The structure varies by backendType. See CreateBackendModel for more details.
    BackendType string
    The type of the Backend. Valid values: HTTP, VPC, FC_EVENT, FC_EVENT_V3, FC_HTTP, FC_HTTP_V3, OSS, MOCK, EVENTBRIDGE.
    StageName string
    The stage name of the Backend Model. Valid values: RELEASE, PRE, TEST.
    Description string
    The description of the Backend Model.
    BackendId string
    The ID of the Backend.
    BackendModelData string
    The backend model data in JSON format. The structure varies by backendType. See CreateBackendModel for more details.
    BackendType string
    The type of the Backend. Valid values: HTTP, VPC, FC_EVENT, FC_EVENT_V3, FC_HTTP, FC_HTTP_V3, OSS, MOCK, EVENTBRIDGE.
    StageName string
    The stage name of the Backend Model. Valid values: RELEASE, PRE, TEST.
    Description string
    The description of the Backend Model.
    backend_id string
    The ID of the Backend.
    backend_model_data string
    The backend model data in JSON format. The structure varies by backendType. See CreateBackendModel for more details.
    backend_type string
    The type of the Backend. Valid values: HTTP, VPC, FC_EVENT, FC_EVENT_V3, FC_HTTP, FC_HTTP_V3, OSS, MOCK, EVENTBRIDGE.
    stage_name string
    The stage name of the Backend Model. Valid values: RELEASE, PRE, TEST.
    description string
    The description of the Backend Model.
    backendId String
    The ID of the Backend.
    backendModelData String
    The backend model data in JSON format. The structure varies by backendType. See CreateBackendModel for more details.
    backendType String
    The type of the Backend. Valid values: HTTP, VPC, FC_EVENT, FC_EVENT_V3, FC_HTTP, FC_HTTP_V3, OSS, MOCK, EVENTBRIDGE.
    stageName String
    The stage name of the Backend Model. Valid values: RELEASE, PRE, TEST.
    description String
    The description of the Backend Model.
    backendId string
    The ID of the Backend.
    backendModelData string
    The backend model data in JSON format. The structure varies by backendType. See CreateBackendModel for more details.
    backendType string
    The type of the Backend. Valid values: HTTP, VPC, FC_EVENT, FC_EVENT_V3, FC_HTTP, FC_HTTP_V3, OSS, MOCK, EVENTBRIDGE.
    stageName string
    The stage name of the Backend Model. Valid values: RELEASE, PRE, TEST.
    description string
    The description of the Backend Model.
    backend_id str
    The ID of the Backend.
    backend_model_data str
    The backend model data in JSON format. The structure varies by backendType. See CreateBackendModel for more details.
    backend_type str
    The type of the Backend. Valid values: HTTP, VPC, FC_EVENT, FC_EVENT_V3, FC_HTTP, FC_HTTP_V3, OSS, MOCK, EVENTBRIDGE.
    stage_name str
    The stage name of the Backend Model. Valid values: RELEASE, PRE, TEST.
    description str
    The description of the Backend Model.
    backendId String
    The ID of the Backend.
    backendModelData String
    The backend model data in JSON format. The structure varies by backendType. See CreateBackendModel for more details.
    backendType String
    The type of the Backend. Valid values: HTTP, VPC, FC_EVENT, FC_EVENT_V3, FC_HTTP, FC_HTTP_V3, OSS, MOCK, EVENTBRIDGE.
    stageName String
    The stage name of the Backend Model. Valid values: RELEASE, PRE, TEST.
    description String
    The description of the Backend Model.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the BackendModel resource produces the following output properties:

    BackendModelId string
    The ID of the Backend Model.
    Id string
    The provider-assigned unique ID for this managed resource.
    BackendModelId string
    The ID of the Backend Model.
    Id string
    The provider-assigned unique ID for this managed resource.
    backend_model_id string
    The ID of the Backend Model.
    id string
    The provider-assigned unique ID for this managed resource.
    backendModelId String
    The ID of the Backend Model.
    id String
    The provider-assigned unique ID for this managed resource.
    backendModelId string
    The ID of the Backend Model.
    id string
    The provider-assigned unique ID for this managed resource.
    backend_model_id str
    The ID of the Backend Model.
    id str
    The provider-assigned unique ID for this managed resource.
    backendModelId String
    The ID of the Backend Model.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing BackendModel Resource

    Get an existing BackendModel resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: BackendModelState, opts?: CustomResourceOptions): BackendModel
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            backend_id: Optional[str] = None,
            backend_model_data: Optional[str] = None,
            backend_model_id: Optional[str] = None,
            backend_type: Optional[str] = None,
            description: Optional[str] = None,
            stage_name: Optional[str] = None) -> BackendModel
    func GetBackendModel(ctx *Context, name string, id IDInput, state *BackendModelState, opts ...ResourceOption) (*BackendModel, error)
    public static BackendModel Get(string name, Input<string> id, BackendModelState? state, CustomResourceOptions? opts = null)
    public static BackendModel get(String name, Output<String> id, BackendModelState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:apigateway:BackendModel    get:      id: ${id}
    import {
      to = alicloud_apigateway_backendmodel.example
      id = "${id}"
    }
    
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    BackendId string
    The ID of the Backend.
    BackendModelData string
    The backend model data in JSON format. The structure varies by backendType. See CreateBackendModel for more details.
    BackendModelId string
    The ID of the Backend Model.
    BackendType string
    The type of the Backend. Valid values: HTTP, VPC, FC_EVENT, FC_EVENT_V3, FC_HTTP, FC_HTTP_V3, OSS, MOCK, EVENTBRIDGE.
    Description string
    The description of the Backend Model.
    StageName string
    The stage name of the Backend Model. Valid values: RELEASE, PRE, TEST.
    BackendId string
    The ID of the Backend.
    BackendModelData string
    The backend model data in JSON format. The structure varies by backendType. See CreateBackendModel for more details.
    BackendModelId string
    The ID of the Backend Model.
    BackendType string
    The type of the Backend. Valid values: HTTP, VPC, FC_EVENT, FC_EVENT_V3, FC_HTTP, FC_HTTP_V3, OSS, MOCK, EVENTBRIDGE.
    Description string
    The description of the Backend Model.
    StageName string
    The stage name of the Backend Model. Valid values: RELEASE, PRE, TEST.
    backend_id string
    The ID of the Backend.
    backend_model_data string
    The backend model data in JSON format. The structure varies by backendType. See CreateBackendModel for more details.
    backend_model_id string
    The ID of the Backend Model.
    backend_type string
    The type of the Backend. Valid values: HTTP, VPC, FC_EVENT, FC_EVENT_V3, FC_HTTP, FC_HTTP_V3, OSS, MOCK, EVENTBRIDGE.
    description string
    The description of the Backend Model.
    stage_name string
    The stage name of the Backend Model. Valid values: RELEASE, PRE, TEST.
    backendId String
    The ID of the Backend.
    backendModelData String
    The backend model data in JSON format. The structure varies by backendType. See CreateBackendModel for more details.
    backendModelId String
    The ID of the Backend Model.
    backendType String
    The type of the Backend. Valid values: HTTP, VPC, FC_EVENT, FC_EVENT_V3, FC_HTTP, FC_HTTP_V3, OSS, MOCK, EVENTBRIDGE.
    description String
    The description of the Backend Model.
    stageName String
    The stage name of the Backend Model. Valid values: RELEASE, PRE, TEST.
    backendId string
    The ID of the Backend.
    backendModelData string
    The backend model data in JSON format. The structure varies by backendType. See CreateBackendModel for more details.
    backendModelId string
    The ID of the Backend Model.
    backendType string
    The type of the Backend. Valid values: HTTP, VPC, FC_EVENT, FC_EVENT_V3, FC_HTTP, FC_HTTP_V3, OSS, MOCK, EVENTBRIDGE.
    description string
    The description of the Backend Model.
    stageName string
    The stage name of the Backend Model. Valid values: RELEASE, PRE, TEST.
    backend_id str
    The ID of the Backend.
    backend_model_data str
    The backend model data in JSON format. The structure varies by backendType. See CreateBackendModel for more details.
    backend_model_id str
    The ID of the Backend Model.
    backend_type str
    The type of the Backend. Valid values: HTTP, VPC, FC_EVENT, FC_EVENT_V3, FC_HTTP, FC_HTTP_V3, OSS, MOCK, EVENTBRIDGE.
    description str
    The description of the Backend Model.
    stage_name str
    The stage name of the Backend Model. Valid values: RELEASE, PRE, TEST.
    backendId String
    The ID of the Backend.
    backendModelData String
    The backend model data in JSON format. The structure varies by backendType. See CreateBackendModel for more details.
    backendModelId String
    The ID of the Backend Model.
    backendType String
    The type of the Backend. Valid values: HTTP, VPC, FC_EVENT, FC_EVENT_V3, FC_HTTP, FC_HTTP_V3, OSS, MOCK, EVENTBRIDGE.
    description String
    The description of the Backend Model.
    stageName String
    The stage name of the Backend Model. Valid values: RELEASE, PRE, TEST.

    Import

    Api Gateway Backend Model can be imported using the id, e.g.

    $ pulumi import alicloud:apigateway/backendModel:BackendModel example <backend_id>:<stage_name>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Viewing docs for Alibaba Cloud v3.104.0
    published on Thursday, Jun 25, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial