1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. ecs
  5. CapacityReservation
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.ecs.CapacityReservation

Explore with Pulumi AI

Provides a Ecs Capacity Reservation resource.

For information about Ecs Capacity Reservation and how to use it, see What is Capacity Reservation.

NOTE: Available in v1.195.0+.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const _default = alicloud.ecs.getInstanceTypes({
    instanceTypeFamily: "ecs.g5",
});
const defaultGetZones = _default.then(_default => alicloud.getZones({
    availableResourceCreation: "Instance",
    availableInstanceType: _default.ids?.[0],
}));
const defaultGetResourceGroups = alicloud.resourcemanager.getResourceGroups({
    status: "OK",
});
const defaultCapacityReservation = new alicloud.ecs.CapacityReservation("default", {
    description: "terraform-example",
    platform: "linux",
    capacityReservationName: "terraform-example",
    endTimeType: "Unlimited",
    resourceGroupId: defaultGetResourceGroups.then(defaultGetResourceGroups => defaultGetResourceGroups.ids?.[0]),
    instanceAmount: 1,
    instanceType: _default.then(_default => _default.ids?.[0]),
    matchCriteria: "Open",
    tags: {
        Created: "terraform-example",
    },
    zoneIds: [defaultGetZones.then(defaultGetZones => defaultGetZones.zones?.[0]?.id)],
});
Copy
import pulumi
import pulumi_alicloud as alicloud

default = alicloud.ecs.get_instance_types(instance_type_family="ecs.g5")
default_get_zones = alicloud.get_zones(available_resource_creation="Instance",
    available_instance_type=default.ids[0])
