ShareServiceClient class
ShareServiceClient는 파일 공유를 조작할 수 있는 Azure Storage 파일 서비스에 대한 URL을 나타냅니다.
- Extends
-
StorageClient
생성자
| Share |
ShareServiceClient의 인스턴스를 만듭니다. |
| Share |
ShareServiceClient의 인스턴스를 만듭니다. |
상속된 속성
| account |
|
| url | URL 문자열 값입니다. |
메서드
| create |
공유를 만듭니다. |
| delete |
공유를 삭제합니다. |
| from |
연결 문자열에서 ShareServiceClient의 인스턴스를 만듭니다. |
| generate |
공유 키 자격 증명을 사용하여 생성된 ShareServiceClient에만 사용할 수 있습니다. 전달된 클라이언트 속성 및 매개 변수를 기반으로 계정 SAS(공유 액세스 서명) URI를 생성합니다. SAS는 클라이언트의 공유 키 자격 증명으로 서명됩니다. https://learn.microsoft.com/rest/api/storageservices/create-account-sas 참조 |
| generate |
공유 키 자격 증명을 사용하여 생성된 ShareServiceClient에만 사용할 수 있습니다. 전달된 클라이언트 속성 및 매개 변수를 기반으로 계정 SAS(공유 액세스 서명) URI에 로그인하는 문자열을 생성합니다. SAS는 클라이언트의 공유 키 자격 증명으로 서명됩니다. https://learn.microsoft.com/rest/api/storageservices/create-account-sas 참조 |
| get |
스토리지 분석 및 CORS(원본 간 리소스 공유) 규칙에 대한 속성을 포함하여 스토리지 계정의 파일 서비스의 속성을 가져옵니다. https://learn.microsoft.com/rest/api/storageservices/get-file-service-properties 참조 |
| get |
ShareClient 개체를 만듭니다. |
| list |
지정된 계정의 모든 공유를 나열하는 비동기 반복기를 반환합니다. .byPage()는 비동기 반복 반복기를 반환하여 페이지에 공유를 나열합니다.
표식과 함께 페이징을 사용하는 예제:
|
| set |
스토리지 분석, CORS(원본 간 리소스 공유) 규칙 및 일시 삭제 설정에 대한 속성을 포함하여 스토리지 계정의 파일 서비스 엔드포인트에 대한 속성을 설정합니다. https://learn.microsoft.com/rest/api/storageservices/set-file-service-properties 참조 |
| undelete |
이전에 삭제된 공유를 복원합니다. 이 API는 공유와 연결된 스토리지 계정에 대해 공유 일시 삭제를 사용하도록 설정한 경우에만 작동합니다. |
생성자 세부 정보
ShareServiceClient(string, Credential | TokenCredential, ShareClientOptions)
ShareServiceClient의 인스턴스를 만듭니다.
new ShareServiceClient(url: string, credential?: Credential | TokenCredential, options?: ShareClientOptions)
매개 변수
- url
-
string
"https://myaccount.file.core.windows.net"와 같은 Azure Storage 파일 서비스를 가리키는 URL 문자열입니다. AnonymousCredential을 사용하는 경우 SAS를 추가할 수 있습니다(예: "https://myaccount.file.core.windows.net?sasString").
- credential
AnonymousCredential, StorageSharedKeyCredential 또는 TokenCredential과 같이 지정하지 않으면 AnonymousCredential이 사용됩니다.
- options
- ShareClientOptions
Optional. HTTP 파이프라인을 구성하는 옵션입니다.
ShareServiceClient(string, Pipeline, ShareClientConfig)
ShareServiceClient의 인스턴스를 만듭니다.
new ShareServiceClient(url: string, pipeline: Pipeline, options?: ShareClientConfig)
매개 변수
- url
-
string
"https://myaccount.file.core.windows.net"와 같은 Azure Storage 파일 서비스를 가리키는 URL 문자열입니다. AnonymousCredential을 사용하는 경우 SAS를 추가할 수 있습니다(예: "https://myaccount.file.core.windows.net?sasString").
- pipeline
- Pipeline
newPipeline()을 호출하여 기본 파이프라인을 만들거나 사용자 지정된 파이프라인을 제공합니다.
- options
- ShareClientConfig
Optional. HTTP 파이프라인을 구성하는 옵션입니다.
상속된 속성 세부 정보
accountName
accountName: string
속성 값
string
StorageClient.accountName에서 상속된
url
URL 문자열 값입니다.
url: string
속성 값
string
StorageClient.url에서 상속된
메서드 세부 정보
createShare(string, ShareCreateOptions)
공유를 만듭니다.
function createShare(shareName: string, options?: ShareCreateOptions): Promise<{ shareClient: ShareClient, shareCreateResponse: ShareCreateResponse }>
매개 변수
- shareName
-
string
- options
- ShareCreateOptions
반환
Promise<{ shareClient: ShareClient, shareCreateResponse: ShareCreateResponse }>
만들기 응답 및 해당 공유 클라이언트를 공유합니다.
deleteShare(string, ShareDeleteMethodOptions)
공유를 삭제합니다.
function deleteShare(shareName: string, options?: ShareDeleteMethodOptions): Promise<ShareDeleteResponse>
매개 변수
- shareName
-
string
- options
- ShareDeleteMethodOptions
반환
Promise<ShareDeleteResponse>
삭제 응답 및 해당 공유 클라이언트를 공유합니다.
fromConnectionString(string, ShareClientOptions)
연결 문자열에서 ShareServiceClient의 인스턴스를 만듭니다.
static function fromConnectionString(connectionString: string, options?: ShareClientOptions): ShareServiceClient
매개 변수
- connectionString
-
string
Azure Storage 계정의 계정 연결 문자열 또는 SAS 연결 문자열입니다.
[ 참고 - 계정 연결 문자열은 NODE.JS 런타임에서만 사용할 수 있습니다. ] 계정 연결 문자열 예제 -
DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net SAS 연결 문자열 예제 - BlobEndpoint=https://myaccount.blob.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString
- options
- ShareClientOptions
HTTP 파이프라인을 구성하는 옵션입니다.
반환
지정된 연결 문자열의 새 ShareServiceClient입니다.
generateAccountSasUrl(Date, AccountSASPermissions, string, ServiceGenerateAccountSasUrlOptions)
공유 키 자격 증명을 사용하여 생성된 ShareServiceClient에만 사용할 수 있습니다.
전달된 클라이언트 속성 및 매개 변수를 기반으로 계정 SAS(공유 액세스 서명) URI를 생성합니다. SAS는 클라이언트의 공유 키 자격 증명으로 서명됩니다.
https://learn.microsoft.com/rest/api/storageservices/create-account-sas 참조
function generateAccountSasUrl(expiresOn?: Date, permissions?: AccountSASPermissions, resourceTypes?: string, options?: ServiceGenerateAccountSasUrlOptions): string
매개 변수
- expiresOn
-
Date
Optional. 공유 액세스 서명이 유효하지 않은 시간입니다. 지정하지 않으면 기본적으로 1시간 후로 설정됩니다.
- permissions
- AccountSASPermissions
SAS와 연결할 사용 권한 목록을 지정합니다.
- resourceTypes
-
string
공유 액세스 서명과 연결된 리소스 유형을 지정합니다.
선택적 매개 변수입니다.
반환
string
이 클라이언트가 나타내는 리소스에 대한 URI로 구성된 계정 SAS URI와 생성된 SAS 토큰이 뒤따릅니다.
generateSasStringToSign(Date, AccountSASPermissions, string, ServiceGenerateAccountSasUrlOptions)
공유 키 자격 증명을 사용하여 생성된 ShareServiceClient에만 사용할 수 있습니다.
전달된 클라이언트 속성 및 매개 변수를 기반으로 계정 SAS(공유 액세스 서명) URI에 로그인하는 문자열을 생성합니다. SAS는 클라이언트의 공유 키 자격 증명으로 서명됩니다.
https://learn.microsoft.com/rest/api/storageservices/create-account-sas 참조
function generateSasStringToSign(expiresOn?: Date, permissions?: AccountSASPermissions, resourceTypes?: string, options?: ServiceGenerateAccountSasUrlOptions): string
매개 변수
- expiresOn
-
Date
Optional. 공유 액세스 서명이 유효하지 않은 시간입니다. 지정하지 않으면 기본적으로 1시간 후로 설정됩니다.
- permissions
- AccountSASPermissions
SAS와 연결할 사용 권한 목록을 지정합니다.
- resourceTypes
-
string
공유 액세스 서명과 연결된 리소스 유형을 지정합니다.
선택적 매개 변수입니다.
반환
string
이 클라이언트가 나타내는 리소스에 대한 URI로 구성된 계정 SAS URI와 생성된 SAS 토큰이 뒤따릅니다.
getProperties(ServiceGetPropertiesOptions)
스토리지 분석 및 CORS(원본 간 리소스 공유) 규칙에 대한 속성을 포함하여 스토리지 계정의 파일 서비스의 속성을 가져옵니다.
https://learn.microsoft.com/rest/api/storageservices/get-file-service-properties 참조
function getProperties(options?: ServiceGetPropertiesOptions): Promise<ServiceGetPropertiesResponse>
매개 변수
- options
- ServiceGetPropertiesOptions
속성 가져오기 작업 옵션입니다.
반환
Promise<ServiceGetPropertiesResponse>
속성 가져오기 작업에 대한 응답 데이터입니다.
getShareClient(string)
ShareClient 개체를 만듭니다.
function getShareClient(shareName: string): ShareClient
매개 변수
- shareName
-
string
공유의 이름입니다.
반환
지정된 공유 이름의 ShareClient 개체입니다.
사용 예:
import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
const account = "<account>";
const accountKey = "<accountkey>";
const credential = new StorageSharedKeyCredential(account, accountKey);
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
credential,
);
const shareName = "<share name>";
const shareClient = serviceClient.getShareClient(shareName);
await shareClient.create();
listShares(ServiceListSharesOptions)
지정된 계정의 모든 공유를 나열하는 비동기 반복기를 반환합니다.
.byPage()는 비동기 반복 반복기를 반환하여 페이지에 공유를 나열합니다.
for await 구문을 사용하는 예제:
import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
const account = "<account>";
const accountKey = "<accountkey>";
const credential = new StorageSharedKeyCredential(account, accountKey);
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
credential,
);
let i = 1;
for await (const share of serviceClient.listShares()) {
console.log(`Share${i++}: ${share.name}`);
}
iter.next()사용하는 예제:
import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
const account = "<account>";
const accountKey = "<accountkey>";
const credential = new StorageSharedKeyCredential(account, accountKey);
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
credential,
);
const shareIter = serviceClient.listShares();
let i = 1;
let { value, done } = await shareIter.next();
while (!done) {
console.log(`Share ${i++}: ${value.name}`);
({ value, done } = await shareIter.next());
}
byPage()사용하는 예제:
import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
const account = "<account>";
const accountKey = "<accountkey>";
const credential = new StorageSharedKeyCredential(account, accountKey);
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
credential,
);
let i = 1;
for await (const response of serviceClient.listShares().byPage({ maxPageSize: 20 })) {
console.log(`Page ${i++}:`);
for (const share of response.shareItems || []) {
console.log(`\tShare: ${share.name}`);
}
}
표식과 함께 페이징을 사용하는 예제:
import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
const account = "<account>";
const accountKey = "<accountkey>";
const credential = new StorageSharedKeyCredential(account, accountKey);
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
credential,
);
let iterator = serviceClient.listShares().byPage({ maxPageSize: 2 });
let response = (await iterator.next()).value;
for await (const share of response.shareItems || []) {
console.log(`\tShare: ${share.name}`);
}
// Gets next marker
let marker = response.continuationToken;
// Passing next marker as continuationToken
iterator = serviceClient.listShares().byPage({ continuationToken: marker, maxPageSize: 10 });
response = (await iterator.next()).value;
for await (const share of response.shareItems || []) {
console.log(`\tShare: ${share.name}`);
}
function listShares(options?: ServiceListSharesOptions): PagedAsyncIterableIterator<ShareItem, ServiceListSharesSegmentResponse, PageSettings>
매개 변수
반환
setProperties(FileServiceProperties, ServiceSetPropertiesOptions)
스토리지 분석, CORS(원본 간 리소스 공유) 규칙 및 일시 삭제 설정에 대한 속성을 포함하여 스토리지 계정의 파일 서비스 엔드포인트에 대한 속성을 설정합니다.
https://learn.microsoft.com/rest/api/storageservices/set-file-service-properties 참조
function setProperties(properties: FileServiceProperties, options?: ServiceSetPropertiesOptions): Promise<ServiceSetPropertiesResponse>
매개 변수
- properties
- FileServiceProperties
- options
- ServiceSetPropertiesOptions
속성 설정 작업에 대한 옵션입니다.
반환
Promise<ServiceSetPropertiesResponse>
속성 설정 작업에 대한 응답 데이터입니다.
undeleteShare(string, string, ServiceUndeleteShareOptions)
이전에 삭제된 공유를 복원합니다. 이 API는 공유와 연결된 스토리지 계정에 대해 공유 일시 삭제를 사용하도록 설정한 경우에만 작동합니다.
function undeleteShare(deletedShareName: string, deletedShareVersion: string, options?: ServiceUndeleteShareOptions): Promise<ShareClient>
매개 변수
- deletedShareName
-
string
이전에 삭제된 공유의 이름입니다.
- deletedShareVersion
-
string
이전에 삭제된 공유의 버전입니다.
- options
- ServiceUndeleteShareOptions
삭제 취소 작업을 공유하는 옵션입니다.
반환
Promise<ShareClient>
복원된 공유.