Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi
alicloud.apigateway.getApis
Explore with Pulumi AI
This data source provides the Api Gateway APIs of the current Alibaba Cloud user.
NOTE: Available since v1.22.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") || "terraform-example";
const _default = new alicloud.apigateway.Group("default", {
name: name,
description: name,
});
const defaultApi = new alicloud.apigateway.Api("default", {
groupId: _default.id,
name: name,
description: name,
authType: "APP",
serviceType: "HTTP",
requestConfig: {
protocol: "HTTP",
method: "GET",
path: "/test/path",
mode: "MAPPING",
},
httpServiceConfig: {
address: "http://apigateway-backend.alicloudapi.com:8080",
method: "GET",
path: "/web/cloudapi",
timeout: 20,
aoneName: "cloudapi-openapi",
},
requestParameters: [{
name: name,
type: "STRING",
required: "OPTIONAL",
"in": "QUERY",
inService: "QUERY",
nameService: name,
}],
});
const ids = alicloud.apigateway.getApisOutput({
ids: [defaultApi.id],
});
export const apiGatewayApisId0 = ids.apply(ids => ids.apis?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = alicloud.apigateway.Group("default",
name=name,
description=name)
default_api = alicloud.apigateway.Api("default",
group_id=default.id,
name=name,
description=name,
auth_type="APP",
service_type="HTTP",
request_config=alicloud.apigateway.ApiRequestConfigArgs(
protocol="HTTP",
method="GET",
path="/test/path",
mode="MAPPING",
),
http_service_config=alicloud.apigateway.ApiHttpServiceConfigArgs(
address="http://apigateway-backend.alicloudapi.com:8080",
method="GET",
path="/web/cloudapi",
timeout=20,
aone_name="cloudapi-openapi",
),
request_parameters=[alicloud.apigateway.ApiRequestParameterArgs(
name=name,
type="STRING",
required="OPTIONAL",
in_="QUERY",
in_service="QUERY",
name_service=name,
)])
ids = alicloud.apigateway.get_apis_output(ids=[default_api.id])
pulumi.export("apiGatewayApisId0", ids.apis[0].id)
package main
import (
"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 := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_, err := apigateway.NewGroup(ctx, "default", &apigateway.GroupArgs{
Name: pulumi.String(name),
Description: pulumi.String(name),
})
if err != nil {
return err
}
defaultApi, err := apigateway.NewApi(ctx, "default", &apigateway.ApiArgs{
GroupId: _default.ID(),
Name: pulumi.String(name),
Description: pulumi.String(name),
AuthType: pulumi.String("APP"),
ServiceType: pulumi.String("HTTP"),
RequestConfig: &apigateway.ApiRequestConfigArgs{
Protocol: pulumi.String("HTTP"),
Method: pulumi.String("GET"),
Path: pulumi.String("/test/path"),
Mode: pulumi.String("MAPPING"),
},
HttpServiceConfig: &apigateway.ApiHttpServiceConfigArgs{
Address: pulumi.String("http://apigateway-backend.alicloudapi.com:8080"),
Method: pulumi.String("GET"),
Path: pulumi.String("/web/cloudapi"),
Timeout: pulumi.Int(20),
AoneName: pulumi.String("cloudapi-openapi"),
},
RequestParameters: apigateway.ApiRequestParameterArray{
&apigateway.ApiRequestParameterArgs{
Name: pulumi.String(name),
Type: pulumi.String("STRING"),
Required: pulumi.String("OPTIONAL"),
In: pulumi.String("QUERY"),
InService: pulumi.String("QUERY"),
NameService: pulumi.String(name),
},
},
})
if err != nil {
return err
}
ids := apigateway.GetApisOutput(ctx, apigateway.GetApisOutputArgs{
Ids: pulumi.StringArray{
defaultApi.ID(),
},
}, nil)
ctx.Export("apiGatewayApisId0", ids.ApplyT(func(ids apigateway.GetApisResult) (*string, error) {
return &ids.Apis[0].Id, nil
}).(pulumi.StringPtrOutput))
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var @default = new AliCloud.ApiGateway.Group("default", new()
{
Name = name,
Description = name,
});
var defaultApi = new AliCloud.ApiGateway.Api("default", new()
{
GroupId = @default.Id,
Name = name,
Description = name,
AuthType = "APP",
ServiceType = "HTTP",
RequestConfig = new AliCloud.ApiGateway.Inputs.ApiRequestConfigArgs
{
Protocol = "HTTP",
Method = "GET",
Path = "/test/path",
Mode = "MAPPING",
},
HttpServiceConfig = new AliCloud.ApiGateway.Inputs.ApiHttpServiceConfigArgs
{
Address = "http://apigateway-backend.alicloudapi.com:8080",
Method = "GET",
Path = "/web/cloudapi",
Timeout = 20,
AoneName = "cloudapi-openapi",
},
RequestParameters = new[]
{
new AliCloud.ApiGateway.Inputs.ApiRequestParameterArgs
{
Name = name,
Type = "STRING",
Required = "OPTIONAL",
In = "QUERY",
InService = "QUERY",
NameService = name,
},
},
});
var ids = AliCloud.ApiGateway.GetApis.Invoke(new()
{
Ids = new[]
{
defaultApi.Id,
},
});
return new Dictionary<string, object?>
{
["apiGatewayApisId0"] = ids.Apply(getApisResult => getApisResult.Apis[0]?.Id),
};
});
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.Api;
import com.pulumi.alicloud.apigateway.ApiArgs;
import com.pulumi.alicloud.apigateway.inputs.ApiRequestConfigArgs;
import com.pulumi.alicloud.apigateway.inputs.ApiHttpServiceConfigArgs;
import com.pulumi.alicloud.apigateway.inputs.ApiRequestParameterArgs;
import com.pulumi.alicloud.apigateway.ApigatewayFunctions;
import com.pulumi.alicloud.apigateway.inputs.GetApisArgs;
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 config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
var default_ = new Group("default", GroupArgs.builder()
.name(name)
.description(name)
.build());
var defaultApi = new Api("defaultApi", ApiArgs.builder()
.groupId(default_.id())
.name(name)
.description(name)
.authType("APP")
.serviceType("HTTP")
.requestConfig(ApiRequestConfigArgs.builder()
.protocol("HTTP")
.method("GET")
.path("/test/path")
.mode("MAPPING")
.build())
.httpServiceConfig(ApiHttpServiceConfigArgs.builder()
.address("http://apigateway-backend.alicloudapi.com:8080")
.method("GET")
.path("/web/cloudapi")
.timeout(20)
.aoneName("cloudapi-openapi")
.build())
.requestParameters(ApiRequestParameterArgs.builder()
.name(name)
.type("STRING")
.required("OPTIONAL")
.in("QUERY")
.inService("QUERY")
.nameService(name)
.build())
.build());
final var ids = ApigatewayFunctions.getApis(GetApisArgs.builder()
.ids(defaultApi.id())
.build());
ctx.export("apiGatewayApisId0", ids.applyValue(getApisResult -> getApisResult).applyValue(ids -> ids.applyValue(getApisResult -> getApisResult.apis()[0].id())));
}
}
configuration:
name:
type: string
default: terraform-example
resources:
default:
type: alicloud:apigateway:Group
properties:
name: ${name}
description: ${name}
defaultApi:
type: alicloud:apigateway:Api
name: default
properties:
groupId: ${default.id}
name: ${name}
description: ${name}
authType: APP
serviceType: HTTP
requestConfig:
protocol: HTTP
method: GET
path: /test/path
mode: MAPPING
httpServiceConfig:
address: http://apigateway-backend.alicloudapi.com:8080
method: GET
path: /web/cloudapi
timeout: 20
aoneName: cloudapi-openapi
requestParameters:
- name: ${name}
type: STRING
required: OPTIONAL
in: QUERY
inService: QUERY
nameService: ${name}
variables:
ids:
fn::invoke:
Function: alicloud:apigateway:getApis
Arguments:
ids:
- ${defaultApi.id}
outputs:
apiGatewayApisId0: ${ids.apis[0].id}
Using getApis
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 getApis(args: GetApisArgs, opts?: InvokeOptions): Promise<GetApisResult>
function getApisOutput(args: GetApisOutputArgs, opts?: InvokeOptions): Output<GetApisResult>
def get_apis(api_id: Optional[str] = None,
group_id: Optional[str] = None,
ids: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetApisResult
def get_apis_output(api_id: Optional[pulumi.Input[str]] = None,
group_id: Optional[pulumi.Input[str]] = None,
ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name_regex: Optional[pulumi.Input[str]] = None,
output_file: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetApisResult]
func GetApis(ctx *Context, args *GetApisArgs, opts ...InvokeOption) (*GetApisResult, error)
func GetApisOutput(ctx *Context, args *GetApisOutputArgs, opts ...InvokeOption) GetApisResultOutput
> Note: This function is named GetApis
in the Go SDK.
public static class GetApis
{
public static Task<GetApisResult> InvokeAsync(GetApisArgs args, InvokeOptions? opts = null)
public static Output<GetApisResult> Invoke(GetApisInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetApisResult> getApis(GetApisArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: alicloud:apigateway/getApis:getApis
arguments:
# arguments dictionary
The following arguments are supported:
- Api
Id string - The ID of the API.
- Group
Id string - The ID of the API group.
- Ids List<string>
- A list of API IDs.
- Name
Regex string - A regex string to filter results by API name.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- Api
Id string - The ID of the API.
- Group
Id string - The ID of the API group.
- Ids []string
- A list of API IDs.
- Name
Regex string - A regex string to filter results by API name.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- api
Id String - The ID of the API.
- group
Id String - The ID of the API group.
- ids List<String>
- A list of API IDs.
- name
Regex String - A regex string to filter results by API name.
- output
File String - File name where to save data source results (after running
pulumi preview
).
- api
Id string - The ID of the API.
- group
Id string - The ID of the API group.
- ids string[]
- A list of API IDs.
- name
Regex string - A regex string to filter results by API name.
- output
File string - File name where to save data source results (after running
pulumi preview
).
- api_
id str - The ID of the API.
- group_
id str - The ID of the API group.
- ids Sequence[str]
- A list of API IDs.
- name_
regex str - A regex string to filter results by API name.
- output_
file str - File name where to save data source results (after running
pulumi preview
).
- api
Id String - The ID of the API.
- group
Id String - The ID of the API group.
- ids List<String>
- A list of API IDs.
- name
Regex String - A regex string to filter results by API name.
- output
File String - File name where to save data source results (after running
pulumi preview
).
getApis Result
The following output properties are available:
- Apis
List<Pulumi.
Ali Cloud. Api Gateway. Outputs. Get Apis Api> - A list of APIs. Each element contains the following attributes:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Names List<string>
- A list of API names.
- Api
Id string - (Available since v1.224.0) The ID of the API.
- Group
Id string - The ID of the API group.
- Name
Regex string - Output
File string
- Apis
[]Get
Apis Api - A list of APIs. Each element contains the following attributes:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- Names []string
- A list of API names.
- Api
Id string - (Available since v1.224.0) The ID of the API.
- Group
Id string - The ID of the API group.
- Name
Regex string - Output
File string
- apis
List<Get
Apis Api> - A list of APIs. Each element contains the following attributes:
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- A list of API names.
- api
Id String - (Available since v1.224.0) The ID of the API.
- group
Id String - The ID of the API group.
- name
Regex String - output
File String
- apis
Get
Apis Api[] - A list of APIs. Each element contains the following attributes:
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- names string[]
- A list of API names.
- api
Id string - (Available since v1.224.0) The ID of the API.
- group
Id string - The ID of the API group.
- name
Regex string - output
File string
- apis
Sequence[Get
Apis Api] - A list of APIs. Each element contains the following attributes:
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- names Sequence[str]
- A list of API names.
- api_
id str - (Available since v1.224.0) The ID of the API.
- group_
id str - The ID of the API group.
- name_
regex str - output_
file str
- apis List<Property Map>
- A list of APIs. Each element contains the following attributes:
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- A list of API names.
- api
Id String - (Available since v1.224.0) The ID of the API.
- group
Id String - The ID of the API group.
- name
Regex String - output
File String
Supporting Types
GetApisApi
- api_
id str - The ID of the API.
- description str
- The description of the API.
- group_
id str - The ID of the API group.
- group_
name str - The name of the API group.
- id str
- name str
- The name of the API.
- region_
id str - The region ID of the API.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.