alicloud logo
Alibaba Cloud v3.34.0, Mar 17 23

alicloud.apigateway.getModels

This data source provides the Api Gateway Models of the current Alibaba Cloud user.

NOTE: Available in v1.187.0+.

Example Usage

Basic Usage

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var ids = AliCloud.ApiGateway.GetModels.Invoke(new()
    {
        Ids = new[]
        {
            "example_id",
        },
        GroupId = "example_group_id",
    });

    var groupId = AliCloud.ApiGateway.GetModels.Invoke(new()
    {
        GroupId = "example_group_id",
    });

    return new Dictionary<string, object?>
    {
        ["apiGatewayModelId1"] = ids.Apply(getModelsResult => getModelsResult.Models[0]?.Id),
        ["apiGatewayModelId2"] = groupId.Apply(getModelsResult => getModelsResult.Models[0]?.Id),
    };
});
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 {
		ids, err := apigateway.GetModels(ctx, &apigateway.GetModelsArgs{
			Ids: []string{
				"example_id",
			},
			GroupId: "example_group_id",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("apiGatewayModelId1", ids.Models[0].Id)
		groupId, err := apigateway.GetModels(ctx, &apigateway.GetModelsArgs{
			GroupId: "example_group_id",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("apiGatewayModelId2", groupId.Models[0].Id)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.apigateway.ApigatewayFunctions;
import com.pulumi.alicloud.apigateway.inputs.GetModelsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var ids = ApigatewayFunctions.getModels(GetModelsArgs.builder()
            .ids("example_id")
            .groupId("example_group_id")
            .build());

        ctx.export("apiGatewayModelId1", ids.applyValue(getModelsResult -> getModelsResult.models()[0].id()));
        final var groupId = ApigatewayFunctions.getModels(GetModelsArgs.builder()
            .groupId("example_group_id")
            .build());

        ctx.export("apiGatewayModelId2", groupId.applyValue(getModelsResult -> getModelsResult.models()[0].id()));
    }
}
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.apigateway.get_models(ids=["example_id"],
    group_id="example_group_id")
pulumi.export("apiGatewayModelId1", ids.models[0].id)
group_id = alicloud.apigateway.get_models(group_id="example_group_id")
pulumi.export("apiGatewayModelId2", group_id.models[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const ids = alicloud.apigateway.getModels({
    ids: ["example_id"],
    groupId: "example_group_id",
});
export const apiGatewayModelId1 = ids.then(ids => ids.models?.[0]?.id);
const groupId = alicloud.apigateway.getModels({
    groupId: "example_group_id",
});
export const apiGatewayModelId2 = groupId.then(groupId => groupId.models?.[0]?.id);
variables:
  ids:
    fn::invoke:
      Function: alicloud:apigateway:getModels
      Arguments:
        ids:
          - example_id
        groupId: example_group_id
  groupId:
    fn::invoke:
      Function: alicloud:apigateway:getModels
      Arguments:
        groupId: example_group_id
outputs:
  apiGatewayModelId1: ${ids.models[0].id}
  apiGatewayModelId2: ${groupId.models[0].id}

Using getModels

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getModels(args: GetModelsArgs, opts?: InvokeOptions): Promise<GetModelsResult>
function getModelsOutput(args: GetModelsOutputArgs, opts?: InvokeOptions): Output<GetModelsResult>
def get_models(group_id: Optional[str] = None,
               ids: Optional[Sequence[str]] = None,
               model_name: Optional[str] = None,
               name_regex: Optional[str] = None,
               output_file: Optional[str] = None,
               page_number: Optional[int] = None,
               page_size: Optional[int] = None,
               opts: Optional[InvokeOptions] = None) -> GetModelsResult
def get_models_output(group_id: Optional[pulumi.Input[str]] = None,
               ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
               model_name: Optional[pulumi.Input[str]] = None,
               name_regex: Optional[pulumi.Input[str]] = None,
               output_file: Optional[pulumi.Input[str]] = None,
               page_number: Optional[pulumi.Input[int]] = None,
               page_size: Optional[pulumi.Input[int]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetModelsResult]
func GetModels(ctx *Context, args *GetModelsArgs, opts ...InvokeOption) (*GetModelsResult, error)
func GetModelsOutput(ctx *Context, args *GetModelsOutputArgs, opts ...InvokeOption) GetModelsResultOutput

> Note: This function is named GetModels in the Go SDK.

public static class GetModels 
{
    public static Task<GetModelsResult> InvokeAsync(GetModelsArgs args, InvokeOptions? opts = null)
    public static Output<GetModelsResult> Invoke(GetModelsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetModelsResult> getModels(GetModelsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: alicloud:apigateway/getModels:getModels
  arguments:
    # arguments dictionary

The following arguments are supported:

GroupId string

The ID of the api group.

Ids List<string>

A list of Model IDs.

ModelName string

The name of the Model.

NameRegex string

A regex string to filter results by Model name.

OutputFile string
PageNumber int
PageSize int
GroupId string

The ID of the api group.

Ids []string

A list of Model IDs.

ModelName string

The name of the Model.

NameRegex string

A regex string to filter results by Model name.

OutputFile string
PageNumber int
PageSize int
groupId String

The ID of the api group.

ids List<String>

A list of Model IDs.

modelName String

The name of the Model.

nameRegex String

A regex string to filter results by Model name.

outputFile String
pageNumber Integer
pageSize Integer
groupId string

The ID of the api group.

ids string[]

A list of Model IDs.

modelName string

The name of the Model.

nameRegex string

A regex string to filter results by Model name.

outputFile string
pageNumber number
pageSize number
group_id str

The ID of the api group.

ids Sequence[str]

A list of Model IDs.

model_name str

The name of the Model.

name_regex str

A regex string to filter results by Model name.

output_file str
page_number int
page_size int
groupId String

The ID of the api group.

ids List<String>

A list of Model IDs.

modelName String

The name of the Model.

nameRegex String

A regex string to filter results by Model name.

outputFile String
pageNumber Number
pageSize Number

getModels Result

The following output properties are available:

GroupId string

The group of the model belongs to.

Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>
Models List<Pulumi.AliCloud.ApiGateway.Outputs.GetModelsModel>

A list of Api Gateway Models. Each element contains the following attributes:

Names List<string>

A list of Model names.

ModelName string

The name of the Model.

NameRegex string
OutputFile string
PageNumber int
PageSize int
GroupId string

The group of the model belongs to.

Id string

The provider-assigned unique ID for this managed resource.

Ids []string
Models []GetModelsModel

A list of Api Gateway Models. Each element contains the following attributes:

Names []string

A list of Model names.

ModelName string

The name of the Model.

NameRegex string
OutputFile string
PageNumber int
PageSize int
groupId String

The group of the model belongs to.

id String

The provider-assigned unique ID for this managed resource.

ids List<String>
models List<GetModelsModel>

A list of Api Gateway Models. Each element contains the following attributes:

names List<String>

A list of Model names.

modelName String

The name of the Model.

nameRegex String
outputFile String
pageNumber Integer
pageSize Integer
groupId string

The group of the model belongs to.

id string

The provider-assigned unique ID for this managed resource.

ids string[]
models GetModelsModel[]

A list of Api Gateway Models. Each element contains the following attributes:

names string[]

A list of Model names.

modelName string

The name of the Model.

nameRegex string
outputFile string
pageNumber number
pageSize number
group_id str

The group of the model belongs to.

id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]
models Sequence[GetModelsModel]

A list of Api Gateway Models. Each element contains the following attributes:

names Sequence[str]

A list of Model names.

model_name str

The name of the Model.

name_regex str
output_file str
page_number int
page_size int
groupId String

The group of the model belongs to.

id String

The provider-assigned unique ID for this managed resource.

ids List<String>
models List<Property Map>

A list of Api Gateway Models. Each element contains the following attributes:

names List<String>

A list of Model names.

modelName String

The name of the Model.

nameRegex String
outputFile String
pageNumber Number
pageSize Number

Supporting Types

GetModelsModel

CreateTime string

The creation time of the model.

Description string

The description of the model.

GroupId string

The ID of the api group.

Id string

The ID of the Api Gateway Model.

ModelId string

The id of the model.

ModelName string

The name of the Model.

ModelRef string

The reference of the model.

ModifiedTime string

The modified time of the model.

Schema string

The schema of the model.

CreateTime string

The creation time of the model.

Description string

The description of the model.

GroupId string

The ID of the api group.

Id string

The ID of the Api Gateway Model.

ModelId string

The id of the model.

ModelName string

The name of the Model.

ModelRef string

The reference of the model.

ModifiedTime string

The modified time of the model.

Schema string

The schema of the model.

createTime String

The creation time of the model.

description String

The description of the model.

groupId String

The ID of the api group.

id String

The ID of the Api Gateway Model.

modelId String

The id of the model.

modelName String

The name of the Model.

modelRef String

The reference of the model.

modifiedTime String

The modified time of the model.

schema String

The schema of the model.

createTime string

The creation time of the model.

description string

The description of the model.

groupId string

The ID of the api group.

id string

The ID of the Api Gateway Model.

modelId string

The id of the model.

modelName string

The name of the Model.

modelRef string

The reference of the model.

modifiedTime string

The modified time of the model.

schema string

The schema of the model.

create_time str

The creation time of the model.

description str

The description of the model.

group_id str

The ID of the api group.

id str

The ID of the Api Gateway Model.

model_id str

The id of the model.

model_name str

The name of the Model.

model_ref str

The reference of the model.

modified_time str

The modified time of the model.

schema str

The schema of the model.

createTime String

The creation time of the model.

description String

The description of the model.

groupId String

The ID of the api group.

id String

The ID of the Api Gateway Model.

modelId String

The id of the model.

modelName String

The name of the Model.

modelRef String

The reference of the model.

modifiedTime String

The modified time of the model.

schema String

The schema of the model.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.