你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Blob Containers - Lease
租用容器操作在容器上建立和管理用于删除操作的锁。 锁的持续时间可以是 15 到 60 秒,也可以是无限期。
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease?api-version=2023-01-01
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
account
|
path | True |
string |
指定资源组中的存储帐户的名称。 存储帐户名称长度必须为 3 到 24 个字符,并且只能使用数字和小写字母。 Regex pattern: |
container
|
path | True |
string |
指定存储帐户中的 Blob 容器的名称。 Blob 容器名称的长度必须介于 3 到 63 个字符之间,并且仅使用数字、小写字母和短划线 ( ) 。 每个短划线(-)字符的前后必须紧跟字母或数字。 |
resource
|
path | True |
string |
用户订阅中的资源组的名称。 此名称不区分大小写。 Regex pattern: |
subscription
|
path | True |
string |
目标订阅的 ID。 |
api-version
|
query | True |
string |
要用于此操作的 API 版本。 |
请求正文
名称 | 必需 | 类型 | 说明 |
---|---|---|---|
action | True |
指定租用操作。 可以是可用操作之一。 |
|
breakPeriod |
integer |
可选。 对于中断操作,租约应在中断前继续建议的持续时间(以秒为单位),介于 0 到 60 之间。 |
|
leaseDuration |
integer |
获取所必需的。 指定租约的持续时间(秒),或者指定 -1 以表示永不过期的租约。 |
|
leaseId |
string |
标识租约。 可以以任何有效的 GUID 字符串格式指定。 |
|
proposedLeaseId |
string |
获取是可选的,更改是必需的。 建议的租约 ID,采用 GUID 字符串格式。 |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK |
正常 -- 租用容器操作成功完成。 |
安全性
azure_auth
Azure Active Directory OAuth2 流
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名称 | 说明 |
---|---|
user_impersonation | 模拟用户帐户 |
示例
Acquire a lease on a container |
Break a lease on a container |
Acquire a lease on a container
Sample Request
POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/blobServices/default/containers/container6185/lease?api-version=2023-01-01
{
"action": "Acquire",
"leaseId": null,
"breakPeriod": null,
"leaseDuration": -1,
"proposedLeaseId": null
}
Sample Response
{
"leaseId": "8698f513-fa75-44a1-b8eb-30ba336af27d"
}
Break a lease on a container
Sample Request
POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/blobServices/default/containers/container6185/lease?api-version=2023-01-01
{
"action": "Break",
"leaseId": "8698f513-fa75-44a1-b8eb-30ba336af27d",
"breakPeriod": null,
"leaseDuration": null,
"proposedLeaseId": null
}
Sample Response
{
"leaseTimeSeconds": "0"
}
定义
名称 | 说明 |
---|---|
Lease |
租用容器请求架构。 |
Lease |
指定租用操作。 可以是可用操作之一。 |
Lease |
租用容器响应架构。 |
LeaseContainerRequest
租用容器请求架构。
名称 | 类型 | 说明 |
---|---|---|
action |
指定租用操作。 可以是可用操作之一。 |
|
breakPeriod |
integer |
可选。 对于中断操作,租约应在中断前继续建议的持续时间(以秒为单位),介于 0 到 60 之间。 |
leaseDuration |
integer |
获取所必需的。 指定租约的持续时间(秒),或者指定 -1 以表示永不过期的租约。 |
leaseId |
string |
标识租约。 可以以任何有效的 GUID 字符串格式指定。 |
proposedLeaseId |
string |
获取是可选的,更改是必需的。 建议的租约 ID,采用 GUID 字符串格式。 |
LeaseContainerRequestAction
指定租用操作。 可以是可用操作之一。
名称 | 类型 | 说明 |
---|---|---|
Acquire |
string |
|
Break |
string |
|
Change |
string |
|
Release |
string |
|
Renew |
string |
LeaseContainerResponse
租用容器响应架构。
名称 | 类型 | 说明 |
---|---|---|
leaseId |
string |
返回的唯一租约 ID,必须包含在删除容器或续订、更改或释放租约的任何请求中。 |
leaseTimeSeconds |
string |
在租约期内的大约剩余时间(秒)。 |