Alibaba Cloud v3.88.0 published on Saturday, Nov 1, 2025 by Pulumi
alicloud.apigateway.getModels
Start a Neo task
Explain and create an alicloud.apigateway.getModels resource
This data source provides the Api Gateway Models of the current Alibaba Cloud user.
NOTE: Available in v1.187.0+.
Example Usage
Basic Usage
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);
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)
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
})
}
using System.Collections.Generic;
using System.Linq;
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 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.models()[0].id());
final var groupId = ApigatewayFunctions.getModels(GetModelsArgs.builder()
.groupId("example_group_id")
.build());
ctx.export("apiGatewayModelId2", 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)
public static Output<GetModelsResult> getModels(GetModelsArgs args, InvokeOptions options)
fn::invoke:
function: alicloud:apigateway/getModels:getModels
arguments:
# arguments dictionaryThe following arguments are supported:
- Group
Id string - The ID of the api group.
- Ids List<string>
- A list of Model IDs.
- Model
Name string - The name of the Model.
- Name
Regex string - A regex string to filter results by Model name.
- Output
File string - File name where to save data source results (after running
pulumi preview). - Page
Number int - Page
Size int
- Group
Id string - The ID of the api group.
- Ids []string
- A list of Model IDs.
- Model
Name string - The name of the Model.
- Name
Regex string - A regex string to filter results by Model name.
- Output
File string - File name where to save data source results (after running
pulumi preview). - Page
Number int - Page
Size int
- group
Id String - The ID of the api group.
- ids List<String>
- A list of Model IDs.
- model
Name String - The name of the Model.
- name
Regex String - A regex string to filter results by Model name.
- output
File String - File name where to save data source results (after running
pulumi preview). - page
Number Integer - page
Size Integer
- group
Id string - The ID of the api group.
- ids string[]
- A list of Model IDs.
- model
Name string - The name of the Model.
- name
Regex string - A regex string to filter results by Model name.
- output
File string - File name where to save data source results (after running
pulumi preview). - page
Number number - page
Size 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 - File name where to save data source results (after running
pulumi preview). - page_
number int - page_
size int
- group
Id String - The ID of the api group.
- ids List<String>
- A list of Model IDs.
- model
Name String - The name of the Model.
- name
Regex String - A regex string to filter results by Model name.
- output
File String - File name where to save data source results (after running
pulumi preview). - page
Number Number - page
Size Number
getModels Result
The following output properties are available:
- Group
Id 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.
Ali Cloud. Api Gateway. Outputs. Get Models Model> - A list of Api Gateway Models. Each element contains the following attributes:
- Names List<string>
- A list of Model names.
- Model
Name string - The name of the Model.
- Name
Regex string - Output
File string - Page
Number int - Page
Size int
- Group
Id string - The group of the model belongs to.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- Models
[]Get
Models Model - A list of Api Gateway Models. Each element contains the following attributes:
- Names []string
- A list of Model names.
- Model
Name string - The name of the Model.
- Name
Regex string - Output
File string - Page
Number int - Page
Size int
- group
Id String - The group of the model belongs to.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- models
List<Get
Models Model> - A list of Api Gateway Models. Each element contains the following attributes:
- names List<String>
- A list of Model names.
- model
Name String - The name of the Model.
- name
Regex String - output
File String - page
Number Integer - page
Size Integer
- group
Id string - The group of the model belongs to.
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- models
Get
Models Model[] - A list of Api Gateway Models. Each element contains the following attributes:
- names string[]
- A list of Model names.
- model
Name string - The name of the Model.
- name
Regex string - output
File string - page
Number number - page
Size 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[Get
Models Model] - 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
- group
Id 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.
- model
Name String - The name of the Model.
- name
Regex String - output
File String - page
Number Number - page
Size Number
Supporting Types
GetModelsModel
- Create
Time string - The creation time of the model.
- Description string
- The description of the model.
- Group
Id string - The ID of the api group.
- Id string
- The ID of the Api Gateway Model.
- Model
Id string - The id of the model.
- Model
Name string - The name of the Model.
- Model
Ref string - The reference of the model.
- Modified
Time string - The modified time of the model.
- Schema string
- The schema of the model.
- Create
Time string - The creation time of the model.
- Description string
- The description of the model.
- Group
Id string - The ID of the api group.
- Id string
- The ID of the Api Gateway Model.
- Model
Id string - The id of the model.
- Model
Name string - The name of the Model.
- Model
Ref string - The reference of the model.
- Modified
Time string - The modified time of the model.
- Schema string
- The schema of the model.
- create
Time String - The creation time of the model.
- description String
- The description of the model.
- group
Id String - The ID of the api group.
- id String
- The ID of the Api Gateway Model.
- model
Id String - The id of the model.
- model
Name String - The name of the Model.
- model
Ref String - The reference of the model.
- modified
Time String - The modified time of the model.
- schema String
- The schema of the model.
- create
Time string - The creation time of the model.
- description string
- The description of the model.
- group
Id string - The ID of the api group.
- id string
- The ID of the Api Gateway Model.
- model
Id string - The id of the model.
- model
Name string - The name of the Model.
- model
Ref string - The reference of the model.
- modified
Time 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.
- create
Time String - The creation time of the model.
- description String
- The description of the model.
- group
Id String - The ID of the api group.
- id String
- The ID of the Api Gateway Model.
- model
Id String - The id of the model.
- model
Name String - The name of the Model.
- model
Ref String - The reference of the model.
- modified
Time 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
alicloudTerraform Provider.
