列出所有共用。
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares?api-version=2023-05-01
含選擇性參數:
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares?api-version=2023-05-01&$maxpagesize={$maxpagesize}&$filter={$filter}&$expand={$expand}
URI 參數
名稱 |
位於 |
必要 |
類型 |
Description |
accountName
|
path |
True
|
string
|
指定資源群組內的記憶體帳戶名稱。 儲存體帳戶名稱長度必須介於 3 到 24 個字元之間,且只能使用數位和小寫字母。
Regex 模式: ^[a-z0-9]+$
|
resourceGroupName
|
path |
True
|
string
|
用戶訂用帳戶內的資源組名。 名稱不區分大小寫。
Regex 模式: ^[-\w\._\(\)]+$
|
subscriptionId
|
path |
True
|
string
|
目標訂用帳戶的標識碼。
|
api-version
|
query |
True
|
string
|
要用於這項作業的 API 版本。
|
$expand
|
query |
|
string
|
選擇性,用來展開共用屬性內的屬性。 有效值為:已刪除、快照集。 應該以具有分隔符 ', 的字串傳遞
|
$filter
|
query |
|
string
|
自選。 指定時,只會列出以篩選開頭的共享名稱。
|
$maxpagesize
|
query |
|
string
|
自選。 指定清單中可包含的共享數目上限。
|
回應
安全性
azure_auth
Azure Active Directory OAuth2 Flow
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/authorize
範圍
名稱 |
Description |
user_impersonation
|
模擬您的用戶帳戶
|
範例
ListDeletedShares
範例要求
GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares?api-version=2023-05-01&$expand=deleted
/**
* Samples for FileShares List.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/DeletedFileSharesList.json
*/
/**
* Sample code: ListDeletedShares.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void listDeletedShares(com.azure.resourcemanager.AzureResourceManager azure) {
azure.storageAccounts().manager().serviceClient().getFileShares().list("res9290", "sto1590", null, null,
"deleted", 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
from azure.identity import DefaultAzureCredential
from azure.mgmt.storage import StorageManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-storage
# USAGE
python deleted_file_shares_list.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.list(
resource_group_name="res9290",
account_name="sto1590",
)
for item in response:
print(item)
# x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/DeletedFileSharesList.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
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/DeletedFileSharesList.json
func ExampleFileSharesClient_NewListPager_listDeletedShares() {
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)
}
pager := clientFactory.NewFileSharesClient().NewListPager("res9290", "sto1590", &armstorage.FileSharesClientListOptions{Maxpagesize: nil,
Filter: nil,
Expand: to.Ptr("deleted"),
})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.FileShareItems = armstorage.FileShareItems{
// Value: []*armstorage.FileShareItem{
// {
// Name: to.Ptr("share1644"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share1644_1234567890"),
// Etag: to.Ptr("\"0x8D589847D51C7DE\""),
// Properties: &armstorage.FileShareProperties{
// Deleted: to.Ptr(true),
// DeletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-14T08:20:47.000Z"); return t}()),
// LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T08:20:47.000Z"); return t}()),
// RemainingRetentionDays: to.Ptr[int32](30),
// ShareQuota: to.Ptr[int32](1024),
// Version: to.Ptr("1234567890"),
// },
// },
// {
// Name: to.Ptr("share4052"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share4052"),
// Etag: to.Ptr("\"0x8D589847DAB5AF9\""),
// Properties: &armstorage.FileShareProperties{
// LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T08:20:47.000Z"); return t}()),
// ShareQuota: to.Ptr[int32](1024),
// },
// }},
// }
}
}
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 Lists all shares.
*
* @summary Lists all shares.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/DeletedFileSharesList.json
*/
async function listDeletedShares() {
const subscriptionId = process.env["STORAGE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["STORAGE_RESOURCE_GROUP"] || "res9290";
const accountName = "sto1590";
const expand = "deleted";
const options = { expand };
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.fileShares.list(resourceGroupName, accountName, options)) {
resArray.push(item);
}
console.log(resArray);
}
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/DeletedFileSharesList.json
// this example is just showing the usage of "FileShares_List" 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 = "res9290";
string accountName = "sto1590";
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 and iterate over the result
string expand = "deleted";
await foreach (FileShareResource item in collection.GetAllAsync(expand: expand))
{
// the variable item 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 = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"value": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share1644_1234567890",
"name": "share1644",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"etag": "\"0x8D589847D51C7DE\"",
"properties": {
"lastModifiedTime": "2019-05-14T08:20:47Z",
"shareQuota": 1024,
"version": "1234567890",
"deleted": true,
"deletedTime": "2019-12-14T08:20:47Z",
"remainingRetentionDays": 30
}
},
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share4052",
"name": "share4052",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"etag": "\"0x8D589847DAB5AF9\"",
"properties": {
"lastModifiedTime": "2019-05-14T08:20:47Z",
"shareQuota": 1024
}
}
]
}
ListShares
範例要求
GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares?api-version=2023-05-01
/**
* Samples for FileShares List.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesList.json
*/
/**
* Sample code: ListShares.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void listShares(com.azure.resourcemanager.AzureResourceManager azure) {
azure.storageAccounts().manager().serviceClient().getFileShares().list("res9290", "sto1590", null, null, 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
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_list.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.list(
resource_group_name="res9290",
account_name="sto1590",
)
for item in response:
print(item)
# x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesList.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
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/FileSharesList.json
func ExampleFileSharesClient_NewListPager_listShares() {
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)
}
pager := clientFactory.NewFileSharesClient().NewListPager("res9290", "sto1590", &armstorage.FileSharesClientListOptions{Maxpagesize: nil,
Filter: nil,
Expand: nil,
})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.FileShareItems = armstorage.FileShareItems{
// Value: []*armstorage.FileShareItem{
// {
// Name: to.Ptr("share1644"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share1644"),
// Etag: to.Ptr("\"0x8D589847D51C7DE\""),
// Properties: &armstorage.FileShareProperties{
// LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T08:20:47.000Z"); return t}()),
// ShareQuota: to.Ptr[int32](1024),
// },
// },
// {
// Name: to.Ptr("share4052"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share4052"),
// Etag: to.Ptr("\"0x8D589847DAB5AF9\""),
// Properties: &armstorage.FileShareProperties{
// LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T08:20:47.000Z"); return t}()),
// ShareQuota: to.Ptr[int32](1024),
// },
// }},
// }
}
}
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 Lists all shares.
*
* @summary Lists all shares.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesList.json
*/
async function listShares() {
const subscriptionId = process.env["STORAGE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["STORAGE_RESOURCE_GROUP"] || "res9290";
const accountName = "sto1590";
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.fileShares.list(resourceGroupName, accountName)) {
resArray.push(item);
}
console.log(resArray);
}
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/FileSharesList.json
// this example is just showing the usage of "FileShares_List" 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 = "res9290";
string accountName = "sto1590";
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 and iterate over the result
await foreach (FileShareResource item in collection.GetAllAsync())
{
// the variable item 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 = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"value": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share1644",
"name": "share1644",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"etag": "\"0x8D589847D51C7DE\"",
"properties": {
"lastModifiedTime": "2019-05-14T08:20:47Z",
"shareQuota": 1024
}
},
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share4052",
"name": "share4052",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"etag": "\"0x8D589847DAB5AF9\"",
"properties": {
"lastModifiedTime": "2019-05-14T08:20:47Z",
"shareQuota": 1024
}
}
],
"nextLink": "https://sto1590endpoint/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares?api-version=2022-09-01&$maxpagesize=2&$skipToken=/sto1590/share5103"
}
ListShareSnapshots
範例要求
GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares?api-version=2023-05-01&$expand=snapshots
/**
* Samples for FileShares List.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileShareSnapshotsList.json
*/
/**
* Sample code: ListShareSnapshots.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void listShareSnapshots(com.azure.resourcemanager.AzureResourceManager azure) {
azure.storageAccounts().manager().serviceClient().getFileShares().list("res9290", "sto1590", null, null,
"snapshots", 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
from azure.identity import DefaultAzureCredential
from azure.mgmt.storage import StorageManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-storage
# USAGE
python file_share_snapshots_list.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.list(
resource_group_name="res9290",
account_name="sto1590",
)
for item in response:
print(item)
# x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileShareSnapshotsList.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
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/FileShareSnapshotsList.json
func ExampleFileSharesClient_NewListPager_listShareSnapshots() {
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)
}
pager := clientFactory.NewFileSharesClient().NewListPager("res9290", "sto1590", &armstorage.FileSharesClientListOptions{Maxpagesize: nil,
Filter: nil,
Expand: to.Ptr("snapshots"),
})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.FileShareItems = armstorage.FileShareItems{
// Value: []*armstorage.FileShareItem{
// {
// Name: to.Ptr("share4052"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share4052"),
// Etag: to.Ptr("\"0x8D589847DAB5AF9\""),
// Properties: &armstorage.FileShareProperties{
// LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-26T05:47:05.000Z"); return t}()),
// ShareQuota: to.Ptr[int32](1024),
// },
// },
// {
// Name: to.Ptr("share4052"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share4052"),
// Etag: to.Ptr("\"0x8D589847DAB5AF9\""),
// Properties: &armstorage.FileShareProperties{
// LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-26T05:47:05.000Z"); return t}()),
// ShareQuota: to.Ptr[int32](1024),
// SnapshotTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-26T05:48:07.000Z"); return t}()),
// },
// }},
// }
}
}
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 Lists all shares.
*
* @summary Lists all shares.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileShareSnapshotsList.json
*/
async function listShareSnapshots() {
const subscriptionId = process.env["STORAGE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["STORAGE_RESOURCE_GROUP"] || "res9290";
const accountName = "sto1590";
const expand = "snapshots";
const options = { expand };
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.fileShares.list(resourceGroupName, accountName, options)) {
resArray.push(item);
}
console.log(resArray);
}
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/FileShareSnapshotsList.json
// this example is just showing the usage of "FileShares_List" 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 = "res9290";
string accountName = "sto1590";
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 and iterate over the result
string expand = "snapshots";
await foreach (FileShareResource item in collection.GetAllAsync(expand: expand))
{
// the variable item 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 = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"value": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share4052",
"name": "share4052",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"etag": "\"0x8D589847DAB5AF9\"",
"properties": {
"lastModifiedTime": "2020-10-26T05:47:05.0000000Z",
"shareQuota": 1024
}
},
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share4052",
"name": "share4052",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"etag": "\"0x8D589847DAB5AF9\"",
"properties": {
"lastModifiedTime": "2020-10-26T05:47:05.0000000Z",
"shareQuota": 1024,
"snapshotTime": "2020-10-26T05:48:07.0000000Z"
}
}
]
}
定義
AccessPolicy
名稱 |
類型 |
Description |
expiryTime
|
string
|
存取原則的到期時間
|
permission
|
string
|
縮寫許可權的清單。
|
startTime
|
string
|
存取原則的開始時間
|
CloudError
記憶體服務的錯誤回應。
CloudErrorBody
記憶體服務的錯誤回應。
名稱 |
類型 |
Description |
code
|
string
|
錯誤的識別碼。 程序代碼是不變的,而且是要以程序設計方式取用。
|
details
|
CloudErrorBody[]
|
錯誤的其他詳細數據清單。
|
message
|
string
|
描述錯誤的訊息,適用於在使用者介面中顯示。
|
target
|
string
|
特定錯誤的目標。 例如,錯誤中的屬性名稱。
|
EnabledProtocols
用於檔案共用的驗證通訊協定。 只能在建立共用時指定。
名稱 |
類型 |
Description |
NFS
|
string
|
|
SMB
|
string
|
|
FileShareItem
列出檔案共享屬性。
名稱 |
類型 |
Description |
etag
|
string
|
資源 Etag。
|
id
|
string
|
資源的完整資源標識碼。 例如 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
資源的名稱
|
properties.accessTier
|
ShareAccessTier
|
特定共用的存取層。 GpV2 帳戶可以選擇 TransactionOptimized (預設)、經常性存取和非經常性存取。 FileStorage 帳戶可以選擇 [進階]。
|
properties.accessTierChangeTime
|
string
|
表示共用存取層的最後一次修改時間。
|
properties.accessTierStatus
|
string
|
指出存取層是否有暫止轉換。
|
properties.deleted
|
boolean
|
指出是否已刪除共用。
|
properties.deletedTime
|
string
|
已刪除共享的時間。
|
properties.enabledProtocols
|
EnabledProtocols
|
用於檔案共用的驗證通訊協定。 只能在建立共用時指定。
|
properties.lastModifiedTime
|
string
|
傳回上次修改共用的日期和時間。
|
properties.leaseDuration
|
LeaseDuration
|
指定共用上的租用是否為無限或固定的持續時間,只有在共用租用時。
|
properties.leaseState
|
LeaseState
|
共用的租用狀態。
|
properties.leaseStatus
|
LeaseStatus
|
共用的租用狀態。
|
properties.metadata
|
object
|
要與共用建立關聯的名稱/值組做為元數據。
|
properties.remainingRetentionDays
|
integer
|
虛刪除共享的剩餘保留天數。
|
properties.rootSquash
|
RootSquashType
|
屬性僅適用於 NFS 共用。 預設值為 NoRootSquash。
|
properties.shareQuota
|
integer
|
共用的大小上限,以 GB 為單位。 必須大於 0,且小於或等於 5TB (5120)。 對於大型檔案共用,大小上限為 102400。
|
properties.shareUsageBytes
|
integer
|
儲存在共用上的大約數據大小。 請注意,此值可能不會包含最近建立或最近重設大小的檔案。
|
properties.signedIdentifiers
|
SignedIdentifier[]
|
共用上指定的預存存取原則清單。
|
properties.snapshotTime
|
string
|
使用展開參數「快照集」,在清單共用響應中傳回的共用快照集建立時間。
|
properties.version
|
string
|
共用的版本。
|
type
|
string
|
資源的型別。 例如“Microsoft.Compute/virtualMachines” 或 “Microsoft.Storage/storageAccounts”
|
FileShareItems
回應架構。 包含傳回的共享清單,如果要求或需要分頁,則為下一頁共用的URL。
名稱 |
類型 |
Description |
nextLink
|
string
|
可用來查詢下一頁共用的要求URL。 當要求的共享總數超過頁面大小上限時傳回。
|
value
|
FileShareItem[]
|
傳回的檔案共享清單。
|
LeaseDuration
指定共用上的租用是否為無限或固定的持續時間,只有在共用租用時。
名稱 |
類型 |
Description |
Fixed
|
string
|
|
Infinite
|
string
|
|
LeaseState
共用的租用狀態。
名稱 |
類型 |
Description |
Available
|
string
|
|
Breaking
|
string
|
|
Broken
|
string
|
|
Expired
|
string
|
|
Leased
|
string
|
|
LeaseStatus
共用的租用狀態。
名稱 |
類型 |
Description |
Locked
|
string
|
|
Unlocked
|
string
|
|
RootSquashType
屬性僅適用於 NFS 共用。 預設值為 NoRootSquash。
名稱 |
類型 |
Description |
AllSquash
|
string
|
|
NoRootSquash
|
string
|
|
RootSquash
|
string
|
|
ShareAccessTier
特定共用的存取層。 GpV2 帳戶可以選擇 TransactionOptimized (預設)、經常性存取和非經常性存取。 FileStorage 帳戶可以選擇 [進階]。
名稱 |
類型 |
Description |
Cool
|
string
|
|
Hot
|
string
|
|
Premium
|
string
|
|
TransactionOptimized
|
string
|
|
SignedIdentifier
名稱 |
類型 |
Description |
accessPolicy
|
AccessPolicy
|
存取原則
|
id
|
string
|
預存存取原則的唯一標識符。
|