创建计划
适用于:Windows Azure Pack
创建新计划。
请求
指定创建计划请求,如下所示:将 ServiceMgmt> 替换为<服务管理 API 终结点地址:
方法 |
请求 URI |
HTTP 版本 |
---|---|---|
POST |
<https:// ServiceMgmt>:30004/plans |
HTTP/1.1 |
URI 参数
无。
请求标头
下表介绍必需的和可选的请求标头。
请求标头 |
说明 |
---|---|
授权:持有者 |
必需。 授权持有者令牌。 |
x-ms-principal-id |
必需。 主体标识符。 |
x-ms-client-request-id |
可选。 客户端请求标识符。 |
x-ms-client-session-id |
可选。 客户端会话标识符。 |
x-ms-principal-liveid |
可选。 主体实时标识符。 |
请求正文
下表说明了请求正文的元素。
元素名称 |
说明 |
---|---|
计划 |
有关详细信息,请参阅 plan (Administrator object) 。 |
响应
响应包括 HTTP 状态代码、一组响应标头和响应正文。
状态代码
成功的操作返回状态代码 201 (CREATED) 。 如果请求的计划名称已存在,则返回 409 (CONFLICT) 。
有关状态代码的信息,请参阅 Windows Azure 包服务管理) (状态和错误代码 。
响应标头
此操作的响应包括标准 HTTP 标头。 所有标准标头都符合 HTTP/1.1 协议规范。
响应正文
下表介绍了响应正文中的主要元素:
元素名称 |
说明 |
---|---|
计划 |
新计划。 有关详细信息,请参阅 更新计划。 |
示例
以下示例演示 了创建计划 请求。
POST https://<Computer>:30004/plans HTTP/1.1
Authorization: Bearer <Token>
x-ms-client-request-id: e995f8b2-9a85-446e-a680-c424347c2a07-2013-06-28 17:58:52Z
x-ms-client-session-id: d19ca528-d7bf-4a62-9d4d-03adbb4f6c74
x-ms-principal-id: <COMPUTER>\Administrator
Accept-Language: en-US
x-ms-principal-liveid: <COMPUTER>\Administrator
Content-Type: application/json; charset=utf-8
Host: <Computer>:30004
Content-Length: 1132
Expect: 100-continue
{
"Id": "GoldPhihoq8oa",
"DisplayName": "Gold_Plan-1",
"State": 0,
"ConfigState": 0,
"QuotaSyncState": 2,
"LastErrorMessage": null,
"Advertisements": [
{
"LanguageCode": "en-us",
"DisplayName": "Gold_Plan-1",
"Description": null
}
],
"ServiceQuotas": [
{
"ServiceName": "webspaces",
"ServiceInstanceId": "0EA2F3E5-90D1-4CF0-B53D-5A111FF43122",
"ServiceDisplayName": "Web Site Cloud",
"ServiceInstanceDisplayName": null,
"ConfigState": 0,
"QuotaSyncState": 2,
"Settings": [
]
},
{
"ServiceName": "sqlservers",
"ServiceInstanceId": "7BAD5022-79CA-4B53-8177-1ACAEEAFA099",
"ServiceDisplayName": "SQL Servers",
"ServiceInstanceDisplayName": null,
"ConfigState": 0,
"QuotaSyncState": 2,
"Settings": [
]
},
{
"ServiceName": "servicebus",
"ServiceInstanceId": "51680204-CF5D-43DD-B264-4D5CB6076E02",
"ServiceDisplayName": "Service Bus",
"ServiceInstanceDisplayName": null,
"ConfigState": 0,
"QuotaSyncState": 2,
"Settings": [
]
}
],
"SubscriptionCount": 0,
"MaxSubscriptionsPerAccount": 1,
"AddOnReferences": [
{
"AddOnId": "SqlAOwlcnkya2zmcn1xhz",
"AddOnInstanceId": null,
"AcquisitionTime": null
},
{
"AddOnId": "SqlAOtqjctbuhtvmjmkyg",
"AddOnInstanceId": null,
"AcquisitionTime": null
}
],
"AddOns": [
],
"InvitationCode": null,
"Price": null
}
下面的代码示例演示了 “创建计划” 响应。
{
"Id": "GoldPhihoq8oa",
"DisplayName": "Gold_Plan-1",
"State": 0,
"ConfigState": 1,
"QuotaSyncState": 0,
"LastErrorMessage": null,
"Advertisements": [
{
"LanguageCode": "en-us",
"DisplayName": "Gold_Plan-1",
"Description": null
}
],
"ServiceQuotas": [
{
"ServiceName": "webspaces",
"ServiceInstanceId": "0EA2F3E5-90D1-4CF0-B53D-5A111FF43122",
"ServiceDisplayName": "Web Site Cloud",
"ServiceInstanceDisplayName": "autotest1",
"ConfigState": 1,
"QuotaSyncState": 0,
"Settings": [
{
"Key": "BytesReceived_Shared_WebSpace_Limited",
"Value": "{\"ComputeMode\":0,\"CustomActionName\":null,\"EnforcementScope\":0,\"ExceededAction\":0,\"Limit\":-1,\"Period\":1440,\"QuotaName\":\"BytesReceived\",\"ResourceName\":\"BytesReceived\",\"SiteMode\":\"Limited\",\"Unit\":1,\"WebPlan\":null}"
}
]
},
{
"ServiceName": "sqlservers",
"ServiceInstanceId": "7BAD5022-79CA-4B53-8177-1ACAEEAFA099",
"ServiceDisplayName": "SQL Servers",
"ServiceInstanceDisplayName": "SQL Servers",
"ConfigState": 1,
"QuotaSyncState": 0,
"Settings": [
{
"Key": "Editions",
"Value": "[{\"displayName\":\"Default\",\"groupName\":\"Default\",\"resourceCount\":\"10\",\"resourceSize\":\"1024\",\"resourceSizeLimit\":\"1024\",\"offerEditionId\":\"062813055853\",\"groupType\":null}]"
}
]
},
{
"ServiceName": "servicebus",
"ServiceInstanceId": "51680204-CF5D-43DD-B264-4D5CB6076E02",
"ServiceDisplayName": "Service Bus Cloud",
"ServiceInstanceDisplayName": "MyServiceBusFarm",
"ConfigState": 1,
"QuotaSyncState": 0,
"Settings": [
]
}
],
"SubscriptionCount": 0,
"MaxSubscriptionsPerAccount": 1,
"AddOnReferences": [
{
"AddOnId": "SqlAOwlcnkya2zmcn1xhz",
"AddOnInstanceId": null,
"AcquisitionTime": null
},
{
"AddOnId": "SqlAOtqjctbuhtvmjmkyg",
"AddOnInstanceId": null,
"AcquisitionTime": null
}
],
"AddOns": [
{
"Id": "SqlAOwlcnkya2zmcn1xhz",
"DisplayName": "SqlAOwlcnkya2",
"State": 0,
"ConfigState": 1,
"QuotaSyncState": 0,
"LastErrorMessage": null,
"Advertisements": [
{
"LanguageCode": "en-us",
"DisplayName": "SqlAOwlcnkya2",
"Description": null
}
],
"ServiceQuotas": [
{
"ServiceName": "sqlservers",
"ServiceInstanceId": "7BAD5022-79CA-4B53-8177-1ACAEEAFA099",
"ServiceDisplayName": "SQL Servers",
"ServiceInstanceDisplayName": "SQL Servers",
"ConfigState": 1,
"QuotaSyncState": 0,
"Settings": [
{
"Key": "Editions",
"Value": "[{\"groupName\":\"Default\",\"resourceCount\":\"2\",\"resourceSize\":\"10\",\"offerEditionId\":\"1367541399669\"}]"
}
]
}
],
"SubscriptionCount": 1,
"AssociatedPlans": [
],
"MaxOccurrencesPerPlan": 1,
"Price": null
},
{
"Id": "SqlAOtqjctbuhtvmjmkyg",
"DisplayName": "SqlAOtqjctbuh",
"State": 0,
"ConfigState": 1,
"QuotaSyncState": 0,
"LastErrorMessage": null,
"Advertisements": [
{
"LanguageCode": "en-us",
"DisplayName": "SqlAOtqjctbuh",
"Description": null
}
],
"ServiceQuotas": [
{
"ServiceName": "sqlservers",
"ServiceInstanceId": "7BAD5022-79CA-4B53-8177-1ACAEEAFA099",
"ServiceDisplayName": "SQL Servers",
"ServiceInstanceDisplayName": "SQL Servers",
"ConfigState": 1,
"QuotaSyncState": 0,
"Settings": [
{
"Key": "Editions",
"Value": "[{\"groupName\":\"Default\",\"resourceCount\":\"2\",\"resourceSize\":\"10\",\"offerEditionId\":\"1367541399669\"}]"
}
]
}
],
"SubscriptionCount": 1,
"AssociatedPlans": [
],
"MaxOccurrencesPerPlan": 1,
"Price": null
}
],
"InvitationCode": null,
"Price": null
}
注解
在 Windows Azure 包中,计划必须具有唯一的计划 (管理员对象) 对象 DisplayName 值和 计划 对象 ID 值。 若要获取当前计划的列表,请调用 “检索可用计划”。 创建新计划时,使用此信息可确保 DisplayName 和 Id 值是唯一的。
ID 的允许字符为 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&' () *+,;;=