default_get_resource_groups = alicloud.resourcemanager.get_resource_groups(status="OK")
default_capacity_reservation = alicloud.ecs.CapacityReservation("default",
    description="terraform-example",
    platform="linux",
    capacity_reservation_name="terraform-example",
    end_time_type="Unlimited",
    resource_group_id=default_get_resource_groups.ids[0],
    instance_amount=1,
    instance_type=default.ids[0],
    match_criteria="Open",
    tags={
        "Created": "terraform-example",
    },
    zone_ids=[default_get_zones.zones[0].id])
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := ecs.GetInstanceTypes(ctx, &ecs.GetInstanceTypesArgs{
			InstanceTypeFamily: pulumi.StringRef("ecs.g5"),
		}, nil)
		if err != nil {
			return err
		}
		defaultGetZones, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
			AvailableResourceCreation: pulumi.StringRef("Instance"),
			AvailableInstanceType:     pulumi.StringRef(_default.Ids[0]),
		}, nil)
		if err != nil {
			return err
		}
		defaultGetResourceGroups, err := resourcemanager.GetResourceGroups(ctx, &resourcemanager.GetResourceGroupsArgs{
			Status: pulumi.StringRef("OK"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = ecs.NewCapacityReservation(ctx, "default", &ecs.CapacityReservationArgs{
			Description:             pulumi.String("terraform-example"),
			Platform:                pulumi.String("linux"),
			CapacityReservationName: pulumi.String("terraform-example"),
			EndTimeType:             pulumi.String("Unlimited"),
			ResourceGroupId:         pulumi.String(defaultGetResourceGroups.Ids[0]),
			InstanceAmount:          pulumi.Int(1),
			InstanceType:            pulumi.String(_default.Ids[0]),
			MatchCriteria:           pulumi.String("Open"),
			Tags: pulumi.StringMap{
				"Created": pulumi.String("terraform-example"),
			},
			ZoneIds: pulumi.StringArray{
				pulumi.String(defaultGetZones.Zones[0].Id),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var @default = AliCloud.Ecs.GetInstanceTypes.Invoke(new()
    {
        InstanceTypeFamily = "ecs.g5",
    });

    var defaultGetZones = AliCloud.GetZones.Invoke(new()
    {
        AvailableResourceCreation = "Instance",
        AvailableInstanceType = @default.Apply(getInstanceTypesResult => getInstanceTypesResult.Ids[0]),
    });

    var defaultGetResourceGroups = AliCloud.ResourceManager.GetResourceGroups.Invoke(new()
    {
        Status = "OK",
    });

    var defaultCapacityReservation = new AliCloud.Ecs.CapacityReservation("default", new()
    {
        Description = "terraform-example",
        Platform = "linux",
        CapacityReservationName = "terraform-example",
        EndTimeType = "Unlimited",
        ResourceGroupId = defaultGetResourceGroups.Apply(getResourceGroupsResult => getResourceGroupsResult.Ids[0]),
        InstanceAmount = 1,
        InstanceType = @default.Apply(@default => @default.Apply(getInstanceTypesResult => getInstanceTypesResult.Ids[0])),
        MatchCriteria = "Open",
        Tags = 
        {
            { "Created", "terraform-example" },
        },
        ZoneIds = new[]
        {
            defaultGetZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetInstanceTypesArgs;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetZonesArgs;
import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
import com.pulumi.alicloud.resourcemanager.inputs.GetResourceGroupsArgs;
import com.pulumi.alicloud.ecs.CapacityReservation;
import com.pulumi.alicloud.ecs.CapacityReservationArgs;
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 default = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
            .instanceTypeFamily("ecs.g5")
            .build());

        final var defaultGetZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
            .availableResourceCreation("Instance")
            .availableInstanceType(default_.ids()[0])
            .build());

        final var defaultGetResourceGroups = ResourcemanagerFunctions.getResourceGroups(GetResourceGroupsArgs.builder()
            .status("OK")
            .build());

        var defaultCapacityReservation = new CapacityReservation("defaultCapacityReservation", CapacityReservationArgs.builder()
            .description("terraform-example")
            .platform("linux")
            .capacityReservationName("terraform-example")
            .endTimeType("Unlimited")
            .resourceGroupId(defaultGetResourceGroups.applyValue(getResourceGroupsResult -> getResourceGroupsResult.ids()[0]))
            .instanceAmount(1)
            .instanceType(default_.ids()[0])
            .matchCriteria("Open")
            .tags(Map.of("Created", "terraform-example"))
            .zoneIds(defaultGetZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
            .build());

    }
}
Copy
resources:
  defaultCapacityReservation:
    type: alicloud:ecs:CapacityReservation
    name: default
    properties:
      description: terraform-example
      platform: linux
      capacityReservationName: terraform-example
      endTimeType: Unlimited
      resourceGroupId: ${defaultGetResourceGroups.ids[0]}
      instanceAmount: 1
      instanceType: ${default.ids[0]}
      matchCriteria: Open
      tags:
        Created: terraform-example
      zoneIds:
        - ${defaultGetZones.zones[0].id}
variables:
  default:
    fn::invoke:
      function: alicloud:ecs:getInstanceTypes
      arguments:
        instanceTypeFamily: ecs.g5
  defaultGetZones:
    fn::invoke:
      function: alicloud:getZones
      arguments:
        availableResourceCreation: Instance
        availableInstanceType: ${default.ids[0]}
  defaultGetResourceGroups:
    fn::invoke:
      function: alicloud:resourcemanager:getResourceGroups
      arguments:
        status: OK
Copy

Create CapacityReservation Resource

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

Constructor syntax

new CapacityReservation(name: string, args: CapacityReservationArgs, opts?: CustomResourceOptions);
@overload
def CapacityReservation(resource_name: str,
                        args: CapacityReservationArgs,
                        opts: Optional[ResourceOptions] = None)

@overload
def CapacityReservation(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        instance_amount: Optional[int] = None,
                        instance_type: Optional[str] = None,
                        zone_ids: Optional[Sequence[str]] = None,
                        capacity_reservation_name: Optional[str] = None,
                        description: Optional[str] = None,
                        dry_run: Optional[bool] = None,
                        end_time: Optional[str] = None,
                        end_time_type: Optional[str] = None,
                        match_criteria: Optional[str] = None,
                        platform: Optional[str] = None,
                        resource_group_id: Optional[str] = None,
                        tags: Optional[Mapping[str, str]] = None)
func NewCapacityReservation(ctx *Context, name string, args CapacityReservationArgs, opts ...ResourceOption) (*CapacityReservation, error)
public CapacityReservation(string name, CapacityReservationArgs args, CustomResourceOptions? opts = null)
public CapacityReservation(String name, CapacityReservationArgs args)
public CapacityReservation(String name, CapacityReservationArgs args, CustomResourceOptions options)
type: alicloud:ecs:CapacityReservation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. CapacityReservationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. CapacityReservationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. CapacityReservationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. CapacityReservationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. CapacityReservationArgs
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 capacityReservationResource = new AliCloud.Ecs.CapacityReservation("capacityReservationResource", new()
{
    InstanceAmount = 0,
    InstanceType = "string",
    ZoneIds = new[]
    {
        "string",
    },
    CapacityReservationName = "string",
    Description = "string",
    DryRun = false,
    EndTime = "string",
    EndTimeType = "string",
    MatchCriteria = "string",
    Platform = "string",
    ResourceGroupId = "string",
    Tags = 
    {
        { "string", "string" },
    },
});
Copy
example, err := ecs.NewCapacityReservation(ctx, "capacityReservationResource", &ecs.CapacityReservationArgs{
	InstanceAmount: pulumi.Int(0),
	InstanceType:   pulumi.String("string"),
	ZoneIds: pulumi.StringArray{
		pulumi.String("string"),
	},
	CapacityReservationName: pulumi.String("string"),
	Description:             pulumi.String("string"),
	DryRun:                  pulumi.Bool(false),
	EndTime:                 pulumi.String("string"),
	EndTimeType:             pulumi.String("string"),
	MatchCriteria:           pulumi.String("string"),
	Platform:                pulumi.String("string"),
	ResourceGroupId:         pulumi.String("string"),
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
})
Copy
var capacityReservationResource = new CapacityReservation("capacityReservationResource", CapacityReservationArgs.builder()
    .instanceAmount(0)
    .instanceType("string")
    .zoneIds("string")
    .capacityReservationName("string")
    .description("string")
    .dryRun(false)
    .endTime("string")
    .endTimeType("string")
    .matchCriteria("string")
    .platform("string")
    .resourceGroupId("string")
    .tags(Map.of("string", "string"))
    .build());
Copy
capacity_reservation_resource = alicloud.ecs.CapacityReservation("capacityReservationResource",
    instance_amount=0,
    instance_type="string",
    zone_ids=["string"],
    capacity_reservation_name="string",
    description="string",
    dry_run=False,
    end_time="string",
    end_time_type="string",
    match_criteria="string",
    platform="string",
    resource_group_id="string",
    tags={
        "string": "string",
    })
Copy
const capacityReservationResource = new alicloud.ecs.CapacityReservation("capacityReservationResource", {
    instanceAmount: 0,
    instanceType: "string",
    zoneIds: ["string"],
    capacityReservationName: "string",
    description: "string",
    dryRun: false,
    endTime: "string",
    endTimeType: "string",
    matchCriteria: "string",
    platform: "string",
    resourceGroupId: "string",
    tags: {
        string: "string",
    },
});
Copy
type: alicloud:ecs:CapacityReservation
properties:
    capacityReservationName: string
    description: string
    dryRun: false
    endTime: string
    endTimeType: string
    instanceAmount: 0
    instanceType: string
    matchCriteria: string
    platform: string
    resourceGroupId: string
    tags:
        string: string
    zoneIds:
        - string
Copy

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

InstanceAmount This property is required. int
The total number of instances that need to be reserved within the capacity reservation.
InstanceType
This property is required.
Changes to this property will trigger replacement.
string
Instance type. Currently, you can only set the capacity reservation service for one instance type.
ZoneIds
This property is required.
Changes to this property will trigger replacement.
List<string>
The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
CapacityReservationName string
Capacity reservation service name.
Description string
description of the capacity reservation instance.
DryRun bool
Specifies whether to pre-check the API request. Valid values: true and false.
EndTime string
end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
EndTimeType string
Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
MatchCriteria Changes to this property will trigger replacement. string
The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
Platform Changes to this property will trigger replacement. string
platform of the capacity reservation, value range windows, linux.
ResourceGroupId Changes to this property will trigger replacement. string
The resource group id.
Tags Dictionary<string, string>
The tag of the resource.
InstanceAmount This property is required. int
The total number of instances that need to be reserved within the capacity reservation.
InstanceType
This property is required.
Changes to this property will trigger replacement.
string
Instance type. Currently, you can only set the capacity reservation service for one instance type.
ZoneIds
This property is required.
Changes to this property will trigger replacement.
[]string
The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
CapacityReservationName string
Capacity reservation service name.
Description string
description of the capacity reservation instance.
DryRun bool
Specifies whether to pre-check the API request. Valid values: true and false.
EndTime string
end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
EndTimeType string
Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
MatchCriteria Changes to this property will trigger replacement. string
The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
Platform Changes to this property will trigger replacement. string
platform of the capacity reservation, value range windows, linux.
ResourceGroupId Changes to this property will trigger replacement. string
The resource group id.
Tags map[string]string
The tag of the resource.
instanceAmount This property is required. Integer
The total number of instances that need to be reserved within the capacity reservation.
instanceType
This property is required.
Changes to this property will trigger replacement.
String
Instance type. Currently, you can only set the capacity reservation service for one instance type.
zoneIds
This property is required.
Changes to this property will trigger replacement.
List<String>
The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
capacityReservationName String
Capacity reservation service name.
description String
description of the capacity reservation instance.
dryRun Boolean
Specifies whether to pre-check the API request. Valid values: true and false.
endTime String
end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
endTimeType String
Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
matchCriteria Changes to this property will trigger replacement. String
The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
platform Changes to this property will trigger replacement. String
platform of the capacity reservation, value range windows, linux.
resourceGroupId Changes to this property will trigger replacement. String
The resource group id.
tags Map<String,String>
The tag of the resource.
instanceAmount This property is required. number
The total number of instances that need to be reserved within the capacity reservation.
instanceType
This property is required.
Changes to this property will trigger replacement.
string
Instance type. Currently, you can only set the capacity reservation service for one instance type.
zoneIds
This property is required.
Changes to this property will trigger replacement.
string[]
The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
capacityReservationName string
Capacity reservation service name.
description string
description of the capacity reservation instance.
dryRun boolean
Specifies whether to pre-check the API request. Valid values: true and false.
endTime string
end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
endTimeType string
Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
matchCriteria Changes to this property will trigger replacement. string
The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
platform Changes to this property will trigger replacement. string
platform of the capacity reservation, value range windows, linux.
resourceGroupId Changes to this property will trigger replacement. string
The resource group id.
tags {[key: string]: string}
The tag of the resource.
instance_amount This property is required. int
The total number of instances that need to be reserved within the capacity reservation.
instance_type
This property is required.
Changes to this property will trigger replacement.
str
Instance type. Currently, you can only set the capacity reservation service for one instance type.
zone_ids
This property is required.
Changes to this property will trigger replacement.
Sequence[str]
The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
capacity_reservation_name str
Capacity reservation service name.
description str
description of the capacity reservation instance.
dry_run bool
Specifies whether to pre-check the API request. Valid values: true and false.
end_time str
end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
end_time_type str
Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
match_criteria Changes to this property will trigger replacement. str
The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
platform Changes to this property will trigger replacement. str
platform of the capacity reservation, value range windows, linux.
resource_group_id Changes to this property will trigger replacement. str
The resource group id.
tags Mapping[str, str]
The tag of the resource.
instanceAmount This property is required. Number
The total number of instances that need to be reserved within the capacity reservation.
instanceType
This property is required.
Changes to this property will trigger replacement.
String
Instance type. Currently, you can only set the capacity reservation service for one instance type.
zoneIds
This property is required.
Changes to this property will trigger replacement.
List<String>
The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
capacityReservationName String
Capacity reservation service name.
description String
description of the capacity reservation instance.
dryRun Boolean
Specifies whether to pre-check the API request. Valid values: true and false.
endTime String
end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
endTimeType String
Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
matchCriteria Changes to this property will trigger replacement. String
The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
platform Changes to this property will trigger replacement. String
platform of the capacity reservation, value range windows, linux.
resourceGroupId Changes to this property will trigger replacement. String
The resource group id.
tags Map<String>
The tag of the resource.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
PaymentType string
The payment type of the resource
StartTime string
time of the capacity reservation which become active.
StartTimeType string
The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
Status string
The status of the capacity reservation.
TimeSlot string
This parameter is under test and is not yet open for use.
Id string
The provider-assigned unique ID for this managed resource.
PaymentType string
The payment type of the resource
StartTime string
time of the capacity reservation which become active.
StartTimeType string
The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
Status string
The status of the capacity reservation.
TimeSlot string
This parameter is under test and is not yet open for use.
id String
The provider-assigned unique ID for this managed resource.
paymentType String
The payment type of the resource
startTime String
time of the capacity reservation which become active.
startTimeType String
The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
status String
The status of the capacity reservation.
timeSlot String
This parameter is under test and is not yet open for use.
id string
The provider-assigned unique ID for this managed resource.
paymentType string
The payment type of the resource
startTime string
time of the capacity reservation which become active.
startTimeType string
The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
status string
The status of the capacity reservation.
timeSlot string
This parameter is under test and is not yet open for use.
id str
The provider-assigned unique ID for this managed resource.
payment_type str
The payment type of the resource
start_time str
time of the capacity reservation which become active.
start_time_type str
The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
status str
The status of the capacity reservation.
time_slot str
This parameter is under test and is not yet open for use.
id String
The provider-assigned unique ID for this managed resource.
paymentType String
The payment type of the resource
startTime String
time of the capacity reservation which become active.
startTimeType String
The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
status String
The status of the capacity reservation.
timeSlot String
This parameter is under test and is not yet open for use.

Look up Existing CapacityReservation Resource

Get an existing CapacityReservation 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?: CapacityReservationState, opts?: CustomResourceOptions): CapacityReservation
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        capacity_reservation_name: Optional[str] = None,
        description: Optional[str] = None,
        dry_run: Optional[bool] = None,
        end_time: Optional[str] = None,
        end_time_type: Optional[str] = None,
        instance_amount: Optional[int] = None,
        instance_type: Optional[str] = None,
        match_criteria: Optional[str] = None,
        payment_type: Optional[str] = None,
        platform: Optional[str] = None,
        resource_group_id: Optional[str] = None,
        start_time: Optional[str] = None,
        start_time_type: Optional[str] = None,
        status: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        time_slot: Optional[str] = None,
        zone_ids: Optional[Sequence[str]] = None) -> CapacityReservation
func GetCapacityReservation(ctx *Context, name string, id IDInput, state *CapacityReservationState, opts ...ResourceOption) (*CapacityReservation, error)
public static CapacityReservation Get(string name, Input<string> id, CapacityReservationState? state, CustomResourceOptions? opts = null)
public static CapacityReservation get(String name, Output<String> id, CapacityReservationState state, CustomResourceOptions options)
resources:  _:    type: alicloud:ecs:CapacityReservation    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
CapacityReservationName string
Capacity reservation service name.
Description string
description of the capacity reservation instance.
DryRun bool
Specifies whether to pre-check the API request. Valid values: true and false.
EndTime string
end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
EndTimeType string
Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
InstanceAmount int
The total number of instances that need to be reserved within the capacity reservation.
InstanceType Changes to this property will trigger replacement. string
Instance type. Currently, you can only set the capacity reservation service for one instance type.
MatchCriteria Changes to this property will trigger replacement. string
The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
PaymentType string
The payment type of the resource
Platform Changes to this property will trigger replacement. string
platform of the capacity reservation, value range windows, linux.
ResourceGroupId Changes to this property will trigger replacement. string
The resource group id.
StartTime string
time of the capacity reservation which become active.
StartTimeType string
The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
Status string
The status of the capacity reservation.
Tags Dictionary<string, string>
The tag of the resource.
TimeSlot string
This parameter is under test and is not yet open for use.
ZoneIds Changes to this property will trigger replacement. List<string>
The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
CapacityReservationName string
Capacity reservation service name.
Description string
description of the capacity reservation instance.
DryRun bool
Specifies whether to pre-check the API request. Valid values: true and false.
EndTime string
end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
EndTimeType string
Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
InstanceAmount int
The total number of instances that need to be reserved within the capacity reservation.
InstanceType Changes to this property will trigger replacement. string
Instance type. Currently, you can only set the capacity reservation service for one instance type.
MatchCriteria Changes to this property will trigger replacement. string
The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
PaymentType string
The payment type of the resource
Platform Changes to this property will trigger replacement. string
platform of the capacity reservation, value range windows, linux.
ResourceGroupId Changes to this property will trigger replacement. string
The resource group id.
StartTime string
time of the capacity reservation which become active.
StartTimeType string
The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
Status string
The status of the capacity reservation.
Tags map[string]string
The tag of the resource.
TimeSlot string
This parameter is under test and is not yet open for use.
ZoneIds Changes to this property will trigger replacement. []string
The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
capacityReservationName String
Capacity reservation service name.
description String
description of the capacity reservation instance.
dryRun Boolean
Specifies whether to pre-check the API request. Valid values: true and false.
endTime String
end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
endTimeType String
Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
instanceAmount Integer
The total number of instances that need to be reserved within the capacity reservation.
instanceType Changes to this property will trigger replacement. String
Instance type. Currently, you can only set the capacity reservation service for one instance type.
matchCriteria Changes to this property will trigger replacement. String
The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
paymentType String
The payment type of the resource
platform Changes to this property will trigger replacement. String
platform of the capacity reservation, value range windows, linux.
resourceGroupId Changes to this property will trigger replacement. String
The resource group id.
startTime String
time of the capacity reservation which become active.
startTimeType String
The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
status String
The status of the capacity reservation.
tags Map<String,String>
The tag of the resource.
timeSlot String
This parameter is under test and is not yet open for use.
zoneIds Changes to this property will trigger replacement. List<String>
The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
capacityReservationName string
Capacity reservation service name.
description string
description of the capacity reservation instance.
dryRun boolean
Specifies whether to pre-check the API request. Valid values: true and false.
endTime string
end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
endTimeType string
Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
instanceAmount number
The total number of instances that need to be reserved within the capacity reservation.
instanceType Changes to this property will trigger replacement. string
Instance type. Currently, you can only set the capacity reservation service for one instance type.
matchCriteria Changes to this property will trigger replacement. string
The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
paymentType string
The payment type of the resource
platform Changes to this property will trigger replacement. string
platform of the capacity reservation, value range windows, linux.
resourceGroupId Changes to this property will trigger replacement. string
The resource group id.
startTime string
time of the capacity reservation which become active.
startTimeType string
The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
status string
The status of the capacity reservation.
tags {[key: string]: string}
The tag of the resource.
timeSlot string
This parameter is under test and is not yet open for use.
zoneIds Changes to this property will trigger replacement. string[]
The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
capacity_reservation_name str
Capacity reservation service name.
description str
description of the capacity reservation instance.
dry_run bool
Specifies whether to pre-check the API request. Valid values: true and false.
end_time str
end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
end_time_type str
Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
instance_amount int
The total number of instances that need to be reserved within the capacity reservation.
instance_type Changes to this property will trigger replacement. str
Instance type. Currently, you can only set the capacity reservation service for one instance type.
match_criteria Changes to this property will trigger replacement. str
The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
payment_type str
The payment type of the resource
platform Changes to this property will trigger replacement. str
platform of the capacity reservation, value range windows, linux.
resource_group_id Changes to this property will trigger replacement. str
The resource group id.
start_time str
time of the capacity reservation which become active.
start_time_type str
The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
status str
The status of the capacity reservation.
tags Mapping[str, str]
The tag of the resource.
time_slot str
This parameter is under test and is not yet open for use.
zone_ids Changes to this property will trigger replacement. Sequence[str]
The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
capacityReservationName String
Capacity reservation service name.
description String
description of the capacity reservation instance.
dryRun Boolean
Specifies whether to pre-check the API request. Valid values: true and false.
endTime String
end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
endTimeType String
Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
instanceAmount Number
The total number of instances that need to be reserved within the capacity reservation.
instanceType Changes to this property will trigger replacement. String
Instance type. Currently, you can only set the capacity reservation service for one instance type.
matchCriteria Changes to this property will trigger replacement. String
The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
paymentType String
The payment type of the resource
platform Changes to this property will trigger replacement. String
platform of the capacity reservation, value range windows, linux.
resourceGroupId Changes to this property will trigger replacement. String
The resource group id.
startTime String
time of the capacity reservation which become active.
startTimeType String
The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
status String
The status of the capacity reservation.
tags Map<String>
The tag of the resource.
timeSlot String
This parameter is under test and is not yet open for use.
zoneIds Changes to this property will trigger replacement. List<String>
The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.

Import

Ecs Capacity Reservation can be imported using the id, e.g.

$ pulumi import alicloud:ecs/capacityReservation:CapacityReservation example <id>
Copy

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.