Crée une réservation de capacité en spécifiant le type d'instance, la quantité totale, l'heure de début et la zone de disponibilité.
Description de l'opération
API.
Testez maintenant
Testez cette API dans OpenAPI Explorer, sans signature manuelle. Les appels réussis génèrent automatiquement du code SDK correspondant à vos paramètres. Téléchargez-le avec une sécurité intégrée des identifiants pour une utilisation locale. Testez cette API dans OpenAPI Explorer, sans signature manuelle. Les appels réussis génèrent automatiquement du code SDK correspondant à vos paramètres. Téléchargez-le avec une sécurité intégrée des identifiants pour une utilisation locale.
Test
Autorisation RAM
|
ecs:CreateCapacityReservation |
create |
*CapacityReservation
|
Aucune | Aucune |
Paramètres de requête
|
Paramètre |
Type |
Requis |
Description |
Exemple |
| RegionId |
string |
Oui |
L'identifiant de la région dans laquelle créer la réservation de capacité. Vous pouvez appeler DescribeRegions pour interroger la liste la plus récente des régions d'Alibaba Cloud. |
cn-hangzhou |
| ResourceGroupId |
string |
Non |
L'identifiant du groupe de ressources auquel appartient la réservation de capacité. |
rg-bp67acfmxazb4p**** |
| Tag |
array<object> |
Non |
Les balises à ajouter à la réservation de capacité. |
|
|
object |
Non |
Une balise. |
||
| Key |
string |
Non |
La clé de balise de la réservation de capacité. Valeurs valides de N : 1 à 20. La clé de balise ne peut pas être une chaîne vide. La clé de balise peut comporter jusqu'à 128 caractères et ne peut pas commencer par aliyun ou acs:. Elle ne peut pas contenir http:// ou https://. |
TestKey |
| Value |
string |
Non |
La valeur de balise de la réservation de capacité. Valeurs valides de N : 1 à 20. La valeur de balise peut être une chaîne vide. La valeur de balise peut comporter jusqu'à 128 caractères et ne peut pas commencer par acs:. Elle ne peut pas contenir http:// ou https://. |
TestValue |
| ClientToken |
string |
Non |
Un jeton généré par le client qui garantit que la requête est idempotente. Vous pouvez utiliser le même jeton pour réessayer une requête. La valeur ClientToken ne peut contenir que des caractères ASCII et ne peut pas dépasser 64 caractères. Pour plus d'informations, consultez Comment garantir l'idempotence. |
0c593ea1-3bea-11e9-b96b-88e9fe637760 |
| PrivatePoolOptions.Name |
string |
Non |
Le nom de la réservation de capacité. Le nom doit comporter de 2 à 128 caractères. Il doit commencer par une lettre ou un caractère chinois et ne peut pas commencer par http:// ou https://. Il peut contenir des chiffres, des deux-points (:), des traits de soulignement (_) et des traits d'union (-). |
crpTestName |
| Description |
string |
Non |
La description de la réservation de capacité. La description doit comporter de 2 à 256 caractères et ne peut pas commencer par http:// ou https://. |
Ceci est une description |
| PrivatePoolOptions.MatchCriteria |
string |
Non |
Le type de pool privé généré après l'entrée en vigueur de la réservation de capacité. Valeurs valides : |
Open |
| InstanceAmount |
integer |
Oui |
Le nombre d'instances du type d'instance spécifié pour lesquelles réserver de la capacité. |
2 |
| InstanceType |
string |
Oui |
Le type d'instance pour lequel réserver de la capacité. Vous pouvez appeler DescribeInstanceTypes pour consulter les types d'instances fournis par ECS. |
ecs.g6.xlarge |
| StartTime |
string |
Non |
L'heure à laquelle la réservation de capacité entre en vigueur. La réservation de capacité entre en vigueur immédiatement après sa création. |
2021-10-30T05:32:00Z |
| EndTime |
string |
Non |
L'heure de fin de la réservation de capacité. Spécifiez l'heure selon la norme ISO 8601 au format yyyy-MM-ddTHH:mm:ssZ. L'heure doit être en UTC. Pour plus d'informations, consultez ISO 8601. |
2021-10-30T06:32:00Z |
| EndTimeType |
string |
Non |
Le mode de libération de la réservation de capacité. Valeurs valides : |
Unlimited |
| Platform |
string |
Non |
Le système d'exploitation de l'image utilisée par l'instance. Ce paramètre correspond au paramètre Platform d'une instance réservée régionale. Si cette plateforme correspond à la plateforme d'une instance réservée régionale, l'instance réservée régionale peut être utilisée pour compenser les coûts de la capacité inutilisée dans la réservation. Valeurs valides : |
Linux |
| InstanceChargeType |
string |
Non |
||
| ZoneId |
array |
Oui |
The zone ID of the capacity reservation. Currently, you can create a capacity reservation in only one zone. |
cn-hangzhou-h |
|
string |
Non |
The zone ID within the region of the capacity reservation. |
cn-hangzhou-h |
Éléments de réponse
|
Élément |
Type |
Description |
Exemple |
|
object |
|||
| PrivatePoolOptionsId |
string |
L'identifiant de la réservation de capacité. |
crp-bp67acfmxazb4**** |
| RequestId |
string |
L'identifiant de la requête. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
Exemples
JSON format
{
"PrivatePoolOptionsId": "crp-bp67acfmxazb4****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Codes d'erreur
|
Code de statut HTTP |
Code d'erreur |
Message d'erreur |
Description |
|---|---|---|---|
| 400 | InvalidParameter.RegionId | The specified RegionId is invalid. | The specified region does not exist or is unavailable. |
| 400 | NoStock | The stock in the availability zone is insufficient. | The stock in the availability zone is insufficient. |
| 400 | MissingParameter | The input parameter StartTime is missing. | |
| 400 | OperationDenied | The specified instanceType or zone is not available or not authorized. | Specified specifications or Availability Zones are not available |
| 400 | MissingParameter.RegionId | The specified RegionId should not be null. | The RegionId parameter is required. |
| 400 | InvalidStartTime.NotSupported | The specified StartTime should be within 180 calendar days from the current date, and you must specify a precision to hour. | The specified StartTime value is out of range. |
| 400 | InvalidStartTime.MalFormed | The specified StartTime is out of the permitted range. | The specified StartTime value exceeds the maximum allowed value. |
| 400 | Invalid.PrivatePoolOptionsName.MalFormed | The specified PrivatePoolOptions.Name is not valid. | The specified PrivatePoolOptions.Name is invalid |
| 400 | Invalid.ZoneId | The specified ZoneId is not valid. | The specified ZoneId is invalid. |
| 400 | Invalid.InstanceType | The specified InstanceType is not valid. | The specified InstanceType is illegal. |
| 400 | DedicatedHostNotSupported | DedicatedHost is not supported for PrivatePool. | The private pool does not support dedicated hosts. |
| 400 | SpotNotSupported | Spot is not supported for PrivatePool. | The private pool does not support spot instances. |
| 400 | ClassicNetworkNotSupported | Classic network is not supported for PrivatePool. | The private pool does not support instances in the classic network. |
| 400 | Invalid.InstanceId | Instance does not exist. | The specified instance does not exist. |
| 400 | Invalid.PrivatePoolOptions.MatchCriteria | Target mode does not support this operation. | The operation is not supported while the PrivatePoolOptions.MatchCriteria parameter is set to Target. |
| 400 | MissingParameter.PrivatePoolOptions.Id | The specified PrivatePoolOptions.Id should not be null. | The PrivatePoolOptions.Id parameter is required. |
| 400 | Invalid.PrivatePoolOptions.Id | The PrivatePool does not exist. | The private pool does not exist. |
| 400 | Invalid.InstanceChargeType | The InstanceChargeType does not match the PrivatePool. | The instance billing method and the private pool do not match. |
| 400 | Invalid.PrivatePoolOptions.status | The PrivatePool has been used up. | The resource is exhausted. |
| 400 | InvalidPlatform.ValueNotSupported | The Platform does not match the PrivatePool. | The specified Platform parameter does not match the private pool. |
| 400 | InvalidAliUid | The PrivatePool does not belong to the user of the Instance. | The specified private pool does not belong to the user who attempted to create the instance. |
| 400 | MissingParameter.PackageType | The specified parameter "PackageType" can not be empty. | The required parameter PackageType cannot be empty. |
| 400 | MissingParameter.PrivatePoolOptions.Ids | The specified parameter "PrivatePoolOptions.Ids" can not be empty. | Specifies that the parameter "PrivatePoolOptions.ids" cannot be empty. |
| 400 | MissingParameter.InstanceCpuCoreCount | The specified parameter "InstanceCpuCoreCount" can not be empty. | The specified parameter 'InstanceCpuCocount' cannot be empty. |
| 400 | MissingParameter.InstanceAmount | The specified parameter "InstanceAmount" can not be empty. | The specified parameter InstanceAmount cannot be empty. |
| 400 | MissingParameter.InstanceCpuCoreCountOrInstanceAmount | The specified parameter "InstanceCpuCoreCount" and "InstanceAmount" must not be empty at the same time. | The specified parameter InstanceCpuCoreCount and InstanceAmount cannot be both empty. |
| 400 | Invalid.TooManyPrivatePoolOptions.Ids | Too many PrivatePoolOptions.Ids in this request. | The number of specified private pool IDs exceeds the upper limit. |
| 400 | Invalid.TooManyZoneIds | Too many ZoneIds in the request. | The number of specified zone IDs exceeds the upper limit. |
| 400 | Invalid.TooManyInstanceTypes | Too many InstanceTypes in the request. | The number of specified instance types exceeds the upper limit. |
| 400 | Invalid.TooManyUnpaidPrivatePool | Too many PrivatePools create but still unpaid. | Multiple private pools are created but not paid. |
| 400 | Invalid.InstanceCpuCoreCountOrInstanceAmount | Both InstanceCpuCoreCount and InstanceAmount are provided. | The InstanceCpuCoreCount and InstanceAmount parameters cannot be both specified. |
| 400 | Invalid.PrivatePoolOptions.Ids | The specified parameter "PrivatePoolOptions.Ids" exist invalid element Id. | The specified private pool ID does not exist. |
| 400 | Invalid.PackageType | The specified parameter "PackageType" is invalid. | The specified parameter PackageType is invalid. |
| 400 | Invalid.PrivatePool.Purchase | The PrivatePool has already paid. | The private pool is already paid. |
| 400 | Invalid.AssuranceTimes.NotSupported | The value of AssuranceTimes is not supported. | The specified AssuranceTimes parameter is invalid. |
| 400 | RepeatStartPrivatePool | PrivatePool has already been started. | The private pool is already started. |
| 400 | Invalid.TimeSlot | The param time slot is invalid. | Parameter TimeSlot is invalid. |
| 400 | Invalid.EndTime | The specified parameter "EndTime" is not valid. | The specified EndTime parameter is illegal. |
| 400 | StartTime.NotNeed | The specified parameter "StartTime" should leave empty. | The specified parameter "StartTime" should be empty. |
| 400 | AccountForbidden.ProductCreationLimited | The commodity must be officially operated by Aliyun and in pay-as-you-go billing method. | Enterprise cloud migration customers can purchase only pay-as-you-go ECS instances and cannot purchase third-party products such as images provided by Alibaba Cloud Marketplace. Check the parameters and retry with valid parameters. |
| 400 | RegionUnauthorized | There is no authority to create private pool in the specified region. | You do not have the permission to create a private pool in the specified region. |
| 400 | PriceNotFound | The price of your queried resource is not available now, please try other resources. | The price of the specified resource does not exist. Modify the parameter value and try again later. |
| 500 | InternalError | The request processing has failed due to some unknown error, exception or failure. | An internal error has occurred. Try again later. |
| 403 | Zone.NotOpen | The specified zone is not granted to you to buy resources yet. | |
| 403 | InvalidResourceType.NotSupported | %s | The specified resource combination does not exist. Change to another zone or specification. |
| 403 | OperationDenied.NoStock | The resource is out of stock in the specified zone. Please try other types, or choose other regions and zones. | The requested resources are unavailable in the specified zone. Try a different resource type or select a different region or zone. |
| 403 | InvalidInstanceType.NotSupported | The specified InstanceType is invalid. | |
| 403 | Invalid.ZoneIds | At least one of the specified ZoneIds are invalid. | At least one of the specified ZoneIds is invalid. |
| 403 | Zone.NotOnSale | The specified zone is not available for purchase. | The requested resources are unavailable in the specified zone. Try a different instance type or select a different region or zone. |
| 404 | InvalidZoneId.NotFound | The specified zoneId does not exist. | The specified zone ID does not exist. |
| 404 | InvalidResourceGroup.NotFound | The ResourceGroup provided does not exist in our records. | The specified resource group does not exist. |
Consultez Codes d'erreur pour la liste complète.
Notes de version
Consultez Notes de version pour la liste complète.