Cria um novo compartilhamento na conta especificada, conforme descrito pelo corpo da solicitação. O recurso de compartilhamento inclui metadados e propriedades para esse compartilhamento. Ele não inclui uma lista dos arquivos contidos pelo compartilhamento.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}?api-version=2023-05-01
Com parâmetros opcionais:
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}?$expand={$expand}&api-version=2023-05-01
Parâmetros do URI
Name |
Em |
Necessário |
Tipo |
Description |
accountName
|
path |
True
|
string
|
O nome da conta de armazenamento dentro do grupo de recursos especificado. Os nomes das contas de armazenamento devem ter entre 3 e 24 caracteres e usar apenas números e letras minúsculas.
Padrão Regex: ^[a-z0-9]+$
|
resourceGroupName
|
path |
True
|
string
|
O nome do grupo de recursos dentro da assinatura do usuário. O nome não diferencia maiúsculas de minúsculas.
Padrão Regex: ^[-\w\._\(\)]+$
|
shareName
|
path |
True
|
string
|
O nome do compartilhamento de arquivos na conta de armazenamento especificada. Os nomes de compartilhamento de arquivos devem ter entre 3 e 63 caracteres e usar números, letras minúsculas e traço (-) apenas. Cada caractere de traço (-) deve ser imediatamente precedido e seguido por uma letra ou número.
|
subscriptionId
|
path |
True
|
string
|
A ID da assinatura de destino.
|
api-version
|
query |
True
|
string
|
A versão da API a ser usada para esta operação.
|
$expand
|
query |
|
string
|
Opcional, usado para expandir as propriedades dentro das propriedades do compartilhamento. Os valores válidos são: snapshots. Deve ser passado como uma cadeia de caracteres com delimitador ',;
|
Corpo do Pedido
Name |
Tipo |
Description |
properties.accessTier
|
ShareAccessTier
|
Camada de acesso para compartilhamento específico. A conta GpV2 pode escolher entre TransactionOptimized (padrão), Hot e Cool. A conta FileStorage pode escolher Premium.
|
properties.enabledProtocols
|
EnabledProtocols
|
O protocolo de autenticação usado para o compartilhamento de arquivos. Só pode ser especificado ao criar um compartilhamento.
|
properties.metadata
|
object
|
Um par nome-valor para associar ao compartilhamento como metadados.
|
properties.rootSquash
|
RootSquashType
|
A propriedade é apenas para compartilhamento NFS. O padrão é NoRootSquash.
|
properties.shareQuota
|
integer
|
O tamanho máximo da partilha, em gigabytes. Deve ser maior que 0 e menor ou igual a 5TB (5120). Para compartilhamentos de arquivos grandes, o tamanho máximo é 102400.
|
properties.signedIdentifiers
|
SignedIdentifier[]
|
Lista de políticas de acesso armazenado especificadas no compartilhamento.
|
Respostas
Name |
Tipo |
Description |
200 OK
|
FileShare
|
OK -- O compartilhamento já está criado.
|
201 Created
|
FileShare
|
Criado -- Operação Criar compartilhamento concluída com êxito.
|
Other Status Codes
|
CloudError
|
Resposta de erro descrevendo por que a operação falhou.
|
Segurança
azure_auth
Azure Ative Directory OAuth2 Flow
Tipo:
oauth2
Fluxo:
implicit
URL de Autorização:
https://login.microsoftonline.com/common/oauth2/authorize
Âmbitos
Name |
Description |
user_impersonation
|
personificar a sua conta de utilizador
|
Exemplos
Create NFS Shares
Pedido de amostra
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res346/providers/Microsoft.Storage/storageAccounts/sto666/fileServices/default/shares/share1235?api-version=2023-05-01
{
"properties": {
"enabledProtocols": "NFS"
}
}
import com.azure.resourcemanager.storage.fluent.models.FileShareInner;
import com.azure.resourcemanager.storage.models.EnabledProtocols;
/**
* Samples for FileShares Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_NFS.json
*/
/**
* Sample code: Create NFS Shares.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createNFSShares(com.azure.resourcemanager.AzureResourceManager azure) {
azure.storageAccounts().manager().serviceClient().getFileShares().createWithResponse("res346", "sto666",
"share1235", new FileShareInner().withEnabledProtocols(EnabledProtocols.NFS), null,
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armstorage_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/220ad9c6554fc7d6d10a89bdb441c1e3b36e3285/specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_NFS.json
func ExampleFileSharesClient_Create_createNfsShares() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armstorage.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewFileSharesClient().Create(ctx, "res346", "sto666", "share1235", armstorage.FileShare{
FileShareProperties: &armstorage.FileShareProperties{
EnabledProtocols: to.Ptr(armstorage.EnabledProtocolsNFS),
},
}, &armstorage.FileSharesClientCreateOptions{Expand: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.FileShare = armstorage.FileShare{
// Name: to.Ptr("share1235"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res346/providers/Microsoft.Storage/storageAccounts/sto666/fileServices/default/shares/share1235"),
// FileShareProperties: &armstorage.FileShareProperties{
// EnabledProtocols: to.Ptr(armstorage.EnabledProtocolsNFS),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { StorageManagementClient } = require("@azure/arm-storage");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share.
*
* @summary Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_NFS.json
*/
async function createNfsShares() {
const subscriptionId = process.env["STORAGE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["STORAGE_RESOURCE_GROUP"] || "res346";
const accountName = "sto666";
const shareName = "share1235";
const fileShare = { enabledProtocols: "NFS" };
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = await client.fileShares.create(
resourceGroupName,
accountName,
shareName,
fileShare,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Storage.Models;
using Azure.ResourceManager.Storage;
// Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_NFS.json
// this example is just showing the usage of "FileShares_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this FileServiceResource created on azure
// for more information of creating FileServiceResource, please refer to the document of FileServiceResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "res346";
string accountName = "sto666";
ResourceIdentifier fileServiceResourceId = FileServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
FileServiceResource fileService = client.GetFileServiceResource(fileServiceResourceId);
// get the collection of this FileShareResource
FileShareCollection collection = fileService.GetFileShares();
// invoke the operation
string shareName = "share1235";
FileShareData data = new FileShareData()
{
EnabledProtocol = FileShareEnabledProtocol.Nfs,
};
ArmOperation<FileShareResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, shareName, data);
FileShareResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
FileShareData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.storage import StorageManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-storage
# USAGE
python file_shares_put_nfs.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = StorageManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.file_shares.create(
resource_group_name="res346",
account_name="sto666",
share_name="share1235",
file_share={"properties": {"enabledProtocols": "NFS"}},
)
print(response)
# x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_NFS.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Resposta da amostra
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res346/providers/Microsoft.Storage/storageAccounts/sto666/fileServices/default/shares/share1235",
"name": "share1235",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"properties": {
"enabledProtocols": "NFS"
}
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res346/providers/Microsoft.Storage/storageAccounts/sto666/fileServices/default/shares/share1235",
"name": "share1235",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"properties": {
"enabledProtocols": "NFS"
}
}
PutShares
Pedido de amostra
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/fileServices/default/shares/share6185?api-version=2023-05-01
{}
import com.azure.resourcemanager.storage.fluent.models.FileShareInner;
/**
* Samples for FileShares Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut.json
*/
/**
* Sample code: PutShares.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void putShares(com.azure.resourcemanager.AzureResourceManager azure) {
azure.storageAccounts().manager().serviceClient().getFileShares().createWithResponse("res3376", "sto328",
"share6185", new FileShareInner(), null, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armstorage_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/220ad9c6554fc7d6d10a89bdb441c1e3b36e3285/specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut.json
func ExampleFileSharesClient_Create_putShares() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armstorage.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewFileSharesClient().Create(ctx, "res3376", "sto328", "share6185", armstorage.FileShare{}, &armstorage.FileSharesClientCreateOptions{Expand: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.FileShare = armstorage.FileShare{
// Name: to.Ptr("share6185"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/fileServices/default/shares/share6185"),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { StorageManagementClient } = require("@azure/arm-storage");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share.
*
* @summary Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut.json
*/
async function putShares() {
const subscriptionId = process.env["STORAGE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["STORAGE_RESOURCE_GROUP"] || "res3376";
const accountName = "sto328";
const shareName = "share6185";
const fileShare = {};
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = await client.fileShares.create(
resourceGroupName,
accountName,
shareName,
fileShare,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Storage.Models;
using Azure.ResourceManager.Storage;
// Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut.json
// this example is just showing the usage of "FileShares_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this FileServiceResource created on azure
// for more information of creating FileServiceResource, please refer to the document of FileServiceResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "res3376";
string accountName = "sto328";
ResourceIdentifier fileServiceResourceId = FileServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
FileServiceResource fileService = client.GetFileServiceResource(fileServiceResourceId);
// get the collection of this FileShareResource
FileShareCollection collection = fileService.GetFileShares();
// invoke the operation
string shareName = "share6185";
FileShareData data = new FileShareData();
ArmOperation<FileShareResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, shareName, data);
FileShareResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
FileShareData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Resposta da amostra
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/fileServices/default/shares/share6185",
"name": "share6185",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares"
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/fileServices/default/shares/share6185",
"name": "share6185",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares"
}
PutShares with Access Tier
Pedido de amostra
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res346/providers/Microsoft.Storage/storageAccounts/sto666/fileServices/default/shares/share1235?api-version=2023-05-01
{
"properties": {
"accessTier": "Hot"
}
}
import com.azure.resourcemanager.storage.fluent.models.FileShareInner;
import com.azure.resourcemanager.storage.models.ShareAccessTier;
/**
* Samples for FileShares Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_AccessTier.json
*/
/**
* Sample code: PutShares with Access Tier.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void putSharesWithAccessTier(com.azure.resourcemanager.AzureResourceManager azure) {
azure.storageAccounts().manager().serviceClient().getFileShares().createWithResponse("res346", "sto666",
"share1235", new FileShareInner().withAccessTier(ShareAccessTier.HOT), null,
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armstorage_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/220ad9c6554fc7d6d10a89bdb441c1e3b36e3285/specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_AccessTier.json
func ExampleFileSharesClient_Create_putSharesWithAccessTier() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armstorage.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewFileSharesClient().Create(ctx, "res346", "sto666", "share1235", armstorage.FileShare{
FileShareProperties: &armstorage.FileShareProperties{
AccessTier: to.Ptr(armstorage.ShareAccessTierHot),
},
}, &armstorage.FileSharesClientCreateOptions{Expand: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.FileShare = armstorage.FileShare{
// Name: to.Ptr("share1235"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res346/providers/Microsoft.Storage/storageAccounts/sto666/fileServices/default/shares/share1235"),
// FileShareProperties: &armstorage.FileShareProperties{
// AccessTier: to.Ptr(armstorage.ShareAccessTierHot),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { StorageManagementClient } = require("@azure/arm-storage");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share.
*
* @summary Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_AccessTier.json
*/
async function putSharesWithAccessTier() {
const subscriptionId = process.env["STORAGE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["STORAGE_RESOURCE_GROUP"] || "res346";
const accountName = "sto666";
const shareName = "share1235";
const fileShare = { accessTier: "Hot" };
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = await client.fileShares.create(
resourceGroupName,
accountName,
shareName,
fileShare,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Storage.Models;
using Azure.ResourceManager.Storage;
// Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_AccessTier.json
// this example is just showing the usage of "FileShares_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this FileServiceResource created on azure
// for more information of creating FileServiceResource, please refer to the document of FileServiceResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "res346";
string accountName = "sto666";
ResourceIdentifier fileServiceResourceId = FileServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
FileServiceResource fileService = client.GetFileServiceResource(fileServiceResourceId);
// get the collection of this FileShareResource
FileShareCollection collection = fileService.GetFileShares();
// invoke the operation
string shareName = "share1235";
FileShareData data = new FileShareData()
{
AccessTier = FileShareAccessTier.Hot,
};
ArmOperation<FileShareResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, shareName, data);
FileShareResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
FileShareData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.storage import StorageManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-storage
# USAGE
python file_shares_put_access_tier.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = StorageManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.file_shares.create(
resource_group_name="res346",
account_name="sto666",
share_name="share1235",
file_share={"properties": {"accessTier": "Hot"}},
)
print(response)
# x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_AccessTier.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Resposta da amostra
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res346/providers/Microsoft.Storage/storageAccounts/sto666/fileServices/default/shares/share1235",
"name": "share1235",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"properties": {
"accessTier": "Hot"
}
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res346/providers/Microsoft.Storage/storageAccounts/sto666/fileServices/default/shares/share1235",
"name": "share1235",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"properties": {
"accessTier": "Hot"
}
}
Definições
Name |
Description |
AccessPolicy
|
|
CloudError
|
Uma resposta de erro do serviço de armazenamento.
|
CloudErrorBody
|
Uma resposta de erro do serviço de armazenamento.
|
EnabledProtocols
|
O protocolo de autenticação usado para o compartilhamento de arquivos. Só pode ser especificado ao criar um compartilhamento.
|
FileShare
|
Propriedades do compartilhamento de arquivos, incluindo Id, nome do recurso, tipo de recurso, Etag.
|
LeaseDuration
|
Especifica se a locação de uma ação é de duração infinita ou fixa, somente quando a ação é arrendada.
|
LeaseState
|
Estado de locação da ação.
|
LeaseStatus
|
O status de locação da ação.
|
RootSquashType
|
A propriedade é apenas para compartilhamento NFS. O padrão é NoRootSquash.
|
ShareAccessTier
|
Camada de acesso para compartilhamento específico. A conta GpV2 pode escolher entre TransactionOptimized (padrão), Hot e Cool. A conta FileStorage pode escolher Premium.
|
SignedIdentifier
|
|
AccessPolicy
Name |
Tipo |
Description |
expiryTime
|
string
|
Prazo de validade da política de acesso
|
permission
|
string
|
Lista de permissões abreviadas.
|
startTime
|
string
|
Hora de início da política de acesso
|
CloudError
Uma resposta de erro do serviço de armazenamento.
Name |
Tipo |
Description |
error
|
CloudErrorBody
|
Uma resposta de erro do serviço de armazenamento.
|
CloudErrorBody
Uma resposta de erro do serviço de armazenamento.
Name |
Tipo |
Description |
code
|
string
|
Um identificador para o erro. Os códigos são invariantes e destinam-se a ser consumidos programaticamente.
|
details
|
CloudErrorBody[]
|
Uma lista de detalhes adicionais sobre o erro.
|
message
|
string
|
Uma mensagem descrevendo o erro, destinada a ser adequada para exibição em uma interface do usuário.
|
target
|
string
|
O alvo do erro específico. Por exemplo, o nome da propriedade em erro.
|
EnabledProtocols
O protocolo de autenticação usado para o compartilhamento de arquivos. Só pode ser especificado ao criar um compartilhamento.
Name |
Tipo |
Description |
NFS
|
string
|
|
SMB
|
string
|
|
FileShare
Propriedades do compartilhamento de arquivos, incluindo Id, nome do recurso, tipo de recurso, Etag.
Name |
Tipo |
Description |
etag
|
string
|
Etag de recurso.
|
id
|
string
|
ID de recurso totalmente qualificado para o recurso. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
O nome do recurso
|
properties.accessTier
|
ShareAccessTier
|
Camada de acesso para compartilhamento específico. A conta GpV2 pode escolher entre TransactionOptimized (padrão), Hot e Cool. A conta FileStorage pode escolher Premium.
|
properties.accessTierChangeTime
|
string
|
Indica o tempo da última modificação para a camada de acesso de compartilhamento.
|
properties.accessTierStatus
|
string
|
Indica se há uma transição pendente para a camada de acesso.
|
properties.deleted
|
boolean
|
Indica se o compartilhamento foi excluído.
|
properties.deletedTime
|
string
|
A hora excluída se o compartilhamento foi excluído.
|
properties.enabledProtocols
|
EnabledProtocols
|
O protocolo de autenticação usado para o compartilhamento de arquivos. Só pode ser especificado ao criar um compartilhamento.
|
properties.lastModifiedTime
|
string
|
Devolve a data e a hora em que a partilha foi modificada pela última vez.
|
properties.leaseDuration
|
LeaseDuration
|
Especifica se a locação de uma ação é de duração infinita ou fixa, somente quando a ação é arrendada.
|
properties.leaseState
|
LeaseState
|
Estado de locação da ação.
|
properties.leaseStatus
|
LeaseStatus
|
O status de locação da ação.
|
properties.metadata
|
object
|
Um par nome-valor para associar ao compartilhamento como metadados.
|
properties.remainingRetentionDays
|
integer
|
Dias de retenção restantes para compartilhamento que foi excluído suavemente.
|
properties.rootSquash
|
RootSquashType
|
A propriedade é apenas para compartilhamento NFS. O padrão é NoRootSquash.
|
properties.shareQuota
|
integer
|
O tamanho máximo da partilha, em gigabytes. Deve ser maior que 0 e menor ou igual a 5TB (5120). Para compartilhamentos de arquivos grandes, o tamanho máximo é 102400.
|
properties.shareUsageBytes
|
integer
|
O tamanho aproximado dos dados armazenados no compartilhamento. Observe que esse valor pode não incluir todos os arquivos criados ou redimensionados recentemente.
|
properties.signedIdentifiers
|
SignedIdentifier[]
|
Lista de políticas de acesso armazenado especificadas no compartilhamento.
|
properties.snapshotTime
|
string
|
Tempo de criação do snapshot de compartilhamento retornado na resposta de compartilhamentos de lista com expand param "snapshots".
|
properties.version
|
string
|
A versão do compartilhamento.
|
type
|
string
|
O tipo do recurso. Por exemplo, "Microsoft.Compute/virtualMachines" ou "Microsoft.Storage/storageAccounts"
|
LeaseDuration
Especifica se a locação de uma ação é de duração infinita ou fixa, somente quando a ação é arrendada.
Name |
Tipo |
Description |
Fixed
|
string
|
|
Infinite
|
string
|
|
LeaseState
Estado de locação da ação.
Name |
Tipo |
Description |
Available
|
string
|
|
Breaking
|
string
|
|
Broken
|
string
|
|
Expired
|
string
|
|
Leased
|
string
|
|
LeaseStatus
O status de locação da ação.
Name |
Tipo |
Description |
Locked
|
string
|
|
Unlocked
|
string
|
|
RootSquashType
A propriedade é apenas para compartilhamento NFS. O padrão é NoRootSquash.
Name |
Tipo |
Description |
AllSquash
|
string
|
|
NoRootSquash
|
string
|
|
RootSquash
|
string
|
|
ShareAccessTier
Camada de acesso para compartilhamento específico. A conta GpV2 pode escolher entre TransactionOptimized (padrão), Hot e Cool. A conta FileStorage pode escolher Premium.
Name |
Tipo |
Description |
Cool
|
string
|
|
Hot
|
string
|
|
Premium
|
string
|
|
TransactionOptimized
|
string
|
|
SignedIdentifier
Name |
Tipo |
Description |
accessPolicy
|
AccessPolicy
|
Política de acesso
|
id
|
string
|
Um identificador exclusivo da política de acesso armazenado.
|