1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. apigateway
  5. Model
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.apigateway.Model

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

    Provides a Api Gateway Model resource.

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

    NOTE: Available since v1.187.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const _default = new alicloud.apigateway.Group("default", {
        name: "example_value",
        description: "example_value",
    });
    const defaultModel = new alicloud.apigateway.Model("default", {
        groupId: _default.id,
        modelName: "example_value",
        schema: "{\"type\":\"object\",\"properties\":{\"id\":{\"format\":\"int64\",\"maximum\":100,\"exclusiveMaximum\":true,\"type\":\"integer\"},\"name\":{\"maxLength\":10,\"type\":\"string\"}}}",
        description: "example_value",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    default = alicloud.apigateway.Group("default",
        name="example_value",
        description="example_value")
    default_model = alicloud.apigateway.Model("default",
        group_id=default.id,
        model_name="example_value",
        schema="{\"type\":\"object\",\"properties\":{\"id\":{\"format\":\"int64\",\"maximum\":100,\"exclusiveMaximum\":true,\"type\":\"integer\"},\"name\":{\"maxLength\":10,\"type\":\"string\"}}}",
        description="example_value")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/apigateway"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := apigateway.NewGroup(ctx, "default", &apigateway.GroupArgs{
    			Name:        pulumi.String("example_value"),
    			Description: pulumi.String("example_value"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = apigateway.NewModel(ctx, "default", &apigateway.ModelArgs{
    			GroupId:     _default.ID(),
    			ModelName:   pulumi.String("example_value"),
    			Schema:      pulumi.String("{\"type\":\"object\",\"properties\":{\"id\":{\"format\":\"int64\",\"maximum\":100,\"exclusiveMaximum\":true,\"type\":\"integer\"},\"name\":{\"maxLength\":10,\"type\":\"string\"}}}"),
    			Description: pulumi.String("example_value"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = new AliCloud.ApiGateway.Group("default", new()
        {
            Name = "example_value",
            Description = "example_value",
        });
    
        var defaultModel = new AliCloud.ApiGateway.Model("default", new()
        {
            GroupId = @default.Id,
            ModelName = "example_value",
            Schema = "{\"type\":\"object\",\"properties\":{\"id\":{\"format\":\"int64\",\"maximum\":100,\"exclusiveMaximum\":true,\"type\":\"integer\"},\"name\":{\"maxLength\":10,\"type\":\"string\"}}}",
            Description = "example_value",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.apigateway.Group;
    import com.pulumi.alicloud.apigateway.GroupArgs;
    import com.pulumi.alicloud.apigateway.Model;
    import com.pulumi.alicloud.apigateway.ModelArgs;
    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 default_ = new Group("default", GroupArgs.builder()
                .name("example_value")
                .description("example_value")
                .build());
    
            var defaultModel = new Model("defaultModel", ModelArgs.builder()
                .groupId(default_.id())
                .modelName("example_value")
                .schema("{\"type\":\"object\",\"properties\":{\"id\":{\"format\":\"int64\",\"maximum\":100,\"exclusiveMaximum\":true,\"type\":\"integer\"},\"name\":{\"maxLength\":10,\"type\":\"string\"}}}")
                .description("example_value")
                .build());
    
        }
    }
    
    resources:
      default:
        type: alicloud:apigateway:Group
        properties:
          name: example_value
          description: example_value
      defaultModel:
        type: alicloud:apigateway:Model
        name: default
        properties:
          groupId: ${default.id}
          modelName: example_value
          schema: '{"type":"object","properties":{"id":{"format":"int64","maximum":100,"exclusiveMaximum":true,"type":"integer"},"name":{"maxLength":10,"type":"string"}}}'
          description: example_value
    

    Create Model Resource

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

    Constructor syntax

    new Model(name: string, args: ModelArgs, opts?: CustomResourceOptions);
    @overload
    def Model(resource_name: str,
              args: ModelArgs,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def Model(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              group_id: Optional[str] = None,
              model_name: Optional[str] = None,
              schema: Optional[str] = None,
              description: Optional[str] = None)
    func NewModel(ctx *Context, name string, args ModelArgs, opts ...ResourceOption) (*Model, error)
    public Model(string name, ModelArgs args, CustomResourceOptions? opts = null)
    public Model(String name, ModelArgs args)
    public Model(String name, ModelArgs args, CustomResourceOptions options)
    
    type: alicloud:apigateway:Model
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ModelArgs
    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 ModelArgs
    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 ModelArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ModelArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ModelArgs
    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 modelResource = new AliCloud.ApiGateway.Model("modelResource", new()
    {
        GroupId = "string",
        ModelName = "string",
        Schema = "string",
        Description = "string",
    });
    
    example, err := apigateway.NewModel(ctx, "modelResource", &apigateway.ModelArgs{
    	GroupId:     pulumi.String("string"),
    	ModelName:   pulumi.String("string"),
    	Schema:      pulumi.String("string"),
    	Description: pulumi.String("string"),
    })
    
    var modelResource = new Model("modelResource", ModelArgs.builder()
        .groupId("string")
        .modelName("string")
        .schema("string")
        .description("string")
        .build());
    
    model_resource = alicloud.apigateway.Model("modelResource",
        group_id="string",
        model_name="string",
        schema="string",
        description="string")
    
    const modelResource = new alicloud.apigateway.Model("modelResource", {
        groupId: "string",
        modelName: "string",
        schema: "string",
        description: "string",
    });
    
    type: alicloud:apigateway:Model
    properties:
        description: string
        groupId: string
        modelName: string
        schema: string
    

    Model 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 Model resource accepts the following input properties:

    GroupId string
    The group of the model belongs to.
    ModelName string
    The name of the model.
    Schema string
    The schema of the model.
    Description string
    The description of the model.
    GroupId string
    The group of the model belongs to.
    ModelName string
    The name of the model.
    Schema string
    The schema of the model.
    Description string
    The description of the model.
    groupId String
    The group of the model belongs to.
    modelName String
    The name of the model.
    schema String
    The schema of the model.
    description String
    The description of the model.
    groupId string
    The group of the model belongs to.
    modelName string
    The name of the model.
    schema string
    The schema of the model.
    description string
    The description of the model.
    group_id str
    The group of the model belongs to.
    model_name str
    The name of the model.
    schema str
    The schema of the model.
    description str
    The description of the model.
    groupId String
    The group of the model belongs to.
    modelName String
    The name of the model.
    schema String
    The schema of the model.
    description String
    The description of the model.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Model Resource

    Get an existing Model 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?: ModelState, opts?: CustomResourceOptions): Model
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            group_id: Optional[str] = None,
            model_name: Optional[str] = None,
            schema: Optional[str] = None) -> Model
    func GetModel(ctx *Context, name string, id IDInput, state *ModelState, opts ...ResourceOption) (*Model, error)
    public static Model Get(string name, Input<string> id, ModelState? state, CustomResourceOptions? opts = null)
    public static Model get(String name, Output<String> id, ModelState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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:
    Description string
    The description of the model.
    GroupId string
    The group of the model belongs to.
    ModelName string
    The name of the model.
    Schema string
    The schema of the model.
    Description string
    The description of the model.
    GroupId string
    The group of the model belongs to.
    ModelName string
    The name of the model.
    Schema string
    The schema of the model.
    description String
    The description of the model.
    groupId String
    The group of the model belongs to.
    modelName String
    The name of the model.
    schema String
    The schema of the model.
    description string
    The description of the model.
    groupId string
    The group of the model belongs to.
    modelName string
    The name of the model.
    schema string
    The schema of the model.
    description str
    The description of the model.
    group_id str
    The group of the model belongs to.
    model_name str
    The name of the model.
    schema str
    The schema of the model.
    description String
    The description of the model.
    groupId String
    The group of the model belongs to.
    modelName String
    The name of the model.
    schema String
    The schema of the model.

    Import

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

    $ pulumi import alicloud:apigateway/model:Model example <group_id>:<model_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
    Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi