diff --git a/sdk/purview/purview-administration-rest/CHANGELOG.md b/sdk/purview/purview-administration-rest/CHANGELOG.md index d3cc776e34b6..4d79f91a865c 100644 --- a/sdk/purview/purview-administration-rest/CHANGELOG.md +++ b/sdk/purview/purview-administration-rest/CHANGELOG.md @@ -1,14 +1,10 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.2 (2024-12-16) ### Features Added -### Breaking Changes - -### Bugs Fixed - -### Other Changes +- refresh @azure-rest/purview-administration sdk ## 1.0.0-beta.1 (2021-10-15) diff --git a/sdk/purview/purview-administration-rest/package.json b/sdk/purview/purview-administration-rest/package.json index e5fd51704d88..9a34bed7a611 100644 --- a/sdk/purview/purview-administration-rest/package.json +++ b/sdk/purview/purview-administration-rest/package.json @@ -80,7 +80,6 @@ "dependencies": { "@azure-rest/core-client": "^2.3.1", "@azure/core-auth": "^1.9.0", - "@azure/core-paging": "^1.6.2", "@azure/core-rest-pipeline": "^1.18.0", "@azure/logger": "^1.1.4", "tslib": "^2.8.1" diff --git a/sdk/purview/purview-administration-rest/review/purview-administration.api.md b/sdk/purview/purview-administration-rest/review/purview-administration.api.md index 707de45c5e22..68678a39342c 100644 --- a/sdk/purview/purview-administration-rest/review/purview-administration.api.md +++ b/sdk/purview/purview-administration-rest/review/purview-administration.api.md @@ -7,85 +7,85 @@ import type { Client } from '@azure-rest/core-client'; import type { ClientOptions } from '@azure-rest/core-client'; import type { HttpResponse } from '@azure-rest/core-client'; -import type { PagedAsyncIterableIterator } from '@azure/core-paging'; import type { PathUncheckedResponse } from '@azure-rest/core-client'; import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; import type { TokenCredential } from '@azure/core-auth'; -// @public (undocumented) +// @public interface AccessKeyOptions { keyType?: "PrimaryAtlasKafkaKey" | "SecondaryAtlasKafkaKey"; } -// @public (undocumented) -interface AccessKeys { +// @public +interface AccessKeysOutput { atlasKafkaPrimaryEndpoint?: string; atlasKafkaSecondaryEndpoint?: string; } -// @public (undocumented) -interface Account { - id?: string; - identity?: Identity; - location?: string; - name?: string; - properties?: AccountProperties; - sku?: AccountSku; - systemData?: AccountSystemData; - tags?: Record; - type?: string; +// @public +interface AccountEndpointsOutput { + readonly catalog?: string; + readonly guardian?: string; + readonly scan?: string; } -// @public (undocumented) -interface AccountEndpoints { - catalog?: string; - guardian?: string; - scan?: string; +// @public +interface AccountOutput { + readonly id?: string; + identity?: IdentityOutput; + location?: string; + readonly name?: string; + properties?: AccountPropertiesOutput; + sku?: AccountSkuOutput; + readonly systemData?: AccountSystemDataOutput; + tags?: Record; + readonly type?: string; } -// @public (undocumented) -interface AccountProperties { - cloudConnectors?: CloudConnectors; - createdAt?: Date; - createdBy?: string; - createdByObjectId?: string; - endpoints?: AccountPropertiesEndpoints; - friendlyName?: string; - managedResourceGroupName?: string; - managedResources?: AccountPropertiesManagedResources; - privateEndpointConnections?: Array; - provisioningState?: "Unknown" | "Creating" | "Moving" | "Deleting" | "SoftDeleting" | "SoftDeleted" | "Failed" | "Succeeded" | "Canceled"; - publicNetworkAccess?: "NotSpecified" | "Enabled" | "Disabled"; +// @public +interface AccountPropertiesEndpointsOutput extends AccountEndpointsOutput { } -// @public (undocumented) -interface AccountPropertiesEndpoints extends AccountEndpoints { +// @public +interface AccountPropertiesManagedResourcesOutput extends ManagedResourcesOutput { } -// @public (undocumented) -interface AccountPropertiesManagedResources extends ManagedResources { +// @public +interface AccountPropertiesOutput { + cloudConnectors?: CloudConnectorsOutput; + readonly createdAt?: string; + readonly createdBy?: string; + readonly createdByObjectId?: string; + readonly endpoints?: AccountPropertiesEndpointsOutput; + readonly friendlyName?: string; + managedResourceGroupName?: string; + readonly managedResources?: AccountPropertiesManagedResourcesOutput; + readonly privateEndpointConnections?: Array; + readonly provisioningState?: "Unknown" | "Creating" | "Moving" | "Deleting" | "SoftDeleting" | "SoftDeleted" | "Failed" | "Succeeded" | "Canceled"; + publicNetworkAccess?: "NotSpecified" | "Enabled" | "Disabled"; } // @public (undocumented) interface AccountsGetAccessKeys { - post(options?: AccountsGetAccessKeysParameters): Promise; + post(options?: AccountsGetAccessKeysParameters): StreamableMethod; } // @public interface AccountsGetAccessKeys200Response extends HttpResponse { // (undocumented) - body: AccessKeys; + body: AccessKeysOutput; // (undocumented) status: "200"; } // @public -interface AccountsGetAccessKeysdefaultResponse extends HttpResponse { +interface AccountsGetAccessKeysDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel; + body: ErrorResponseModelOutput_2; // (undocumented) - status: "500"; + status: string; } // @public (undocumented) @@ -93,44 +93,44 @@ type AccountsGetAccessKeysParameters = RequestParameters; // @public (undocumented) interface AccountsGetAccountProperties { - get(options?: AccountsGetAccountPropertiesParameters): Promise; - patch(options: AccountsUpdateAccountPropertiesParameters): Promise; + get(options?: AccountsGetAccountPropertiesParameters): StreamableMethod; + patch(options: AccountsUpdateAccountPropertiesParameters): StreamableMethod; } // @public interface AccountsGetAccountProperties200Response extends HttpResponse { // (undocumented) - body: Account; + body: AccountOutput; // (undocumented) status: "200"; } // @public -interface AccountsGetAccountPropertiesdefaultResponse extends HttpResponse { +interface AccountsGetAccountPropertiesDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel; + body: ErrorResponseModelOutput_2; // (undocumented) - status: "500"; + status: string; } // @public (undocumented) type AccountsGetAccountPropertiesParameters = RequestParameters; -// @public (undocumented) -interface AccountSku { +// @public +interface AccountSkuOutput { capacity?: number; name?: "Standard"; } // @public (undocumented) interface AccountsRegenerateAccessKey { - post(options: AccountsRegenerateAccessKeyParameters): Promise; + post(options: AccountsRegenerateAccessKeyParameters): StreamableMethod; } // @public interface AccountsRegenerateAccessKey200Response extends HttpResponse { // (undocumented) - body: AccessKeys; + body: AccessKeysOutput; // (undocumented) status: "200"; } @@ -142,20 +142,25 @@ interface AccountsRegenerateAccessKeyBodyParam { } // @public -interface AccountsRegenerateAccessKeydefaultResponse extends HttpResponse { +interface AccountsRegenerateAccessKeyDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel; + body: ErrorResponseModelOutput_2; // (undocumented) - status: "500"; + status: string; +} + +// @public (undocumented) +interface AccountsRegenerateAccessKeyMediaTypesParam { + contentType?: "application/json"; } // @public (undocumented) -type AccountsRegenerateAccessKeyParameters = AccountsRegenerateAccessKeyBodyParam & RequestParameters; +type AccountsRegenerateAccessKeyParameters = AccountsRegenerateAccessKeyMediaTypesParam & AccountsRegenerateAccessKeyBodyParam & RequestParameters; // @public interface AccountsUpdateAccountProperties200Response extends HttpResponse { // (undocumented) - body: Account; + body: AccountOutput; // (undocumented) status: "200"; } @@ -167,27 +172,42 @@ interface AccountsUpdateAccountPropertiesBodyParam { } // @public -interface AccountsUpdateAccountPropertiesdefaultResponse extends HttpResponse { +interface AccountsUpdateAccountPropertiesDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel; + body: ErrorResponseModelOutput_2; // (undocumented) - status: "500"; + status: string; } // @public (undocumented) -type AccountsUpdateAccountPropertiesParameters = AccountsUpdateAccountPropertiesBodyParam & RequestParameters; +interface AccountsUpdateAccountPropertiesMediaTypesParam { + contentType?: "application/json"; +} // @public (undocumented) +type AccountsUpdateAccountPropertiesParameters = AccountsUpdateAccountPropertiesMediaTypesParam & AccountsUpdateAccountPropertiesBodyParam & RequestParameters; + +// @public interface AccountSystemData extends SystemData { } -// @public (undocumented) +// @public +interface AccountSystemDataOutput extends SystemDataOutput { +} + +// @public interface AdvancedResourceSet { - modifiedAt?: Date; + modifiedAt?: Date | string; resourceSetProcessing?: "Default" | "Advanced"; } -// @public (undocumented) +// @public +interface AdvancedResourceSetOutput { + modifiedAt?: string; + resourceSetProcessing?: "Default" | "Advanced"; +} + +// @public interface AttributeMatcher { attributeName?: string; attributeValueExcludedIn?: Array; @@ -196,15 +216,41 @@ interface AttributeMatcher { attributeValueIncludes?: string; } -// @public (undocumented) +// @public +interface AttributeMatcherOutput { + attributeName?: string; + attributeValueExcludedIn?: Array; + attributeValueExcludes?: string; + attributeValueIncludedIn?: Array; + attributeValueIncludes?: string; +} + +// @public interface AttributeRule { dnfCondition?: Array>; id?: string; - kind?: "decisionrule" | "attributerule"; + name?: string; +} + +// @public +interface AttributeRuleOutput { + dnfCondition?: Array>; + id?: string; + readonly kind?: "decisionrule" | "attributerule"; name?: string; } declare namespace Client_2 { + export { + MetadataRolesList, + MetadataPolicyListAll, + MetadataPolicyUpdate, + Routes, + PurviewMetadataPoliciesClient + } +} + +declare namespace Client_3 { export { AccountsGetAccountProperties, AccountsGetAccessKeys, @@ -215,78 +261,87 @@ declare namespace Client_2 { CollectionsGetCollectionPath, ResourceSetRulesGetResourceSetRule, ResourceSetRulesListResourceSetRules, - Routes, - PurviewAccountRestClient - } -} - -declare namespace Client_3 { - export { - MetadataRolesList, - MetadataPolicyListAll, - MetadataPolicyUpdate, Routes_2 as Routes, - PurviewMetadataPoliciesRestClient + PurviewAccountClient } } // @public (undocumented) -interface CloudConnectors { - awsExternalId?: string; +interface CloudConnectorsOutput { + readonly awsExternalId?: string; } -// @public (undocumented) +// @public interface Collection { - collectionProvisioningState?: "Unknown" | "Creating" | "Moving" | "Deleting" | "Failed" | "Succeeded"; description?: string; friendlyName?: string; - name?: string; - parentCollection?: CollectionReference; - systemData?: CollectionSystemData; + parentCollection?: CollectionReference_2; } -// @public (undocumented) -interface CollectionList { +// @public +interface CollectionListOutput { count?: number; nextLink?: string; - value: Array; -} - -// @public (undocumented) -interface CollectionNameResponse { - friendlyName?: string; - name?: string; + value: Array; } -// @public (undocumented) -interface CollectionNameResponseList { +// @public +interface CollectionNameResponseListOutput { count?: number; nextLink?: string; - value: Array; + value: Array; } -// @public (undocumented) -interface CollectionPathResponse { - parentFriendlyNameChain?: Array; - parentNameChain?: Array; +// @public +interface CollectionNameResponseOutput { + readonly friendlyName?: string; + readonly name?: string; } -// @public (undocumented) +// @public +interface CollectionOutput { + readonly collectionProvisioningState?: "Unknown" | "Creating" | "Moving" | "Deleting" | "Failed" | "Succeeded"; + description?: string; + friendlyName?: string; + readonly name?: string; + parentCollection?: CollectionReferenceOutput_2; + readonly systemData?: CollectionSystemDataOutput; +} + +// @public +interface CollectionPathResponseOutput { + readonly parentFriendlyNameChain?: Array; + readonly parentNameChain?: Array; +} + +// @public interface CollectionReference { referenceName?: string; type?: string; } -// @public (undocumented) +// @public interface CollectionReference_2 { referenceName?: string; type?: string; } +// @public +interface CollectionReferenceOutput { + referenceName?: string; + type?: string; +} + +// @public +interface CollectionReferenceOutput_2 { + referenceName?: string; + type?: string; +} + // @public interface CollectionsCreateOrUpdateCollection200Response extends HttpResponse { // (undocumented) - body: Collection; + body: CollectionOutput; // (undocumented) status: "200"; } @@ -298,30 +353,33 @@ interface CollectionsCreateOrUpdateCollectionBodyParam { } // @public -interface CollectionsCreateOrUpdateCollectiondefaultResponse extends HttpResponse { +interface CollectionsCreateOrUpdateCollectionDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel; + body: ErrorResponseModelOutput_2; // (undocumented) - status: "500"; + status: string; +} + +// @public (undocumented) +interface CollectionsCreateOrUpdateCollectionMediaTypesParam { + contentType?: "application/json"; } // @public (undocumented) -type CollectionsCreateOrUpdateCollectionParameters = CollectionsCreateOrUpdateCollectionBodyParam & RequestParameters; +type CollectionsCreateOrUpdateCollectionParameters = CollectionsCreateOrUpdateCollectionMediaTypesParam & CollectionsCreateOrUpdateCollectionBodyParam & RequestParameters; // @public interface CollectionsDeleteCollection204Response extends HttpResponse { - // (undocumented) - body: Record; // (undocumented) status: "204"; } // @public -interface CollectionsDeleteCollectiondefaultResponse extends HttpResponse { +interface CollectionsDeleteCollectionDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel; + body: ErrorResponseModelOutput_2; // (undocumented) - status: "500"; + status: string; } // @public (undocumented) @@ -329,25 +387,25 @@ type CollectionsDeleteCollectionParameters = RequestParameters; // @public (undocumented) interface CollectionsGetCollection { - delete(options?: CollectionsDeleteCollectionParameters): Promise; - get(options?: CollectionsGetCollectionParameters): Promise; - put(options: CollectionsCreateOrUpdateCollectionParameters): Promise; + delete(options?: CollectionsDeleteCollectionParameters): StreamableMethod; + get(options?: CollectionsGetCollectionParameters): StreamableMethod; + put(options: CollectionsCreateOrUpdateCollectionParameters): StreamableMethod; } // @public interface CollectionsGetCollection200Response extends HttpResponse { // (undocumented) - body: Collection; + body: CollectionOutput; // (undocumented) status: "200"; } // @public -interface CollectionsGetCollectiondefaultResponse extends HttpResponse { +interface CollectionsGetCollectionDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel; + body: ErrorResponseModelOutput_2; // (undocumented) - status: "500"; + status: string; } // @public (undocumented) @@ -355,23 +413,23 @@ type CollectionsGetCollectionParameters = RequestParameters; // @public (undocumented) interface CollectionsGetCollectionPath { - get(options?: CollectionsGetCollectionPathParameters): Promise; + get(options?: CollectionsGetCollectionPathParameters): StreamableMethod; } // @public interface CollectionsGetCollectionPath200Response extends HttpResponse { // (undocumented) - body: CollectionPathResponse; + body: CollectionPathResponseOutput; // (undocumented) status: "200"; } // @public -interface CollectionsGetCollectionPathdefaultResponse extends HttpResponse { +interface CollectionsGetCollectionPathDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel; + body: ErrorResponseModelOutput_2; // (undocumented) - status: "500"; + status: string; } // @public (undocumented) @@ -379,23 +437,23 @@ type CollectionsGetCollectionPathParameters = RequestParameters; // @public (undocumented) interface CollectionsListChildCollectionNames { - get(options?: CollectionsListChildCollectionNamesParameters): Promise; + get(options?: CollectionsListChildCollectionNamesParameters): StreamableMethod; } // @public interface CollectionsListChildCollectionNames200Response extends HttpResponse { // (undocumented) - body: CollectionNameResponseList; + body: CollectionNameResponseListOutput; // (undocumented) status: "200"; } // @public -interface CollectionsListChildCollectionNamesdefaultResponse extends HttpResponse { +interface CollectionsListChildCollectionNamesDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel; + body: ErrorResponseModelOutput_2; // (undocumented) - status: "500"; + status: string; } // @public (undocumented) @@ -415,23 +473,23 @@ interface CollectionsListChildCollectionNamesQueryParamProperties { // @public (undocumented) interface CollectionsListCollections { - get(options?: CollectionsListCollectionsParameters): Promise; + get(options?: CollectionsListCollectionsParameters): StreamableMethod; } // @public interface CollectionsListCollections200Response extends HttpResponse { // (undocumented) - body: CollectionList; + body: CollectionListOutput; // (undocumented) status: "200"; } // @public -interface CollectionsListCollectionsdefaultResponse extends HttpResponse { +interface CollectionsListCollectionsDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel; + body: ErrorResponseModelOutput_2; // (undocumented) - status: "500"; + status: string; } // @public (undocumented) @@ -449,10 +507,14 @@ interface CollectionsListCollectionsQueryParamProperties { $skipToken?: string; } -// @public (undocumented) +// @public interface CollectionSystemData extends SystemData { } +// @public +interface CollectionSystemDataOutput extends SystemDataOutput { +} + // @public (undocumented) interface ComplexReplacerConfig { // (undocumented) @@ -474,45 +536,77 @@ interface ComplexReplacerConfig { } // @public (undocumented) +interface ComplexReplacerConfigOutput { + // (undocumented) + createdBy?: string; + // (undocumented) + description?: string; + // (undocumented) + disabled?: boolean; + // (undocumented) + disableRecursiveReplacerApplication?: boolean; + // (undocumented) + lastUpdatedTimestamp?: number; + // (undocumented) + modifiedBy?: string; + // (undocumented) + name?: string; + // (undocumented) + typeName?: string; +} + +// @public +function createClient(endpoint: string, credentials: TokenCredential, { apiVersion, ...options }?: PurviewMetadataPoliciesClientOptions): PurviewMetadataPoliciesClient; + +// @public +function createClient_2(endpoint: string, credentials: TokenCredential, { apiVersion, ...options }?: PurviewAccountClientOptions): PurviewAccountClient; + +// @public interface DataPlaneAccountUpdateParameters { friendlyName?: string; } -// @public (undocumented) +// @public interface DecisionRule { dnfCondition?: Array>; effect?: "Deny" | "Permit"; - kind?: "decisionrule" | "attributerule"; } -// @public (undocumented) -interface ErrorModel { - code?: string; - details?: Array; - message?: string; - target?: string; +// @public +interface DecisionRuleOutput { + dnfCondition?: Array>; + effect?: "Deny" | "Permit"; + readonly kind?: "decisionrule" | "attributerule"; } -// @public (undocumented) -interface ErrorModel_2 { +// @public +interface ErrorModelOutput { code: string; - details?: Array; + details?: Array; message: string; target?: string; } -// @public (undocumented) -interface ErrorResponseModel { - error?: ErrorResponseModelError; +// @public +interface ErrorModelOutput_2 { + readonly code?: string; + readonly details?: Array; + readonly message?: string; + readonly target?: string; } -// @public (undocumented) -interface ErrorResponseModel_2 { - error: ErrorModel_2; +// @public +interface ErrorResponseModelErrorOutput extends ErrorModelOutput_2 { } -// @public (undocumented) -interface ErrorResponseModelError extends ErrorModel { +// @public +interface ErrorResponseModelOutput { + error: ErrorModelOutput; +} + +// @public +interface ErrorResponseModelOutput_2 { + readonly error?: ErrorResponseModelErrorOutput; } // @public (undocumented) @@ -541,6 +635,32 @@ interface FastRegex { regexStr?: string; } +// @public (undocumented) +interface FastRegexOutput { + // (undocumented) + maxDigits?: number; + // (undocumented) + maxLetters?: number; + // (undocumented) + minDashes?: number; + // (undocumented) + minDigits?: number; + // (undocumented) + minDigitsOrLetters?: number; + // (undocumented) + minDots?: number; + // (undocumented) + minHex?: number; + // (undocumented) + minLetters?: number; + // (undocumented) + minUnderscores?: number; + // (undocumented) + options?: number; + // (undocumented) + regexStr?: string; +} + // @public (undocumented) interface Filter { // (undocumented) @@ -557,6 +677,22 @@ interface Filter { path: string; } +// @public (undocumented) +interface FilterOutput { + // (undocumented) + createdBy?: string; + // (undocumented) + filterType?: "Pattern" | "Regex"; + // (undocumented) + lastUpdatedTimestamp?: number; + // (undocumented) + modifiedBy?: string; + // (undocumented) + name: string; + // (undocumented) + path: string; +} + // @public type GetArrayType = T extends Array ? TData : never; @@ -564,29 +700,83 @@ type GetArrayType = T extends Array ? TData : never; type GetArrayType_2 = T extends Array ? TData : never; // @public -type GetPage = (pageLink: string, maxPageSize?: number) => Promise<{ +type GetPage = (pageLink: string) => Promise<{ page: TPage; nextPageLink?: string; }>; // @public -type GetPage_2 = (pageLink: string, maxPageSize?: number) => Promise<{ +type GetPage_2 = (pageLink: string) => Promise<{ page: TPage; nextPageLink?: string; }>; -// @public (undocumented) -interface Identity { - principalId?: string; - tenantId?: string; +// @public +interface IdentityOutput { + readonly principalId?: string; + readonly tenantId?: string; type?: "SystemAssigned"; } // @public (undocumented) -interface ManagedResources { - eventHubNamespace?: string; - resourceGroup?: string; - storageAccount?: string; +function isUnexpected(response: MetadataRolesList200Response | MetadataRolesListDefaultResponse): response is MetadataRolesListDefaultResponse; + +// @public (undocumented) +function isUnexpected(response: MetadataPolicyListAll200Response | MetadataPolicyListAllDefaultResponse): response is MetadataPolicyListAllDefaultResponse; + +// @public (undocumented) +function isUnexpected(response: MetadataPolicyUpdate200Response | MetadataPolicyUpdateDefaultResponse): response is MetadataPolicyUpdateDefaultResponse; + +// @public (undocumented) +function isUnexpected(response: MetadataPolicyGet200Response | MetadataPolicyGetDefaultResponse): response is MetadataPolicyGetDefaultResponse; + +// @public (undocumented) +function isUnexpected_2(response: AccountsGetAccountProperties200Response | AccountsGetAccountPropertiesDefaultResponse): response is AccountsGetAccountPropertiesDefaultResponse; + +// @public (undocumented) +function isUnexpected_2(response: AccountsUpdateAccountProperties200Response | AccountsUpdateAccountPropertiesDefaultResponse): response is AccountsUpdateAccountPropertiesDefaultResponse; + +// @public (undocumented) +function isUnexpected_2(response: AccountsGetAccessKeys200Response | AccountsGetAccessKeysDefaultResponse): response is AccountsGetAccessKeysDefaultResponse; + +// @public (undocumented) +function isUnexpected_2(response: AccountsRegenerateAccessKey200Response | AccountsRegenerateAccessKeyDefaultResponse): response is AccountsRegenerateAccessKeyDefaultResponse; + +// @public (undocumented) +function isUnexpected_2(response: CollectionsGetCollection200Response | CollectionsGetCollectionDefaultResponse): response is CollectionsGetCollectionDefaultResponse; + +// @public (undocumented) +function isUnexpected_2(response: CollectionsCreateOrUpdateCollection200Response | CollectionsCreateOrUpdateCollectionDefaultResponse): response is CollectionsCreateOrUpdateCollectionDefaultResponse; + +// @public (undocumented) +function isUnexpected_2(response: CollectionsDeleteCollection204Response | CollectionsDeleteCollectionDefaultResponse): response is CollectionsDeleteCollectionDefaultResponse; + +// @public (undocumented) +function isUnexpected_2(response: CollectionsListCollections200Response | CollectionsListCollectionsDefaultResponse): response is CollectionsListCollectionsDefaultResponse; + +// @public (undocumented) +function isUnexpected_2(response: CollectionsListChildCollectionNames200Response | CollectionsListChildCollectionNamesDefaultResponse): response is CollectionsListChildCollectionNamesDefaultResponse; + +// @public (undocumented) +function isUnexpected_2(response: CollectionsGetCollectionPath200Response | CollectionsGetCollectionPathDefaultResponse): response is CollectionsGetCollectionPathDefaultResponse; + +// @public (undocumented) +function isUnexpected_2(response: ResourceSetRulesGetResourceSetRule200Response | ResourceSetRulesGetResourceSetRuleDefaultResponse): response is ResourceSetRulesGetResourceSetRuleDefaultResponse; + +// @public (undocumented) +function isUnexpected_2(response: ResourceSetRulesCreateOrUpdateResourceSetRule200Response | ResourceSetRulesCreateOrUpdateResourceSetRuleDefaultResponse): response is ResourceSetRulesCreateOrUpdateResourceSetRuleDefaultResponse; + +// @public (undocumented) +function isUnexpected_2(response: ResourceSetRulesDeleteResourceSetRule200Response | ResourceSetRulesDeleteResourceSetRule204Response | ResourceSetRulesDeleteResourceSetRuleDefaultResponse): response is ResourceSetRulesDeleteResourceSetRuleDefaultResponse; + +// @public (undocumented) +function isUnexpected_2(response: ResourceSetRulesListResourceSetRules200Response | ResourceSetRulesListResourceSetRulesDefaultResponse): response is ResourceSetRulesListResourceSetRulesDefaultResponse; + +// @public +interface ManagedResourcesOutput { + readonly eventHubNamespace?: string; + readonly resourceGroup?: string; + readonly storageAccount?: string; } // @public (undocumented) @@ -601,63 +791,55 @@ interface MetadataPolicy { // @public interface MetadataPolicyGet200Response extends HttpResponse { // (undocumented) - body: MetadataPolicy; + body: MetadataPolicyOutput; // (undocumented) status: "200"; } // @public (undocumented) -interface MetadataPolicyGetdefaultHeaders { +interface MetadataPolicyGetDefaultHeaders { "x-ms-error-code"?: string; } // @public -interface MetadataPolicyGetdefaultResponse extends HttpResponse { +interface MetadataPolicyGetDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel_2; + body: ErrorResponseModelOutput; // (undocumented) - headers: RawHttpHeaders & MetadataPolicyGetdefaultHeaders; + headers: RawHttpHeaders & MetadataPolicyGetDefaultHeaders; // (undocumented) - status: "500"; + status: string; } // @public (undocumented) type MetadataPolicyGetParameters = RequestParameters; -// @public (undocumented) -interface MetadataPolicyList { - // (undocumented) - nextLink?: string; - // (undocumented) - values: Array; -} - // @public (undocumented) interface MetadataPolicyListAll { - get(options?: MetadataPolicyListAllParameters): Promise; + get(options?: MetadataPolicyListAllParameters): StreamableMethod; } // @public interface MetadataPolicyListAll200Response extends HttpResponse { // (undocumented) - body: MetadataPolicyList; + body: MetadataPolicyListOutput; // (undocumented) status: "200"; } // @public (undocumented) -interface MetadataPolicyListAlldefaultHeaders { +interface MetadataPolicyListAllDefaultHeaders { "x-ms-error-code"?: string; } // @public -interface MetadataPolicyListAlldefaultResponse extends HttpResponse { +interface MetadataPolicyListAllDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel_2; + body: ErrorResponseModelOutput; // (undocumented) - headers: RawHttpHeaders & MetadataPolicyListAlldefaultHeaders; + headers: RawHttpHeaders & MetadataPolicyListAllDefaultHeaders; // (undocumented) - status: "500"; + status: string; } // @public (undocumented) @@ -674,25 +856,51 @@ interface MetadataPolicyListAllQueryParamProperties { collectionName?: string; } -// @public (undocumented) -interface MetadataPolicyProperties { - attributeRules?: Array; - collection?: CollectionReference_2; - decisionRules?: Array; - description?: string; +// @public +interface MetadataPolicyListOutput { + // (undocumented) + nextLink?: string; + // (undocumented) + values: Array; +} + +// @public (undocumented) +interface MetadataPolicyOutput { + id?: string; + name?: string; + // (undocumented) + properties?: MetadataPolicyPropertiesOutput; + version?: number; +} + +// @public (undocumented) +interface MetadataPolicyProperties { + attributeRules?: Array; + collection?: CollectionReference; + decisionRules?: Array; + description?: string; + parentCollectionName?: string; +} + +// @public (undocumented) +interface MetadataPolicyPropertiesOutput { + attributeRules?: Array; + collection?: CollectionReferenceOutput; + decisionRules?: Array; + description?: string; parentCollectionName?: string; } // @public (undocumented) interface MetadataPolicyUpdate { - get(options?: MetadataPolicyGetParameters): Promise; - put(options?: MetadataPolicyUpdateParameters): Promise; + get(options?: MetadataPolicyGetParameters): StreamableMethod; + put(options?: MetadataPolicyUpdateParameters): StreamableMethod; } // @public interface MetadataPolicyUpdate200Response extends HttpResponse { // (undocumented) - body: MetadataPolicy; + body: MetadataPolicyOutput; // (undocumented) status: "200"; } @@ -703,45 +911,50 @@ interface MetadataPolicyUpdateBodyParam { } // @public (undocumented) -interface MetadataPolicyUpdatedefaultHeaders { +interface MetadataPolicyUpdateDefaultHeaders { "x-ms-error-code"?: string; } // @public -interface MetadataPolicyUpdatedefaultResponse extends HttpResponse { +interface MetadataPolicyUpdateDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel_2; + body: ErrorResponseModelOutput; // (undocumented) - headers: RawHttpHeaders & MetadataPolicyUpdatedefaultHeaders; + headers: RawHttpHeaders & MetadataPolicyUpdateDefaultHeaders; // (undocumented) - status: "500"; + status: string; } // @public (undocumented) -type MetadataPolicyUpdateParameters = MetadataPolicyUpdateBodyParam & RequestParameters; +interface MetadataPolicyUpdateMediaTypesParam { + contentType?: "application/json"; +} // @public (undocumented) -interface MetadataRole { - id?: string; - name?: string; +type MetadataPolicyUpdateParameters = MetadataPolicyUpdateMediaTypesParam & MetadataPolicyUpdateBodyParam & RequestParameters; + +// @public +interface MetadataRoleListOutput { // (undocumented) - properties?: MetadataRoleProperties; - type?: string; + nextLink?: string; + // (undocumented) + values: Array; } // @public (undocumented) -interface MetadataRoleList { - // (undocumented) - nextLink?: string; +interface MetadataRoleOutput { + id?: string; + name?: string; // (undocumented) - values: Array; + properties?: MetadataRolePropertiesOutput; + type?: string; } // @public (undocumented) -interface MetadataRoleProperties { - cnfCondition?: Array>; +interface MetadataRolePropertiesOutput { + cnfCondition?: Array>; description?: string; - dnfCondition?: Array>; + dnfCondition?: Array>; friendlyName?: string; provisioningState?: string; roleType?: string; @@ -750,30 +963,30 @@ interface MetadataRoleProperties { // @public (undocumented) interface MetadataRolesList { - get(options?: MetadataRolesListParameters): Promise; + get(options?: MetadataRolesListParameters): StreamableMethod; } // @public interface MetadataRolesList200Response extends HttpResponse { // (undocumented) - body: MetadataRoleList; + body: MetadataRoleListOutput; // (undocumented) status: "200"; } // @public (undocumented) -interface MetadataRolesListdefaultHeaders { +interface MetadataRolesListDefaultHeaders { "x-ms-error-code"?: string; } // @public -interface MetadataRolesListdefaultResponse extends HttpResponse { +interface MetadataRolesListDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel_2; + body: ErrorResponseModelOutput; // (undocumented) - headers: RawHttpHeaders & MetadataRolesListdefaultHeaders; + headers: RawHttpHeaders & MetadataRolesListDefaultHeaders; // (undocumented) - status: "500"; + status: string; } // @public (undocumented) @@ -781,34 +994,24 @@ type MetadataRolesListParameters = RequestParameters; declare namespace Models { export { - Account, - Identity, - AccountProperties, - CloudConnectors, - AccountEndpoints, - AccountPropertiesEndpoints, - ManagedResources, - AccountPropertiesManagedResources, - PrivateEndpointConnection, - PrivateEndpointConnectionProperties, - PrivateEndpoint, - PrivateLinkServiceConnectionState, - AccountSku, - SystemData, + AttributeMatcher, + MetadataPolicy, + MetadataPolicyProperties, + DecisionRule, + AttributeRule, + CollectionReference + } +} + +declare namespace Models_2 { + export { AccountSystemData, - ErrorResponseModel, - ErrorModel, - ErrorResponseModelError, + SystemData, DataPlaneAccountUpdateParameters, - AccessKeys, AccessKeyOptions, Collection, - CollectionReference, + CollectionReference_2 as CollectionReference, CollectionSystemData, - CollectionList, - CollectionNameResponseList, - CollectionNameResponse, - CollectionPathResponse, ResourceSetRuleConfig, AdvancedResourceSet, PathPatternExtractorConfig, @@ -818,25 +1021,7 @@ declare namespace Models { FastRegex, RegexReplacer, ScopedRule, - Rule, - ResourceSetRuleConfigList - } -} - -declare namespace Models_2 { - export { - MetadataRoleList, - MetadataRole, - MetadataRoleProperties, - AttributeMatcher, - ErrorResponseModel_2 as ErrorResponseModel, - ErrorModel_2 as ErrorModel, - MetadataPolicyList, - MetadataPolicy, - MetadataPolicyProperties, - DecisionRule, - AttributeRule, - CollectionReference_2 as CollectionReference + Rule } } @@ -862,33 +1047,122 @@ interface NormalizationRule { version?: number; } +// @public (undocumented) +interface NormalizationRuleOutput { + // (undocumented) + description?: string; + // (undocumented) + disabled?: boolean; + // (undocumented) + dynamicReplacement?: boolean; + // (undocumented) + entityTypes?: Array; + // (undocumented) + lastUpdatedTimestamp?: number; + // (undocumented) + name?: string; + // (undocumented) + regex?: FastRegexOutput; + // (undocumented) + replaceWith?: string; + // (undocumented) + version?: number; +} + +declare namespace OutputModels { + export { + MetadataRoleListOutput, + MetadataRoleOutput, + MetadataRolePropertiesOutput, + AttributeMatcherOutput, + ErrorResponseModelOutput, + ErrorModelOutput, + MetadataPolicyListOutput, + MetadataPolicyOutput, + MetadataPolicyPropertiesOutput, + DecisionRuleOutput, + AttributeRuleOutput, + CollectionReferenceOutput + } +} + +declare namespace OutputModels_2 { + export { + AccountOutput, + IdentityOutput, + AccountPropertiesOutput, + CloudConnectorsOutput, + AccountPropertiesEndpointsOutput, + AccountEndpointsOutput, + AccountPropertiesManagedResourcesOutput, + ManagedResourcesOutput, + PrivateEndpointConnectionOutput, + PrivateEndpointConnectionPropertiesOutput, + PrivateEndpointOutput, + PrivateLinkServiceConnectionStateOutput, + AccountSkuOutput, + AccountSystemDataOutput, + SystemDataOutput, + ErrorResponseModelOutput_2 as ErrorResponseModelOutput, + ErrorResponseModelErrorOutput, + ErrorModelOutput_2 as ErrorModelOutput, + AccessKeysOutput, + CollectionOutput, + CollectionReferenceOutput_2 as CollectionReferenceOutput, + CollectionSystemDataOutput, + CollectionListOutput, + CollectionNameResponseListOutput, + CollectionNameResponseOutput, + CollectionPathResponseOutput, + ResourceSetRuleConfigOutput, + AdvancedResourceSetOutput, + PathPatternExtractorConfigOutput, + FilterOutput, + ComplexReplacerConfigOutput, + NormalizationRuleOutput, + FastRegexOutput, + RegexReplacerOutput, + ScopedRuleOutput, + RuleOutput, + ResourceSetRuleConfigListOutput + } +} + // @public -function paginate(client: Client, initialResponse: TResponse, options?: PagingOptions): PagedAsyncIterableIterator>; +interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator; + next(): Promise>; +} // @public -function paginate_2(client: Client, initialResponse: TResponse, options?: PagingOptions_2): PagedAsyncIterableIterator>; +interface PagedAsyncIterableIterator_2 { + [Symbol.asyncIterator](): PagedAsyncIterableIterator_2; + byPage: (settings?: TPageSettings) => AsyncIterableIterator; + next(): Promise>; +} // @public -type PaginateReturn = TResult extends { - body: { - value?: infer TPage; - }; -} ? GetArrayType : Array; +interface PageSettings { + continuationToken?: string; +} // @public -type PaginateReturn_2 = TResult extends { - body: { - value?: infer TPage; - }; -} | { - body: { - values?: infer TPage; - }; -} ? GetArrayType_2 : Array; +interface PageSettings_2 { + continuationToken?: string; +} -declare namespace Pagination { +// @public +function paginate(client: Client, initialResponse: TResponse, options?: PagingOptions): PagedAsyncIterableIterator>; + +// @public +function paginate_2(client: Client, initialResponse: TResponse, options?: PagingOptions_2): PagedAsyncIterableIterator_2>; + +declare namespace PaginateHelper { export { paginate, + PageSettings, + PagedAsyncIterableIterator, GetArrayType, GetPage, PagingOptions, @@ -896,9 +1170,11 @@ declare namespace Pagination { } } -declare namespace Pagination_2 { +declare namespace PaginateHelper_2 { export { paginate_2 as paginate, + PageSettings_2 as PageSettings, + PagedAsyncIterableIterator_2 as PagedAsyncIterableIterator, GetArrayType_2 as GetArrayType, GetPage_2 as GetPage, PagingOptions_2 as PagingOptions, @@ -906,6 +1182,24 @@ declare namespace Pagination_2 { } } +// @public +type PaginateReturn = TResult extends { + body: { + value?: infer TPage; + }; +} | { + body: { + values?: infer TPage; + }; +} ? GetArrayType : Array; + +// @public +type PaginateReturn_2 = TResult extends { + body: { + value?: infer TPage; + }; +} ? GetArrayType_2 : Array; + // @public interface PagingOptions { customGetPage?: GetPage[]>; @@ -917,15 +1211,31 @@ interface PagingOptions_2 { } declare namespace Parameters_2 { + export { + MetadataRolesListParameters, + MetadataPolicyListAllQueryParamProperties, + MetadataPolicyListAllQueryParam, + MetadataPolicyListAllParameters, + MetadataPolicyUpdateBodyParam, + MetadataPolicyUpdateMediaTypesParam, + MetadataPolicyUpdateParameters, + MetadataPolicyGetParameters + } +} + +declare namespace Parameters_3 { export { AccountsGetAccountPropertiesParameters, AccountsUpdateAccountPropertiesBodyParam, + AccountsUpdateAccountPropertiesMediaTypesParam, AccountsUpdateAccountPropertiesParameters, AccountsGetAccessKeysParameters, AccountsRegenerateAccessKeyBodyParam, + AccountsRegenerateAccessKeyMediaTypesParam, AccountsRegenerateAccessKeyParameters, CollectionsGetCollectionParameters, CollectionsCreateOrUpdateCollectionBodyParam, + CollectionsCreateOrUpdateCollectionMediaTypesParam, CollectionsCreateOrUpdateCollectionParameters, CollectionsDeleteCollectionParameters, CollectionsListCollectionsQueryParamProperties, @@ -937,6 +1247,7 @@ declare namespace Parameters_2 { CollectionsGetCollectionPathParameters, ResourceSetRulesGetResourceSetRuleParameters, ResourceSetRulesCreateOrUpdateResourceSetRuleBodyParam, + ResourceSetRulesCreateOrUpdateResourceSetRuleMediaTypesParam, ResourceSetRulesCreateOrUpdateResourceSetRuleParameters, ResourceSetRulesDeleteResourceSetRuleParameters, ResourceSetRulesListResourceSetRulesQueryParamProperties, @@ -945,18 +1256,6 @@ declare namespace Parameters_2 { } } -declare namespace Parameters_3 { - export { - MetadataRolesListParameters, - MetadataPolicyListAllQueryParamProperties, - MetadataPolicyListAllQueryParam, - MetadataPolicyListAllParameters, - MetadataPolicyUpdateBodyParam, - MetadataPolicyUpdateParameters, - MetadataPolicyGetParameters - } -} - // @public (undocumented) interface PathPatternExtractorConfig { // (undocumented) @@ -984,27 +1283,53 @@ interface PathPatternExtractorConfig { } // @public (undocumented) -interface PrivateEndpoint { - id?: string; +interface PathPatternExtractorConfigOutput { + // (undocumented) + acceptedPatterns?: Array; + // (undocumented) + complexReplacers?: Array; + // (undocumented) + createdBy: string; + // (undocumented) + enableDefaultPatterns: boolean; + // (undocumented) + lastUpdatedTimestamp?: number; + // (undocumented) + modifiedBy?: string; + // (undocumented) + normalizationRules?: Array; + // (undocumented) + regexReplacers?: Array; + // (undocumented) + rejectedPatterns?: Array; + // (undocumented) + scopedRules?: Array; + // (undocumented) + version?: number; } -// @public (undocumented) -interface PrivateEndpointConnection { - id?: string; - name?: string; - properties?: PrivateEndpointConnectionProperties; - type?: string; +// @public +interface PrivateEndpointConnectionOutput { + readonly id?: string; + readonly name?: string; + properties?: PrivateEndpointConnectionPropertiesOutput; + readonly type?: string; } -// @public (undocumented) -interface PrivateEndpointConnectionProperties { - privateEndpoint?: PrivateEndpoint; - privateLinkServiceConnectionState?: PrivateLinkServiceConnectionState; - provisioningState?: string; +// @public +interface PrivateEndpointConnectionPropertiesOutput { + privateEndpoint?: PrivateEndpointOutput; + privateLinkServiceConnectionState?: PrivateLinkServiceConnectionStateOutput; + readonly provisioningState?: string; } -// @public (undocumented) -interface PrivateLinkServiceConnectionState { +// @public +interface PrivateEndpointOutput { + id?: string; +} + +// @public +interface PrivateLinkServiceConnectionStateOutput { actionsRequired?: string; description?: string; status?: "Unknown" | "Pending" | "Approved" | "Rejected" | "Disconnected"; @@ -1012,44 +1337,54 @@ interface PrivateLinkServiceConnectionState { declare namespace PurviewAccount { export { - Models, - Pagination, - Parameters_2 as Parameters, - Client_2 as Client, - Responses, - PurviewAccountClient + createClient_2 as createClient, + PurviewAccountClientOptions, + Parameters_3 as Parameters, + Responses_2 as Responses, + Client_3 as Client, + Models_2 as Models, + OutputModels_2 as OutputModels, + PaginateHelper_2 as PaginateHelper, + UnexpectedHelper_2 as UnexpectedHelper } } export { PurviewAccount } // @public (undocumented) -export function PurviewAccountClient(endpoint: string, credentials: TokenCredential, options?: ClientOptions): PurviewAccountRestClient; - -// @public (undocumented) -type PurviewAccountRestClient = Client & { - path: Routes; +type PurviewAccountClient = Client & { + path: Routes_2; }; +// @public +interface PurviewAccountClientOptions extends ClientOptions { + apiVersion?: string; +} + declare namespace PurviewMetadataPolicies { export { - PurviewMetadataPoliciesClient, - Models_2 as Models, - Pagination_2 as Pagination, - Parameters_3 as Parameters, - Client_3 as Client, - Responses_2 as Responses + createClient, + PurviewMetadataPoliciesClientOptions, + Parameters_2 as Parameters, + Responses, + Client_2 as Client, + Models, + OutputModels, + PaginateHelper, + UnexpectedHelper } } export { PurviewMetadataPolicies } // @public (undocumented) -export function PurviewMetadataPoliciesClient(Endpoint: string, credentials: TokenCredential, options?: ClientOptions): PurviewMetadataPoliciesRestClient; - -// @public (undocumented) -type PurviewMetadataPoliciesRestClient = Client & { - path: Routes_2; +type PurviewMetadataPoliciesClient = Client & { + path: Routes; }; +// @public +interface PurviewMetadataPoliciesClientOptions extends ClientOptions { + apiVersion?: string; +} + // @public (undocumented) interface RegexReplacer { // (undocumented) @@ -1077,23 +1412,55 @@ interface RegexReplacer { } // @public (undocumented) +interface RegexReplacerOutput { + // (undocumented) + condition?: string; + // (undocumented) + createdBy?: string; + // (undocumented) + description?: string; + // (undocumented) + disabled: boolean; + // (undocumented) + disableRecursiveReplacerApplication?: boolean; + // (undocumented) + doNotReplaceRegex?: FastRegexOutput; + // (undocumented) + lastUpdatedTimestamp?: number; + // (undocumented) + modifiedBy?: string; + // (undocumented) + name: string; + // (undocumented) + regex?: FastRegexOutput; + // (undocumented) + replaceWith?: string; +} + +// @public interface ResourceSetRuleConfig { advancedResourceSet?: AdvancedResourceSet; - name?: string; pathPatternConfig?: PathPatternExtractorConfig; } -// @public (undocumented) -interface ResourceSetRuleConfigList { +// @public +interface ResourceSetRuleConfigListOutput { count?: number; nextLink?: string; - value: Array; + value: Array; +} + +// @public +interface ResourceSetRuleConfigOutput { + advancedResourceSet?: AdvancedResourceSetOutput; + readonly name?: string; + pathPatternConfig?: PathPatternExtractorConfigOutput; } // @public interface ResourceSetRulesCreateOrUpdateResourceSetRule200Response extends HttpResponse { // (undocumented) - body: ResourceSetRuleConfig; + body: ResourceSetRuleConfigOutput; // (undocumented) status: "200"; } @@ -1105,38 +1472,39 @@ interface ResourceSetRulesCreateOrUpdateResourceSetRuleBodyParam { } // @public -interface ResourceSetRulesCreateOrUpdateResourceSetRuledefaultResponse extends HttpResponse { +interface ResourceSetRulesCreateOrUpdateResourceSetRuleDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel; + body: ErrorResponseModelOutput_2; // (undocumented) - status: "500"; + status: string; +} + +// @public (undocumented) +interface ResourceSetRulesCreateOrUpdateResourceSetRuleMediaTypesParam { + contentType?: "application/json"; } // @public (undocumented) -type ResourceSetRulesCreateOrUpdateResourceSetRuleParameters = ResourceSetRulesCreateOrUpdateResourceSetRuleBodyParam & RequestParameters; +type ResourceSetRulesCreateOrUpdateResourceSetRuleParameters = ResourceSetRulesCreateOrUpdateResourceSetRuleMediaTypesParam & ResourceSetRulesCreateOrUpdateResourceSetRuleBodyParam & RequestParameters; // @public interface ResourceSetRulesDeleteResourceSetRule200Response extends HttpResponse { - // (undocumented) - body: Record; // (undocumented) status: "200"; } // @public interface ResourceSetRulesDeleteResourceSetRule204Response extends HttpResponse { - // (undocumented) - body: Record; // (undocumented) status: "204"; } // @public -interface ResourceSetRulesDeleteResourceSetRuledefaultResponse extends HttpResponse { +interface ResourceSetRulesDeleteResourceSetRuleDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel; + body: ErrorResponseModelOutput_2; // (undocumented) - status: "500"; + status: string; } // @public (undocumented) @@ -1144,25 +1512,25 @@ type ResourceSetRulesDeleteResourceSetRuleParameters = RequestParameters; // @public (undocumented) interface ResourceSetRulesGetResourceSetRule { - delete(options?: ResourceSetRulesDeleteResourceSetRuleParameters): Promise; - get(options?: ResourceSetRulesGetResourceSetRuleParameters): Promise; - put(options: ResourceSetRulesCreateOrUpdateResourceSetRuleParameters): Promise; + delete(options?: ResourceSetRulesDeleteResourceSetRuleParameters): StreamableMethod; + get(options?: ResourceSetRulesGetResourceSetRuleParameters): StreamableMethod; + put(options: ResourceSetRulesCreateOrUpdateResourceSetRuleParameters): StreamableMethod; } // @public interface ResourceSetRulesGetResourceSetRule200Response extends HttpResponse { // (undocumented) - body: ResourceSetRuleConfig; + body: ResourceSetRuleConfigOutput; // (undocumented) status: "200"; } // @public -interface ResourceSetRulesGetResourceSetRuledefaultResponse extends HttpResponse { +interface ResourceSetRulesGetResourceSetRuleDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel; + body: ErrorResponseModelOutput_2; // (undocumented) - status: "500"; + status: string; } // @public (undocumented) @@ -1170,23 +1538,23 @@ type ResourceSetRulesGetResourceSetRuleParameters = RequestParameters; // @public (undocumented) interface ResourceSetRulesListResourceSetRules { - get(options?: ResourceSetRulesListResourceSetRulesParameters): Promise; + get(options?: ResourceSetRulesListResourceSetRulesParameters): StreamableMethod; } // @public interface ResourceSetRulesListResourceSetRules200Response extends HttpResponse { // (undocumented) - body: ResourceSetRuleConfigList; + body: ResourceSetRuleConfigListOutput; // (undocumented) status: "200"; } // @public -interface ResourceSetRulesListResourceSetRulesdefaultResponse extends HttpResponse { +interface ResourceSetRulesListResourceSetRulesDefaultResponse extends HttpResponse { // (undocumented) - body: ErrorResponseModel; + body: ErrorResponseModelOutput_2; // (undocumented) - status: "500"; + status: string; } // @public (undocumented) @@ -1205,58 +1573,65 @@ interface ResourceSetRulesListResourceSetRulesQueryParamProperties { } declare namespace Responses { + export { + MetadataRolesList200Response, + MetadataRolesListDefaultHeaders, + MetadataRolesListDefaultResponse, + MetadataPolicyListAll200Response, + MetadataPolicyListAllDefaultHeaders, + MetadataPolicyListAllDefaultResponse, + MetadataPolicyUpdate200Response, + MetadataPolicyUpdateDefaultHeaders, + MetadataPolicyUpdateDefaultResponse, + MetadataPolicyGet200Response, + MetadataPolicyGetDefaultHeaders, + MetadataPolicyGetDefaultResponse + } +} + +declare namespace Responses_2 { export { AccountsGetAccountProperties200Response, - AccountsGetAccountPropertiesdefaultResponse, + AccountsGetAccountPropertiesDefaultResponse, AccountsUpdateAccountProperties200Response, - AccountsUpdateAccountPropertiesdefaultResponse, + AccountsUpdateAccountPropertiesDefaultResponse, AccountsGetAccessKeys200Response, - AccountsGetAccessKeysdefaultResponse, + AccountsGetAccessKeysDefaultResponse, AccountsRegenerateAccessKey200Response, - AccountsRegenerateAccessKeydefaultResponse, + AccountsRegenerateAccessKeyDefaultResponse, CollectionsGetCollection200Response, - CollectionsGetCollectiondefaultResponse, + CollectionsGetCollectionDefaultResponse, CollectionsCreateOrUpdateCollection200Response, - CollectionsCreateOrUpdateCollectiondefaultResponse, + CollectionsCreateOrUpdateCollectionDefaultResponse, CollectionsDeleteCollection204Response, - CollectionsDeleteCollectiondefaultResponse, + CollectionsDeleteCollectionDefaultResponse, CollectionsListCollections200Response, - CollectionsListCollectionsdefaultResponse, + CollectionsListCollectionsDefaultResponse, CollectionsListChildCollectionNames200Response, - CollectionsListChildCollectionNamesdefaultResponse, + CollectionsListChildCollectionNamesDefaultResponse, CollectionsGetCollectionPath200Response, - CollectionsGetCollectionPathdefaultResponse, + CollectionsGetCollectionPathDefaultResponse, ResourceSetRulesGetResourceSetRule200Response, - ResourceSetRulesGetResourceSetRuledefaultResponse, + ResourceSetRulesGetResourceSetRuleDefaultResponse, ResourceSetRulesCreateOrUpdateResourceSetRule200Response, - ResourceSetRulesCreateOrUpdateResourceSetRuledefaultResponse, + ResourceSetRulesCreateOrUpdateResourceSetRuleDefaultResponse, ResourceSetRulesDeleteResourceSetRule200Response, ResourceSetRulesDeleteResourceSetRule204Response, - ResourceSetRulesDeleteResourceSetRuledefaultResponse, + ResourceSetRulesDeleteResourceSetRuleDefaultResponse, ResourceSetRulesListResourceSetRules200Response, - ResourceSetRulesListResourceSetRulesdefaultResponse + ResourceSetRulesListResourceSetRulesDefaultResponse } } -declare namespace Responses_2 { - export { - MetadataRolesList200Response, - MetadataRolesListdefaultHeaders, - MetadataRolesListdefaultResponse, - MetadataPolicyListAll200Response, - MetadataPolicyListAlldefaultHeaders, - MetadataPolicyListAlldefaultResponse, - MetadataPolicyUpdate200Response, - MetadataPolicyUpdatedefaultHeaders, - MetadataPolicyUpdatedefaultResponse, - MetadataPolicyGet200Response, - MetadataPolicyGetdefaultHeaders, - MetadataPolicyGetdefaultResponse - } +// @public (undocumented) +interface Routes { + (path: "/metadataRoles"): MetadataRolesList; + (path: "/metadataPolicies"): MetadataPolicyListAll; + (path: "/metadataPolicies/{policyId}", policyId: string): MetadataPolicyUpdate; } // @public (undocumented) -interface Routes { +interface Routes_2 { (path: "/"): AccountsGetAccountProperties; (path: "/listkeys"): AccountsGetAccessKeys; (path: "/regeneratekeys"): AccountsRegenerateAccessKey; @@ -1269,14 +1644,21 @@ interface Routes { } // @public (undocumented) -interface Routes_2 { - (path: "/metadataRoles"): MetadataRolesList; - (path: "/metadataPolicies"): MetadataPolicyListAll; - (path: "/metadataPolicies/{policyId}", policyId: string): MetadataPolicyUpdate; +interface Rule { + // (undocumented) + displayName?: string; + // (undocumented) + isResourceSet?: boolean; + // (undocumented) + lastUpdatedTimestamp?: number; + // (undocumented) + name?: string; + // (undocumented) + qualifiedName: string; } // @public (undocumented) -interface Rule { +interface RuleOutput { // (undocumented) displayName?: string; // (undocumented) @@ -1300,13 +1682,39 @@ interface ScopedRule { } // @public (undocumented) +interface ScopedRuleOutput { + // (undocumented) + bindingUrl: string; + // (undocumented) + rules?: Array; + // (undocumented) + storeType: string; +} + +// @public interface SystemData { - createdAt?: Date; - createdBy?: string; - createdByType?: "User" | "Application" | "ManagedIdentity" | "Key"; - lastModifiedAt?: Date; - lastModifiedBy?: string; - lastModifiedByType?: "User" | "Application" | "ManagedIdentity" | "Key"; +} + +// @public +interface SystemDataOutput { + readonly createdAt?: string; + readonly createdBy?: string; + readonly createdByType?: "User" | "Application" | "ManagedIdentity" | "Key"; + readonly lastModifiedAt?: string; + readonly lastModifiedBy?: string; + readonly lastModifiedByType?: "User" | "Application" | "ManagedIdentity" | "Key"; +} + +declare namespace UnexpectedHelper { + export { + isUnexpected + } +} + +declare namespace UnexpectedHelper_2 { + export { + isUnexpected_2 as isUnexpected + } } // (No @packageDocumentation comment for this package) diff --git a/sdk/purview/purview-administration-rest/samples-dev/accountCollections.ts b/sdk/purview/purview-administration-rest/samples-dev/accountCollections.ts index 084a2d382778..8e8e317bbbff 100644 --- a/sdk/purview/purview-administration-rest/samples-dev/accountCollections.ts +++ b/sdk/purview/purview-administration-rest/samples-dev/accountCollections.ts @@ -8,7 +8,7 @@ * @azsdk-weight 40 */ -import { PurviewAccount, PurviewAccountClient } from "@azure-rest/purview-administration"; +import { PurviewAccount } from "@azure-rest/purview-administration"; import { DefaultAzureCredential } from "@azure/identity"; import dotenv from "dotenv"; @@ -18,7 +18,7 @@ const endpoint = process.env["ENDPOINT"] || ""; async function main(): Promise { console.log("== List collections sample =="); - const client = PurviewAccountClient(endpoint, new DefaultAzureCredential()); + const client = PurviewAccount.createClient(endpoint, new DefaultAzureCredential()); const response = await client.path("/collections").get(); @@ -26,7 +26,7 @@ async function main(): Promise { console.log(`GET "/collections" failed with ${response.status}`); } - const dataSources = PurviewAccount.Pagination.paginate(client, response); + const dataSources = PurviewAccount.PaginateHelper.paginate(client, response); for await (const dataSource of dataSources) { console.log(dataSource); diff --git a/sdk/purview/purview-administration-rest/samples-dev/metadataPolicies.ts b/sdk/purview/purview-administration-rest/samples-dev/metadataPolicies.ts index 5e3e08e90efe..c160ef702ff0 100644 --- a/sdk/purview/purview-administration-rest/samples-dev/metadataPolicies.ts +++ b/sdk/purview/purview-administration-rest/samples-dev/metadataPolicies.ts @@ -8,10 +8,7 @@ * @azsdk-weight 40 */ -import { - PurviewMetadataPolicies, - PurviewMetadataPoliciesClient, -} from "@azure-rest/purview-administration"; +import { PurviewMetadataPolicies } from "@azure-rest/purview-administration"; import { DefaultAzureCredential } from "@azure/identity"; import dotenv from "dotenv"; @@ -21,7 +18,7 @@ const endpoint = process.env["ENDPOINT"] || ""; async function main(): Promise { console.log("== List metadata policies sample =="); - const client = PurviewMetadataPoliciesClient(endpoint, new DefaultAzureCredential()); + const client = PurviewMetadataPolicies.createClient(endpoint, new DefaultAzureCredential()); const response = await client.path("/metadataPolicies").get(); @@ -31,10 +28,14 @@ async function main(): Promise { throw new Error(error); } - const policies = PurviewMetadataPolicies.Pagination.paginate(client, response); + const policies = PurviewMetadataPolicies.PaginateHelper.paginate(client, response); for await (const policy of policies) { - console.log(policy.name); + if (Array.isArray(policy)) { + console.error("Unexpected array:", policy); + } else { + console.log(policy.name); + } } } diff --git a/sdk/purview/purview-administration-rest/samples/v1/javascript/README.md b/sdk/purview/purview-administration-rest/samples/v1-beta/javascript/README.md similarity index 92% rename from sdk/purview/purview-administration-rest/samples/v1/javascript/README.md rename to sdk/purview/purview-administration-rest/samples/v1-beta/javascript/README.md index 3e38d3bd6389..48ce285840c1 100644 --- a/sdk/purview/purview-administration-rest/samples/v1/javascript/README.md +++ b/sdk/purview/purview-administration-rest/samples/v1-beta/javascript/README.md @@ -1,4 +1,4 @@ -# Azure Purview Administration rest client library samples for JavaScript +# Azure Purview Administration rest client library samples for JavaScript (Beta) These sample programs show how to use the JavaScript client libraries for Azure Purview Administration rest in some common scenarios. @@ -47,8 +47,8 @@ npx dev-tool run vendored cross-env ENDPOINT="" node accountCollection Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. -[accountcollections]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/purview/purview-administration-rest/samples/v1/javascript/accountCollections.js -[metadatapolicies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/purview/purview-administration-rest/samples/v1/javascript/metadataPolicies.js +[accountcollections]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/purview/purview-administration-rest/samples/v1-beta/javascript/accountCollections.js +[metadatapolicies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/purview/purview-administration-rest/samples/v1-beta/javascript/metadataPolicies.js [apiref]: https://docs.microsoft.com/rest/api/purview/ [freesub]: https://azure.microsoft.com/free/ [createinstance_azurepurviewinstance]: https://docs.microsoft.com/azure/purview/create-catalog-portal diff --git a/sdk/purview/purview-administration-rest/samples/v1/javascript/accountCollections.js b/sdk/purview/purview-administration-rest/samples/v1-beta/javascript/accountCollections.js similarity index 68% rename from sdk/purview/purview-administration-rest/samples/v1/javascript/accountCollections.js rename to sdk/purview/purview-administration-rest/samples/v1-beta/javascript/accountCollections.js index 07930953a026..9e380226f12b 100644 --- a/sdk/purview/purview-administration-rest/samples/v1/javascript/accountCollections.js +++ b/sdk/purview/purview-administration-rest/samples/v1-beta/javascript/accountCollections.js @@ -7,17 +7,15 @@ * @summary gets a list of collections */ -const { PurviewAccount, PurviewAccountClient } = require("@azure-rest/purview-administration"); +const { PurviewAccount } = require("@azure-rest/purview-administration"); const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); - -dotenv.config(); +require("dotenv").config(); const endpoint = process.env["ENDPOINT"] || ""; async function main() { console.log("== List collections sample =="); - const client = PurviewAccountClient(endpoint, new DefaultAzureCredential()); + const client = PurviewAccount.createClient(endpoint, new DefaultAzureCredential()); const response = await client.path("/collections").get(); @@ -25,7 +23,7 @@ async function main() { console.log(`GET "/collections" failed with ${response.status}`); } - const dataSources = PurviewAccount.Pagination.paginate(client, response); + const dataSources = PurviewAccount.PaginateHelper.paginate(client, response); for await (const dataSource of dataSources) { console.log(dataSource); diff --git a/sdk/purview/purview-administration-rest/samples/v1/javascript/metadataPolicies.js b/sdk/purview/purview-administration-rest/samples/v1-beta/javascript/metadataPolicies.js similarity index 62% rename from sdk/purview/purview-administration-rest/samples/v1/javascript/metadataPolicies.js rename to sdk/purview/purview-administration-rest/samples/v1-beta/javascript/metadataPolicies.js index e62269f25754..f49dafdc1a4d 100644 --- a/sdk/purview/purview-administration-rest/samples/v1/javascript/metadataPolicies.js +++ b/sdk/purview/purview-administration-rest/samples/v1-beta/javascript/metadataPolicies.js @@ -7,20 +7,15 @@ * @summary gets a list of metadata policies */ -const { - PurviewMetadataPolicies, - PurviewMetadataPoliciesClient -} = require("@azure-rest/purview-administration"); +const { PurviewMetadataPolicies } = require("@azure-rest/purview-administration"); const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); - -dotenv.config(); +require("dotenv").config(); const endpoint = process.env["ENDPOINT"] || ""; async function main() { console.log("== List metadata policies sample =="); - const client = PurviewMetadataPoliciesClient(endpoint, new DefaultAzureCredential()); + const client = PurviewMetadataPolicies.createClient(endpoint, new DefaultAzureCredential()); const response = await client.path("/metadataPolicies").get(); @@ -30,10 +25,14 @@ async function main() { throw new Error(error); } - const policies = PurviewMetadataPolicies.Pagination.paginate(client, response); + const policies = PurviewMetadataPolicies.PaginateHelper.paginate(client, response); for await (const policy of policies) { - console.log(policy.name); + if (Array.isArray(policy)) { + console.error("Unexpected array:", policy); + } else { + console.log(policy.name); + } } } diff --git a/sdk/purview/purview-administration-rest/samples/v1/javascript/package.json b/sdk/purview/purview-administration-rest/samples/v1-beta/javascript/package.json similarity index 85% rename from sdk/purview/purview-administration-rest/samples/v1/javascript/package.json rename to sdk/purview/purview-administration-rest/samples/v1-beta/javascript/package.json index ec791464ef1c..75429082d569 100644 --- a/sdk/purview/purview-administration-rest/samples/v1/javascript/package.json +++ b/sdk/purview/purview-administration-rest/samples/v1-beta/javascript/package.json @@ -1,8 +1,8 @@ { - "name": "@azure-samples/purview-administration-js", + "name": "@azure-samples/purview-administration-js-beta", "private": true, "version": "1.0.0", - "description": "Azure Purview Administration rest client library samples for JavaScript", + "description": "Azure Purview Administration rest client library samples for JavaScript (Beta)", "engines": { "node": ">=18.0.0" }, @@ -28,6 +28,6 @@ "dependencies": { "@azure-rest/purview-administration": "next", "dotenv": "latest", - "@azure/identity": "^4.2.1" + "@azure/identity": "^4.0.1" } } diff --git a/sdk/purview/purview-administration-rest/samples/v1/javascript/sample.env b/sdk/purview/purview-administration-rest/samples/v1-beta/javascript/sample.env similarity index 100% rename from sdk/purview/purview-administration-rest/samples/v1/javascript/sample.env rename to sdk/purview/purview-administration-rest/samples/v1-beta/javascript/sample.env diff --git a/sdk/purview/purview-administration-rest/samples/v1/typescript/README.md b/sdk/purview/purview-administration-rest/samples/v1-beta/typescript/README.md similarity index 93% rename from sdk/purview/purview-administration-rest/samples/v1/typescript/README.md rename to sdk/purview/purview-administration-rest/samples/v1-beta/typescript/README.md index 21f46aa0ba99..86ea800de3cf 100644 --- a/sdk/purview/purview-administration-rest/samples/v1/typescript/README.md +++ b/sdk/purview/purview-administration-rest/samples/v1-beta/typescript/README.md @@ -1,4 +1,4 @@ -# Azure Purview Administration rest client library samples for TypeScript +# Azure Purview Administration rest client library samples for TypeScript (Beta) These sample programs show how to use the TypeScript client libraries for Azure Purview Administration rest in some common scenarios. @@ -59,8 +59,8 @@ npx dev-tool run vendored cross-env ENDPOINT="" node dist/accountColle Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. -[accountcollections]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/purview/purview-administration-rest/samples/v1/typescript/src/accountCollections.ts -[metadatapolicies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/purview/purview-administration-rest/samples/v1/typescript/src/metadataPolicies.ts +[accountcollections]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/purview/purview-administration-rest/samples/v1-beta/typescript/src/accountCollections.ts +[metadatapolicies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/purview/purview-administration-rest/samples/v1-beta/typescript/src/metadataPolicies.ts [apiref]: https://docs.microsoft.com/rest/api/purview/ [freesub]: https://azure.microsoft.com/free/ [createinstance_azurepurviewinstance]: https://docs.microsoft.com/azure/purview/create-catalog-portal diff --git a/sdk/purview/purview-administration-rest/samples/v1/typescript/package.json b/sdk/purview/purview-administration-rest/samples/v1-beta/typescript/package.json similarity index 85% rename from sdk/purview/purview-administration-rest/samples/v1/typescript/package.json rename to sdk/purview/purview-administration-rest/samples/v1-beta/typescript/package.json index b40bae869275..86f2913e03d8 100644 --- a/sdk/purview/purview-administration-rest/samples/v1/typescript/package.json +++ b/sdk/purview/purview-administration-rest/samples/v1-beta/typescript/package.json @@ -1,8 +1,8 @@ { - "name": "@azure-samples/purview-administration-ts", + "name": "@azure-samples/purview-administration-ts-beta", "private": true, "version": "1.0.0", - "description": "Azure Purview Administration rest client library samples for TypeScript", + "description": "Azure Purview Administration rest client library samples for TypeScript (Beta)", "engines": { "node": ">=18.0.0" }, @@ -32,9 +32,10 @@ "dependencies": { "@azure-rest/purview-administration": "next", "dotenv": "latest", - "@azure/identity": "^4.2.1" + "@azure/identity": "^4.0.1" }, "devDependencies": { + "@types/node": "^18.0.0", "typescript": "~5.7.2", "rimraf": "latest" } diff --git a/sdk/purview/purview-administration-rest/samples/v1/typescript/sample.env b/sdk/purview/purview-administration-rest/samples/v1-beta/typescript/sample.env similarity index 100% rename from sdk/purview/purview-administration-rest/samples/v1/typescript/sample.env rename to sdk/purview/purview-administration-rest/samples/v1-beta/typescript/sample.env diff --git a/sdk/purview/purview-administration-rest/samples/v1/typescript/src/accountCollections.ts b/sdk/purview/purview-administration-rest/samples/v1-beta/typescript/src/accountCollections.ts similarity index 73% rename from sdk/purview/purview-administration-rest/samples/v1/typescript/src/accountCollections.ts rename to sdk/purview/purview-administration-rest/samples/v1-beta/typescript/src/accountCollections.ts index 61edc8573d3e..b930aeaed64b 100644 --- a/sdk/purview/purview-administration-rest/samples/v1/typescript/src/accountCollections.ts +++ b/sdk/purview/purview-administration-rest/samples/v1-beta/typescript/src/accountCollections.ts @@ -7,7 +7,7 @@ * @summary gets a list of collections */ -import { PurviewAccount, PurviewAccountClient } from "@azure-rest/purview-administration"; +import { PurviewAccount } from "@azure-rest/purview-administration"; import { DefaultAzureCredential } from "@azure/identity"; import dotenv from "dotenv"; @@ -17,7 +17,7 @@ const endpoint = process.env["ENDPOINT"] || ""; async function main() { console.log("== List collections sample =="); - const client = PurviewAccountClient(endpoint, new DefaultAzureCredential()); + const client = PurviewAccount.createClient(endpoint, new DefaultAzureCredential()); const response = await client.path("/collections").get(); @@ -25,7 +25,7 @@ async function main() { console.log(`GET "/collections" failed with ${response.status}`); } - const dataSources = PurviewAccount.Pagination.paginate(client, response); + const dataSources = PurviewAccount.PaginateHelper.paginate(client, response); for await (const dataSource of dataSources) { console.log(dataSource); diff --git a/sdk/purview/purview-administration-rest/samples/v1/typescript/src/metadataPolicies.ts b/sdk/purview/purview-administration-rest/samples/v1-beta/typescript/src/metadataPolicies.ts similarity index 69% rename from sdk/purview/purview-administration-rest/samples/v1/typescript/src/metadataPolicies.ts rename to sdk/purview/purview-administration-rest/samples/v1-beta/typescript/src/metadataPolicies.ts index e5f89d5bad20..7a096641e3b2 100644 --- a/sdk/purview/purview-administration-rest/samples/v1/typescript/src/metadataPolicies.ts +++ b/sdk/purview/purview-administration-rest/samples/v1-beta/typescript/src/metadataPolicies.ts @@ -8,8 +8,7 @@ */ import { - PurviewMetadataPolicies, - PurviewMetadataPoliciesClient, + PurviewMetadataPolicies } from "@azure-rest/purview-administration"; import { DefaultAzureCredential } from "@azure/identity"; import dotenv from "dotenv"; @@ -20,7 +19,7 @@ const endpoint = process.env["ENDPOINT"] || ""; async function main() { console.log("== List metadata policies sample =="); - const client = PurviewMetadataPoliciesClient(endpoint, new DefaultAzureCredential()); + const client = PurviewMetadataPolicies.createClient(endpoint, new DefaultAzureCredential()); const response = await client.path("/metadataPolicies").get(); @@ -30,10 +29,14 @@ async function main() { throw new Error(error); } - const policies = PurviewMetadataPolicies.Pagination.paginate(client, response); + const policies = PurviewMetadataPolicies.PaginateHelper.paginate(client, response); for await (const policy of policies) { - console.log(policy.name); + if (Array.isArray(policy)) { + console.error('Unexpected array:', policy); + } else { + console.log(policy.name); + } } } diff --git a/sdk/purview/purview-administration-rest/samples/v1/typescript/tsconfig.json b/sdk/purview/purview-administration-rest/samples/v1-beta/typescript/tsconfig.json similarity index 92% rename from sdk/purview/purview-administration-rest/samples/v1/typescript/tsconfig.json rename to sdk/purview/purview-administration-rest/samples/v1-beta/typescript/tsconfig.json index ad5ff9a19d36..984eed535aa8 100644 --- a/sdk/purview/purview-administration-rest/samples/v1/typescript/tsconfig.json +++ b/sdk/purview/purview-administration-rest/samples/v1-beta/typescript/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "ES2018", + "target": "ES2020", "module": "commonjs", "moduleResolution": "node", "resolveJsonModule": true, diff --git a/sdk/purview/purview-administration-rest/src/account/clientDefinitions.ts b/sdk/purview/purview-administration-rest/src/account/clientDefinitions.ts index 8d75a92bf62c..e2bb246c444c 100644 --- a/sdk/purview/purview-administration-rest/src/account/clientDefinitions.ts +++ b/sdk/purview/purview-administration-rest/src/account/clientDefinitions.ts @@ -1,65 +1,67 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { Client } from "@azure-rest/core-client"; import type { - AccountsGetAccessKeysParameters, AccountsGetAccountPropertiesParameters, - AccountsRegenerateAccessKeyParameters, AccountsUpdateAccountPropertiesParameters, + AccountsGetAccessKeysParameters, + AccountsRegenerateAccessKeyParameters, + CollectionsGetCollectionParameters, CollectionsCreateOrUpdateCollectionParameters, CollectionsDeleteCollectionParameters, - CollectionsGetCollectionParameters, - CollectionsGetCollectionPathParameters, - CollectionsListChildCollectionNamesParameters, CollectionsListCollectionsParameters, + CollectionsListChildCollectionNamesParameters, + CollectionsGetCollectionPathParameters, + ResourceSetRulesGetResourceSetRuleParameters, ResourceSetRulesCreateOrUpdateResourceSetRuleParameters, ResourceSetRulesDeleteResourceSetRuleParameters, - ResourceSetRulesGetResourceSetRuleParameters, ResourceSetRulesListResourceSetRulesParameters, } from "./parameters.js"; import type { - AccountsGetAccessKeys200Response, - AccountsGetAccessKeysdefaultResponse, AccountsGetAccountProperties200Response, - AccountsGetAccountPropertiesdefaultResponse, - AccountsRegenerateAccessKey200Response, - AccountsRegenerateAccessKeydefaultResponse, + AccountsGetAccountPropertiesDefaultResponse, AccountsUpdateAccountProperties200Response, - AccountsUpdateAccountPropertiesdefaultResponse, + AccountsUpdateAccountPropertiesDefaultResponse, + AccountsGetAccessKeys200Response, + AccountsGetAccessKeysDefaultResponse, + AccountsRegenerateAccessKey200Response, + AccountsRegenerateAccessKeyDefaultResponse, + CollectionsGetCollection200Response, + CollectionsGetCollectionDefaultResponse, CollectionsCreateOrUpdateCollection200Response, - CollectionsCreateOrUpdateCollectiondefaultResponse, + CollectionsCreateOrUpdateCollectionDefaultResponse, CollectionsDeleteCollection204Response, - CollectionsDeleteCollectiondefaultResponse, - CollectionsGetCollection200Response, - CollectionsGetCollectiondefaultResponse, - CollectionsGetCollectionPath200Response, - CollectionsGetCollectionPathdefaultResponse, - CollectionsListChildCollectionNames200Response, - CollectionsListChildCollectionNamesdefaultResponse, + CollectionsDeleteCollectionDefaultResponse, CollectionsListCollections200Response, - CollectionsListCollectionsdefaultResponse, + CollectionsListCollectionsDefaultResponse, + CollectionsListChildCollectionNames200Response, + CollectionsListChildCollectionNamesDefaultResponse, + CollectionsGetCollectionPath200Response, + CollectionsGetCollectionPathDefaultResponse, + ResourceSetRulesGetResourceSetRule200Response, + ResourceSetRulesGetResourceSetRuleDefaultResponse, ResourceSetRulesCreateOrUpdateResourceSetRule200Response, - ResourceSetRulesCreateOrUpdateResourceSetRuledefaultResponse, + ResourceSetRulesCreateOrUpdateResourceSetRuleDefaultResponse, ResourceSetRulesDeleteResourceSetRule200Response, ResourceSetRulesDeleteResourceSetRule204Response, - ResourceSetRulesDeleteResourceSetRuledefaultResponse, - ResourceSetRulesGetResourceSetRule200Response, - ResourceSetRulesGetResourceSetRuledefaultResponse, + ResourceSetRulesDeleteResourceSetRuleDefaultResponse, ResourceSetRulesListResourceSetRules200Response, - ResourceSetRulesListResourceSetRulesdefaultResponse, + ResourceSetRulesListResourceSetRulesDefaultResponse, } from "./responses.js"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface AccountsGetAccountProperties { /** Get an account */ get( options?: AccountsGetAccountPropertiesParameters, - ): Promise; + ): StreamableMethod< + AccountsGetAccountProperties200Response | AccountsGetAccountPropertiesDefaultResponse + >; /** Updates an account */ patch( options: AccountsUpdateAccountPropertiesParameters, - ): Promise< - AccountsUpdateAccountProperties200Response | AccountsUpdateAccountPropertiesdefaultResponse + ): StreamableMethod< + AccountsUpdateAccountProperties200Response | AccountsUpdateAccountPropertiesDefaultResponse >; } @@ -67,48 +69,56 @@ export interface AccountsGetAccessKeys { /** List the authorization keys associated with this account. */ post( options?: AccountsGetAccessKeysParameters, - ): Promise; + ): StreamableMethod; } export interface AccountsRegenerateAccessKey { /** Regenerate the authorization keys associated with this data catalog. */ post( options: AccountsRegenerateAccessKeyParameters, - ): Promise; + ): StreamableMethod< + AccountsRegenerateAccessKey200Response | AccountsRegenerateAccessKeyDefaultResponse + >; } export interface CollectionsGetCollection { /** Get a collection */ get( options?: CollectionsGetCollectionParameters, - ): Promise; + ): StreamableMethod< + CollectionsGetCollection200Response | CollectionsGetCollectionDefaultResponse + >; /** Creates or updates a collection entity. */ put( options: CollectionsCreateOrUpdateCollectionParameters, - ): Promise< + ): StreamableMethod< | CollectionsCreateOrUpdateCollection200Response - | CollectionsCreateOrUpdateCollectiondefaultResponse + | CollectionsCreateOrUpdateCollectionDefaultResponse >; /** Deletes a Collection entity. */ delete( options?: CollectionsDeleteCollectionParameters, - ): Promise; + ): StreamableMethod< + CollectionsDeleteCollection204Response | CollectionsDeleteCollectionDefaultResponse + >; } export interface CollectionsListCollections { /** List the collections in the account. */ get( options?: CollectionsListCollectionsParameters, - ): Promise; + ): StreamableMethod< + CollectionsListCollections200Response | CollectionsListCollectionsDefaultResponse + >; } export interface CollectionsListChildCollectionNames { /** Lists the child collections names in the collection. */ get( options?: CollectionsListChildCollectionNamesParameters, - ): Promise< + ): StreamableMethod< | CollectionsListChildCollectionNames200Response - | CollectionsListChildCollectionNamesdefaultResponse + | CollectionsListChildCollectionNamesDefaultResponse >; } @@ -116,31 +126,33 @@ export interface CollectionsGetCollectionPath { /** Gets the parent name and parent friendly name chains that represent the collection path. */ get( options?: CollectionsGetCollectionPathParameters, - ): Promise; + ): StreamableMethod< + CollectionsGetCollectionPath200Response | CollectionsGetCollectionPathDefaultResponse + >; } export interface ResourceSetRulesGetResourceSetRule { /** Get a resource set config service model. */ get( options?: ResourceSetRulesGetResourceSetRuleParameters, - ): Promise< + ): StreamableMethod< | ResourceSetRulesGetResourceSetRule200Response - | ResourceSetRulesGetResourceSetRuledefaultResponse + | ResourceSetRulesGetResourceSetRuleDefaultResponse >; /** Creates or updates an resource set config. */ put( options: ResourceSetRulesCreateOrUpdateResourceSetRuleParameters, - ): Promise< + ): StreamableMethod< | ResourceSetRulesCreateOrUpdateResourceSetRule200Response - | ResourceSetRulesCreateOrUpdateResourceSetRuledefaultResponse + | ResourceSetRulesCreateOrUpdateResourceSetRuleDefaultResponse >; /** Deletes a ResourceSetRuleConfig resource. */ delete( options?: ResourceSetRulesDeleteResourceSetRuleParameters, - ): Promise< + ): StreamableMethod< | ResourceSetRulesDeleteResourceSetRule200Response | ResourceSetRulesDeleteResourceSetRule204Response - | ResourceSetRulesDeleteResourceSetRuledefaultResponse + | ResourceSetRulesDeleteResourceSetRuleDefaultResponse >; } @@ -148,9 +160,9 @@ export interface ResourceSetRulesListResourceSetRules { /** Get a resource set config service model. */ get( options?: ResourceSetRulesListResourceSetRulesParameters, - ): Promise< + ): StreamableMethod< | ResourceSetRulesListResourceSetRules200Response - | ResourceSetRulesListResourceSetRulesdefaultResponse + | ResourceSetRulesListResourceSetRulesDefaultResponse >; } @@ -183,6 +195,6 @@ export interface Routes { (path: "/resourceSetRuleConfigs"): ResourceSetRulesListResourceSetRules; } -export type PurviewAccountRestClient = Client & { +export type PurviewAccountClient = Client & { path: Routes; }; diff --git a/sdk/purview/purview-administration-rest/src/account/index.ts b/sdk/purview/purview-administration-rest/src/account/index.ts index ac4a0bf815a6..36c5009076c2 100644 --- a/sdk/purview/purview-administration-rest/src/account/index.ts +++ b/sdk/purview/purview-administration-rest/src/account/index.ts @@ -1,10 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import * as Models from "./models.js"; -import * as Pagination from "./paginateHelper.js"; import * as Parameters from "./parameters.js"; -import * as Client from "./clientDefinitions.js"; import * as Responses from "./responses.js"; -export { Models, Pagination, Parameters, Client, Responses }; -export { PurviewAccountClient } from "./purviewAccount.js"; +import * as Client from "./clientDefinitions.js"; +import * as Models from "./models.js"; +import * as OutputModels from "./outputModels.js"; +import * as PaginateHelper from "./paginateHelper.js"; +import * as UnexpectedHelper from "./isUnexpected.js"; + +export { createClient, PurviewAccountClientOptions } from "./purviewAccount.js"; +export { Parameters, Responses, Client, Models, OutputModels, PaginateHelper, UnexpectedHelper }; diff --git a/sdk/purview/purview-administration-rest/src/account/isUnexpected.ts b/sdk/purview/purview-administration-rest/src/account/isUnexpected.ts new file mode 100644 index 000000000000..b35fca3ca4df --- /dev/null +++ b/sdk/purview/purview-administration-rest/src/account/isUnexpected.ts @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + AccountsGetAccountProperties200Response, + AccountsGetAccountPropertiesDefaultResponse, + AccountsUpdateAccountProperties200Response, + AccountsUpdateAccountPropertiesDefaultResponse, + AccountsGetAccessKeys200Response, + AccountsGetAccessKeysDefaultResponse, + AccountsRegenerateAccessKey200Response, + AccountsRegenerateAccessKeyDefaultResponse, + CollectionsGetCollection200Response, + CollectionsGetCollectionDefaultResponse, + CollectionsCreateOrUpdateCollection200Response, + CollectionsCreateOrUpdateCollectionDefaultResponse, + CollectionsDeleteCollection204Response, + CollectionsDeleteCollectionDefaultResponse, + CollectionsListCollections200Response, + CollectionsListCollectionsDefaultResponse, + CollectionsListChildCollectionNames200Response, + CollectionsListChildCollectionNamesDefaultResponse, + CollectionsGetCollectionPath200Response, + CollectionsGetCollectionPathDefaultResponse, + ResourceSetRulesGetResourceSetRule200Response, + ResourceSetRulesGetResourceSetRuleDefaultResponse, + ResourceSetRulesCreateOrUpdateResourceSetRule200Response, + ResourceSetRulesCreateOrUpdateResourceSetRuleDefaultResponse, + ResourceSetRulesDeleteResourceSetRule200Response, + ResourceSetRulesDeleteResourceSetRule204Response, + ResourceSetRulesDeleteResourceSetRuleDefaultResponse, + ResourceSetRulesListResourceSetRules200Response, + ResourceSetRulesListResourceSetRulesDefaultResponse, +} from "./responses.js"; + +const responseMap: Record = { + "GET /": ["200"], + "PATCH /": ["200"], + "POST /listkeys": ["200"], + "POST /regeneratekeys": ["200"], + "GET /collections/{collectionName}": ["200"], + "PUT /collections/{collectionName}": ["200"], + "DELETE /collections/{collectionName}": ["204"], + "GET /collections": ["200"], + "GET /collections/{collectionName}/getChildCollectionNames": ["200"], + "GET /collections/{collectionName}/getCollectionPath": ["200"], + "GET /resourceSetRuleConfigs/defaultResourceSetRuleConfig": ["200"], + "PUT /resourceSetRuleConfigs/defaultResourceSetRuleConfig": ["200"], + "DELETE /resourceSetRuleConfigs/defaultResourceSetRuleConfig": ["200", "204"], + "GET /resourceSetRuleConfigs": ["200"], +}; + +export function isUnexpected( + response: AccountsGetAccountProperties200Response | AccountsGetAccountPropertiesDefaultResponse, +): response is AccountsGetAccountPropertiesDefaultResponse; +export function isUnexpected( + response: + | AccountsUpdateAccountProperties200Response + | AccountsUpdateAccountPropertiesDefaultResponse, +): response is AccountsUpdateAccountPropertiesDefaultResponse; +export function isUnexpected( + response: AccountsGetAccessKeys200Response | AccountsGetAccessKeysDefaultResponse, +): response is AccountsGetAccessKeysDefaultResponse; +export function isUnexpected( + response: AccountsRegenerateAccessKey200Response | AccountsRegenerateAccessKeyDefaultResponse, +): response is AccountsRegenerateAccessKeyDefaultResponse; +export function isUnexpected( + response: CollectionsGetCollection200Response | CollectionsGetCollectionDefaultResponse, +): response is CollectionsGetCollectionDefaultResponse; +export function isUnexpected( + response: + | CollectionsCreateOrUpdateCollection200Response + | CollectionsCreateOrUpdateCollectionDefaultResponse, +): response is CollectionsCreateOrUpdateCollectionDefaultResponse; +export function isUnexpected( + response: CollectionsDeleteCollection204Response | CollectionsDeleteCollectionDefaultResponse, +): response is CollectionsDeleteCollectionDefaultResponse; +export function isUnexpected( + response: CollectionsListCollections200Response | CollectionsListCollectionsDefaultResponse, +): response is CollectionsListCollectionsDefaultResponse; +export function isUnexpected( + response: + | CollectionsListChildCollectionNames200Response + | CollectionsListChildCollectionNamesDefaultResponse, +): response is CollectionsListChildCollectionNamesDefaultResponse; +export function isUnexpected( + response: CollectionsGetCollectionPath200Response | CollectionsGetCollectionPathDefaultResponse, +): response is CollectionsGetCollectionPathDefaultResponse; +export function isUnexpected( + response: + | ResourceSetRulesGetResourceSetRule200Response + | ResourceSetRulesGetResourceSetRuleDefaultResponse, +): response is ResourceSetRulesGetResourceSetRuleDefaultResponse; +export function isUnexpected( + response: + | ResourceSetRulesCreateOrUpdateResourceSetRule200Response + | ResourceSetRulesCreateOrUpdateResourceSetRuleDefaultResponse, +): response is ResourceSetRulesCreateOrUpdateResourceSetRuleDefaultResponse; +export function isUnexpected( + response: + | ResourceSetRulesDeleteResourceSetRule200Response + | ResourceSetRulesDeleteResourceSetRule204Response + | ResourceSetRulesDeleteResourceSetRuleDefaultResponse, +): response is ResourceSetRulesDeleteResourceSetRuleDefaultResponse; +export function isUnexpected( + response: + | ResourceSetRulesListResourceSetRules200Response + | ResourceSetRulesListResourceSetRulesDefaultResponse, +): response is ResourceSetRulesListResourceSetRulesDefaultResponse; +export function isUnexpected( + response: + | AccountsGetAccountProperties200Response + | AccountsGetAccountPropertiesDefaultResponse + | AccountsUpdateAccountProperties200Response + | AccountsUpdateAccountPropertiesDefaultResponse + | AccountsGetAccessKeys200Response + | AccountsGetAccessKeysDefaultResponse + | AccountsRegenerateAccessKey200Response + | AccountsRegenerateAccessKeyDefaultResponse + | CollectionsGetCollection200Response + | CollectionsGetCollectionDefaultResponse + | CollectionsCreateOrUpdateCollection200Response + | CollectionsCreateOrUpdateCollectionDefaultResponse + | CollectionsDeleteCollection204Response + | CollectionsDeleteCollectionDefaultResponse + | CollectionsListCollections200Response + | CollectionsListCollectionsDefaultResponse + | CollectionsListChildCollectionNames200Response + | CollectionsListChildCollectionNamesDefaultResponse + | CollectionsGetCollectionPath200Response + | CollectionsGetCollectionPathDefaultResponse + | ResourceSetRulesGetResourceSetRule200Response + | ResourceSetRulesGetResourceSetRuleDefaultResponse + | ResourceSetRulesCreateOrUpdateResourceSetRule200Response + | ResourceSetRulesCreateOrUpdateResourceSetRuleDefaultResponse + | ResourceSetRulesDeleteResourceSetRule200Response + | ResourceSetRulesDeleteResourceSetRule204Response + | ResourceSetRulesDeleteResourceSetRuleDefaultResponse + | ResourceSetRulesListResourceSetRules200Response + | ResourceSetRulesListResourceSetRulesDefaultResponse, +): response is + | AccountsGetAccountPropertiesDefaultResponse + | AccountsUpdateAccountPropertiesDefaultResponse + | AccountsGetAccessKeysDefaultResponse + | AccountsRegenerateAccessKeyDefaultResponse + | CollectionsGetCollectionDefaultResponse + | CollectionsCreateOrUpdateCollectionDefaultResponse + | CollectionsDeleteCollectionDefaultResponse + | CollectionsListCollectionsDefaultResponse + | CollectionsListChildCollectionNamesDefaultResponse + | CollectionsGetCollectionPathDefaultResponse + | ResourceSetRulesGetResourceSetRuleDefaultResponse + | ResourceSetRulesCreateOrUpdateResourceSetRuleDefaultResponse + | ResourceSetRulesDeleteResourceSetRuleDefaultResponse + | ResourceSetRulesListResourceSetRulesDefaultResponse { + const lroOriginal = response.headers["x-ms-original-url"]; + const url = new URL(lroOriginal ?? response.request.url); + const method = response.request.method; + let pathDetails = responseMap[`${method} ${url.pathname}`]; + if (!pathDetails) { + pathDetails = getParametrizedPathSuccess(method, url.pathname); + } + return !pathDetails.includes(response.status); +} + +function getParametrizedPathSuccess(method: string, path: string): string[] { + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: string[] = []; + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(responseMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // track if we have found a match to return the values found. + let found = true; + for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { + if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( + pathParts[j] || "", + ); + + if (!isMatched) { + found = false; + break; + } + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} diff --git a/sdk/purview/purview-administration-rest/src/account/models.ts b/sdk/purview/purview-administration-rest/src/account/models.ts index 0d2d608408ae..224f07079e77 100644 --- a/sdk/purview/purview-administration-rest/src/account/models.ts +++ b/sdk/purview/purview-administration-rest/src/account/models.ts @@ -1,217 +1,35 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -export interface Account { - /** Gets or sets the identifier. */ - id?: string; - /** Identity Info on the tracked resource */ - identity?: Identity; - /** Gets or sets the location. */ - location?: string; - /** Gets or sets the name. */ - name?: string; - /** Gets or sets the properties. */ - properties?: AccountProperties; - /** Gets or sets the Sku. */ - sku?: AccountSku; - /** Metadata pertaining to creation and last modification of the resource. */ - systemData?: AccountSystemData; - /** Tags on the azure resource. */ - tags?: Record; - /** Gets or sets the type. */ - type?: string; -} - -export interface Identity { - /** Service principal object Id */ - principalId?: string; - /** Tenant Id */ - tenantId?: string; - /** Identity Type */ - type?: "SystemAssigned"; -} - -export interface AccountProperties { - /** - * Cloud connectors. - * External cloud identifier used as part of scanning configuration. - */ - cloudConnectors?: CloudConnectors; - /** Gets the time at which the entity was created. */ - createdAt?: Date; - /** Gets the creator of the entity. */ - createdBy?: string; - /** Gets the creators of the entity's object id. */ - createdByObjectId?: string; - /** The URIs that are the public endpoints of the account. */ - endpoints?: AccountPropertiesEndpoints; - /** Gets or sets the friendly name. */ - friendlyName?: string; - /** Gets or sets the managed resource group name */ - managedResourceGroupName?: string; - /** Gets the resource identifiers of the managed resources. */ - managedResources?: AccountPropertiesManagedResources; - /** Gets the private endpoint connections information. */ - privateEndpointConnections?: Array; - /** Gets or sets the state of the provisioning. */ - provisioningState?: - | "Unknown" - | "Creating" - | "Moving" - | "Deleting" - | "SoftDeleting" - | "SoftDeleted" - | "Failed" - | "Succeeded" - | "Canceled"; - /** Gets or sets the public network access. */ - publicNetworkAccess?: "NotSpecified" | "Enabled" | "Disabled"; -} - -export interface CloudConnectors { - /** - * AWS external identifier. - * Configured in AWS to allow use of the role arn used for scanning - */ - awsExternalId?: string; -} - -export interface AccountEndpoints { - /** Gets the catalog endpoint. */ - catalog?: string; - /** Gets the guardian endpoint. */ - guardian?: string; - /** Gets the scan endpoint. */ - scan?: string; -} - -export interface AccountPropertiesEndpoints extends AccountEndpoints {} - -export interface ManagedResources { - /** Gets the managed event hub namespace resource identifier. */ - eventHubNamespace?: string; - /** Gets the managed resource group resource identifier. This resource group will host resource dependencies for the account. */ - resourceGroup?: string; - /** Gets the managed storage account resource identifier. */ - storageAccount?: string; -} - -export interface AccountPropertiesManagedResources extends ManagedResources {} - -export interface PrivateEndpointConnection { - /** Gets or sets the identifier. */ - id?: string; - /** Gets or sets the name. */ - name?: string; - /** The connection identifier. */ - properties?: PrivateEndpointConnectionProperties; - /** Gets or sets the type. */ - type?: string; -} - -export interface PrivateEndpointConnectionProperties { - /** The private endpoint information. */ - privateEndpoint?: PrivateEndpoint; - /** The private link service connection state. */ - privateLinkServiceConnectionState?: PrivateLinkServiceConnectionState; - /** The provisioning state. */ - provisioningState?: string; -} - -export interface PrivateEndpoint { - /** The private endpoint identifier. */ - id?: string; -} - -export interface PrivateLinkServiceConnectionState { - /** The required actions. */ - actionsRequired?: string; - /** The description. */ - description?: string; - /** The status. */ - status?: "Unknown" | "Pending" | "Approved" | "Rejected" | "Disconnected"; -} - -export interface AccountSku { - /** Gets or sets the sku capacity. Possible values include: 4, 16 */ - capacity?: number; - /** Gets or sets the sku name. */ - name?: "Standard"; -} - -export interface SystemData { - /** The timestamp of resource creation (UTC). */ - createdAt?: Date; - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource. */ - createdByType?: "User" | "Application" | "ManagedIdentity" | "Key"; - /** The timestamp of the last modification the resource (UTC). */ - lastModifiedAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource. */ - lastModifiedByType?: "User" | "Application" | "ManagedIdentity" | "Key"; -} - +/** Metadata pertaining to creation and last modification of the resource. */ export interface AccountSystemData extends SystemData {} -export interface ErrorResponseModel { - /** Gets or sets the error. */ - error?: ErrorResponseModelError; -} - -export interface ErrorModel { - /** Gets or sets the code. */ - code?: string; - /** Gets or sets the details. */ - details?: Array; - /** Gets or sets the messages. */ - message?: string; - /** Gets or sets the target. */ - target?: string; -} - -export interface ErrorResponseModelError extends ErrorModel {} +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData {} +/** The account properties that can be updated through data plane. */ export interface DataPlaneAccountUpdateParameters { /** The friendly name for the azure resource. */ friendlyName?: string; } -export interface AccessKeys { - /** Gets or sets the primary connection string. */ - atlasKafkaPrimaryEndpoint?: string; - /** Gets or sets the secondary connection string. */ - atlasKafkaSecondaryEndpoint?: string; -} - +/** A access key options used for regeneration. */ export interface AccessKeyOptions { /** The access key type. */ keyType?: "PrimaryAtlasKafkaKey" | "SecondaryAtlasKafkaKey"; } +/** Collection resource. */ export interface Collection { - /** Gets the state of the provisioning. */ - collectionProvisioningState?: - | "Unknown" - | "Creating" - | "Moving" - | "Deleting" - | "Failed" - | "Succeeded"; /** Gets or sets the description. */ description?: string; /** Gets or sets the friendly name of the collection. */ friendlyName?: string; - /** Gets the name. */ - name?: string; /** Gets or sets the parent collection reference. */ parentCollection?: CollectionReference; - /** Metadata pertaining to creation and last modification of the resource. */ - systemData?: CollectionSystemData; } +/** Reference to a Collection. */ export interface CollectionReference { /** Gets or sets the reference name. */ referenceName?: string; @@ -219,52 +37,21 @@ export interface CollectionReference { type?: string; } +/** Metadata pertaining to creation and last modification of the resource. */ export interface CollectionSystemData extends SystemData {} -export interface CollectionList { - /** Total item count. */ - count?: number; - /** The Url of next result page. */ - nextLink?: string; - /** Collection of items of type results. */ - value: Array; -} - -export interface CollectionNameResponseList { - /** Total item count. */ - count?: number; - /** The Url of next result page. */ - nextLink?: string; - /** Collection of items of type results. */ - value: Array; -} - -export interface CollectionNameResponse { - /** Gets or sets the friendly name of the collection. */ - friendlyName?: string; - /** Gets the name. */ - name?: string; -} - -export interface CollectionPathResponse { - /** The friendly names of ancestors starting from the default (root) collection and ending with the immediate parent. */ - parentFriendlyNameChain?: Array; - /** The names of ancestors starting from the default (root) collection and ending with the immediate parent. */ - parentNameChain?: Array; -} - +/** ResourceSetRuleConfig implementation class. */ export interface ResourceSetRuleConfig { /** Gets or sets the advanced resource set property of the account. */ advancedResourceSet?: AdvancedResourceSet; - /** The name of the rule */ - name?: string; /** The configuration rules for path pattern extraction. */ pathPatternConfig?: PathPatternExtractorConfig; } +/** The resource set processing property of the account. */ export interface AdvancedResourceSet { /** Date at which ResourceSetProcessing property of the account is updated. */ - modifiedAt?: Date; + modifiedAt?: Date | string; /** The advanced resource property of the account. */ resourceSetProcessing?: "Default" | "Advanced"; } @@ -356,12 +143,3 @@ export interface Rule { name?: string; qualifiedName: string; } - -export interface ResourceSetRuleConfigList { - /** Total item count. */ - count?: number; - /** The Url of next result page. */ - nextLink?: string; - /** Collection of items of type results. */ - value: Array; -} diff --git a/sdk/purview/purview-administration-rest/src/account/outputModels.ts b/sdk/purview/purview-administration-rest/src/account/outputModels.ts new file mode 100644 index 000000000000..7be2b8167214 --- /dev/null +++ b/sdk/purview/purview-administration-rest/src/account/outputModels.ts @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** Account resource */ +export interface AccountOutput { + /** Gets or sets the identifier. */ + readonly id?: string; + /** Identity Info on the tracked resource */ + identity?: IdentityOutput; + /** Gets or sets the location. */ + location?: string; + /** Gets or sets the name. */ + readonly name?: string; + /** Gets or sets the properties. */ + properties?: AccountPropertiesOutput; + /** Gets or sets the Sku. */ + sku?: AccountSkuOutput; + /** Metadata pertaining to creation and last modification of the resource. */ + readonly systemData?: AccountSystemDataOutput; + /** Tags on the azure resource. */ + tags?: Record; + /** Gets or sets the type. */ + readonly type?: string; +} + +/** The Managed Identity of the resource */ +export interface IdentityOutput { + /** Service principal object Id */ + readonly principalId?: string; + /** Tenant Id */ + readonly tenantId?: string; + /** Identity Type */ + type?: "SystemAssigned"; +} + +/** The account properties */ +export interface AccountPropertiesOutput { + /** + * Cloud connectors. + * External cloud identifier used as part of scanning configuration. + */ + cloudConnectors?: CloudConnectorsOutput; + /** Gets the time at which the entity was created. */ + readonly createdAt?: string; + /** Gets the creator of the entity. */ + readonly createdBy?: string; + /** Gets the creators of the entity's object id. */ + readonly createdByObjectId?: string; + /** The URIs that are the public endpoints of the account. */ + readonly endpoints?: AccountPropertiesEndpointsOutput; + /** Gets or sets the friendly name. */ + readonly friendlyName?: string; + /** Gets or sets the managed resource group name */ + managedResourceGroupName?: string; + /** Gets the resource identifiers of the managed resources. */ + readonly managedResources?: AccountPropertiesManagedResourcesOutput; + /** Gets the private endpoint connections information. */ + readonly privateEndpointConnections?: Array; + /** Gets or sets the state of the provisioning. */ + readonly provisioningState?: + | "Unknown" + | "Creating" + | "Moving" + | "Deleting" + | "SoftDeleting" + | "SoftDeleted" + | "Failed" + | "Succeeded" + | "Canceled"; + /** Gets or sets the public network access. */ + publicNetworkAccess?: "NotSpecified" | "Enabled" | "Disabled"; +} + +export interface CloudConnectorsOutput { + /** + * AWS external identifier. + * Configured in AWS to allow use of the role arn used for scanning + */ + readonly awsExternalId?: string; +} + +/** The URIs that are the public endpoints of the account. */ +export interface AccountPropertiesEndpointsOutput extends AccountEndpointsOutput {} + +/** The account endpoints */ +export interface AccountEndpointsOutput { + /** Gets the catalog endpoint. */ + readonly catalog?: string; + /** Gets the guardian endpoint. */ + readonly guardian?: string; + /** Gets the scan endpoint. */ + readonly scan?: string; +} + +/** Gets the resource identifiers of the managed resources. */ +export interface AccountPropertiesManagedResourcesOutput extends ManagedResourcesOutput {} + +/** The managed resources in customer subscription. */ +export interface ManagedResourcesOutput { + /** Gets the managed event hub namespace resource identifier. */ + readonly eventHubNamespace?: string; + /** Gets the managed resource group resource identifier. This resource group will host resource dependencies for the account. */ + readonly resourceGroup?: string; + /** Gets the managed storage account resource identifier. */ + readonly storageAccount?: string; +} + +/** A private endpoint connection class. */ +export interface PrivateEndpointConnectionOutput { + /** Gets or sets the identifier. */ + readonly id?: string; + /** Gets or sets the name. */ + readonly name?: string; + /** The connection identifier. */ + properties?: PrivateEndpointConnectionPropertiesOutput; + /** Gets or sets the type. */ + readonly type?: string; +} + +/** A private endpoint connection properties class. */ +export interface PrivateEndpointConnectionPropertiesOutput { + /** The private endpoint information. */ + privateEndpoint?: PrivateEndpointOutput; + /** The private link service connection state. */ + privateLinkServiceConnectionState?: PrivateLinkServiceConnectionStateOutput; + /** The provisioning state. */ + readonly provisioningState?: string; +} + +/** A private endpoint class. */ +export interface PrivateEndpointOutput { + /** The private endpoint identifier. */ + id?: string; +} + +/** The private link service connection state. */ +export interface PrivateLinkServiceConnectionStateOutput { + /** The required actions. */ + actionsRequired?: string; + /** The description. */ + description?: string; + /** The status. */ + status?: "Unknown" | "Pending" | "Approved" | "Rejected" | "Disconnected"; +} + +/** The Sku */ +export interface AccountSkuOutput { + /** Gets or sets the sku capacity. Possible values include: 4, 16 */ + capacity?: number; + /** Gets or sets the sku name. */ + name?: "Standard"; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface AccountSystemDataOutput extends SystemDataOutput {} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemDataOutput { + /** The timestamp of resource creation (UTC). */ + readonly createdAt?: string; + /** The identity that created the resource. */ + readonly createdBy?: string; + /** The type of identity that created the resource. */ + readonly createdByType?: "User" | "Application" | "ManagedIdentity" | "Key"; + /** The timestamp of the last modification the resource (UTC). */ + readonly lastModifiedAt?: string; + /** The identity that last modified the resource. */ + readonly lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + readonly lastModifiedByType?: "User" | "Application" | "ManagedIdentity" | "Key"; +} + +/** Default error response model */ +export interface ErrorResponseModelOutput { + /** Gets or sets the error. */ + readonly error?: ErrorResponseModelErrorOutput; +} + +/** Gets or sets the error. */ +export interface ErrorResponseModelErrorOutput extends ErrorModelOutput {} + +/** Default error model */ +export interface ErrorModelOutput { + /** Gets or sets the code. */ + readonly code?: string; + /** Gets or sets the details. */ + readonly details?: Array; + /** Gets or sets the messages. */ + readonly message?: string; + /** Gets or sets the target. */ + readonly target?: string; +} + +/** The Account access keys. */ +export interface AccessKeysOutput { + /** Gets or sets the primary connection string. */ + atlasKafkaPrimaryEndpoint?: string; + /** Gets or sets the secondary connection string. */ + atlasKafkaSecondaryEndpoint?: string; +} + +/** Collection resource. */ +export interface CollectionOutput { + /** Gets the state of the provisioning. */ + readonly collectionProvisioningState?: + | "Unknown" + | "Creating" + | "Moving" + | "Deleting" + | "Failed" + | "Succeeded"; + /** Gets or sets the description. */ + description?: string; + /** Gets or sets the friendly name of the collection. */ + friendlyName?: string; + /** Gets the name. */ + readonly name?: string; + /** Gets or sets the parent collection reference. */ + parentCollection?: CollectionReferenceOutput; + /** Metadata pertaining to creation and last modification of the resource. */ + readonly systemData?: CollectionSystemDataOutput; +} + +/** Reference to a Collection. */ +export interface CollectionReferenceOutput { + /** Gets or sets the reference name. */ + referenceName?: string; + /** Gets or sets the reference type property. */ + type?: string; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface CollectionSystemDataOutput extends SystemDataOutput {} + +/** Paged list of collections. */ +export interface CollectionListOutput { + /** Total item count. */ + count?: number; + /** The Url of next result page. */ + nextLink?: string; + /** Collection of items of type results. */ + value: Array; +} + +/** Paged list of collections. */ +export interface CollectionNameResponseListOutput { + /** Total item count. */ + count?: number; + /** The Url of next result page. */ + nextLink?: string; + /** Collection of items of type results. */ + value: Array; +} + +/** Collection resource. */ +export interface CollectionNameResponseOutput { + /** Gets or sets the friendly name of the collection. */ + readonly friendlyName?: string; + /** Gets the name. */ + readonly name?: string; +} + +/** Collection resource. */ +export interface CollectionPathResponseOutput { + /** The friendly names of ancestors starting from the default (root) collection and ending with the immediate parent. */ + readonly parentFriendlyNameChain?: Array; + /** The names of ancestors starting from the default (root) collection and ending with the immediate parent. */ + readonly parentNameChain?: Array; +} + +/** ResourceSetRuleConfig implementation class. */ +export interface ResourceSetRuleConfigOutput { + /** Gets or sets the advanced resource set property of the account. */ + advancedResourceSet?: AdvancedResourceSetOutput; + /** The name of the rule */ + readonly name?: string; + /** The configuration rules for path pattern extraction. */ + pathPatternConfig?: PathPatternExtractorConfigOutput; +} + +/** The resource set processing property of the account. */ +export interface AdvancedResourceSetOutput { + /** Date at which ResourceSetProcessing property of the account is updated. */ + modifiedAt?: string; + /** The advanced resource property of the account. */ + resourceSetProcessing?: "Default" | "Advanced"; +} + +export interface PathPatternExtractorConfigOutput { + acceptedPatterns?: Array; + complexReplacers?: Array; + createdBy: string; + enableDefaultPatterns: boolean; + lastUpdatedTimestamp?: number; + modifiedBy?: string; + normalizationRules?: Array; + regexReplacers?: Array; + rejectedPatterns?: Array; + scopedRules?: Array; + version?: number; +} + +export interface FilterOutput { + createdBy?: string; + filterType?: "Pattern" | "Regex"; + lastUpdatedTimestamp?: number; + modifiedBy?: string; + name: string; + path: string; +} + +export interface ComplexReplacerConfigOutput { + createdBy?: string; + description?: string; + disabled?: boolean; + disableRecursiveReplacerApplication?: boolean; + lastUpdatedTimestamp?: number; + modifiedBy?: string; + name?: string; + typeName?: string; +} + +export interface NormalizationRuleOutput { + description?: string; + disabled?: boolean; + dynamicReplacement?: boolean; + entityTypes?: Array; + lastUpdatedTimestamp?: number; + name?: string; + regex?: FastRegexOutput; + replaceWith?: string; + version?: number; +} + +export interface FastRegexOutput { + maxDigits?: number; + maxLetters?: number; + minDashes?: number; + minDigits?: number; + minDigitsOrLetters?: number; + minDots?: number; + minHex?: number; + minLetters?: number; + minUnderscores?: number; + options?: number; + regexStr?: string; +} + +export interface RegexReplacerOutput { + condition?: string; + createdBy?: string; + description?: string; + disabled: boolean; + disableRecursiveReplacerApplication?: boolean; + doNotReplaceRegex?: FastRegexOutput; + lastUpdatedTimestamp?: number; + modifiedBy?: string; + name: string; + regex?: FastRegexOutput; + replaceWith?: string; +} + +export interface ScopedRuleOutput { + bindingUrl: string; + rules?: Array; + storeType: string; +} + +export interface RuleOutput { + displayName?: string; + isResourceSet?: boolean; + lastUpdatedTimestamp?: number; + name?: string; + qualifiedName: string; +} + +/** Paged list of account resources */ +export interface ResourceSetRuleConfigListOutput { + /** Total item count. */ + count?: number; + /** The Url of next result page. */ + nextLink?: string; + /** Collection of items of type results. */ + value: Array; +} diff --git a/sdk/purview/purview-administration-rest/src/account/paginateHelper.ts b/sdk/purview/purview-administration-rest/src/account/paginateHelper.ts index 5d541b4e406d..9ea946d9d6c5 100644 --- a/sdk/purview/purview-administration-rest/src/account/paginateHelper.ts +++ b/sdk/purview/purview-administration-rest/src/account/paginateHelper.ts @@ -1,11 +1,148 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { PagedAsyncIterableIterator, PagedResult } from "@azure/core-paging"; -import { getPagedAsyncIterator } from "@azure/core-paging"; import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; import { createRestError } from "@azure-rest/core-client"; +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings = PageSettings, + TLink = string, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + (((settings?: PageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken as unknown as TLink | undefined, + }); + }) as unknown as (settings?: TPageSettings) => AsyncIterableIterator), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + const firstVal = await pages.next(); + // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is + if (!Array.isArray(firstVal.value)) { + // can extract elements from this page + const { toElements } = pagedResult; + if (toElements) { + yield* toElements(firstVal.value) as TElement[]; + for await (const page of pages) { + yield* toElements(page) as TElement[]; + } + } else { + yield firstVal.value; + // `pages` is of type `AsyncIterableIterator` but TPage = TElement in this case + yield* pages as unknown as AsyncIterableIterator; + } + } else { + yield* firstVal.value; + for await (const page of pages) { + // pages is of type `AsyncIterableIterator` so `page` is of type `TPage`. In this branch, + // it must be the case that `TPage = TElement[]` + yield* page as unknown as TElement[]; + } + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: TLink; + } = {}, +): AsyncIterableIterator { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + yield response.page; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + yield response.page; + } +} + +/** + * An interface that tracks the settings for paged iteration + */ +export interface PageSettings { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +} + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator; +} + +/** + * An interface that describes how to communicate with the service. + */ +interface PagedResult { + /** + * Link to the first page of results. + */ + firstPageLink: TLink; + /** + * A method that returns a page of results. + */ + getPage: (pageLink: TLink) => Promise<{ page: TPage; nextPageLink?: TLink } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => unknown[]; +} + /** * Helper type to extract the type of an array */ @@ -14,10 +151,7 @@ export type GetArrayType = T extends Array ? TData : never; /** * The type of a custom function that defines how to get a page and a link to the next one if any. */ -export type GetPage = ( - pageLink: string, - maxPageSize?: number, -) => Promise<{ +export type GetPage = (pageLink: string) => Promise<{ page: TPage; nextPageLink?: string; }>; diff --git a/sdk/purview/purview-administration-rest/src/account/parameters.ts b/sdk/purview/purview-administration-rest/src/account/parameters.ts index 6fb52c5be160..75b6ed39dc3c 100644 --- a/sdk/purview/purview-administration-rest/src/account/parameters.ts +++ b/sdk/purview/purview-administration-rest/src/account/parameters.ts @@ -3,9 +3,9 @@ import type { RequestParameters } from "@azure-rest/core-client"; import type { + DataPlaneAccountUpdateParameters, AccessKeyOptions, Collection, - DataPlaneAccountUpdateParameters, ResourceSetRuleConfig, } from "./models.js"; @@ -15,15 +15,28 @@ export interface AccountsUpdateAccountPropertiesBodyParam { body: DataPlaneAccountUpdateParameters; } -export type AccountsUpdateAccountPropertiesParameters = AccountsUpdateAccountPropertiesBodyParam & - RequestParameters; +export interface AccountsUpdateAccountPropertiesMediaTypesParam { + /** Request content type */ + contentType?: "application/json"; +} + +export type AccountsUpdateAccountPropertiesParameters = + AccountsUpdateAccountPropertiesMediaTypesParam & + AccountsUpdateAccountPropertiesBodyParam & + RequestParameters; export type AccountsGetAccessKeysParameters = RequestParameters; export interface AccountsRegenerateAccessKeyBodyParam { body: AccessKeyOptions; } -export type AccountsRegenerateAccessKeyParameters = AccountsRegenerateAccessKeyBodyParam & +export interface AccountsRegenerateAccessKeyMediaTypesParam { + /** Request content type */ + contentType?: "application/json"; +} + +export type AccountsRegenerateAccessKeyParameters = AccountsRegenerateAccessKeyMediaTypesParam & + AccountsRegenerateAccessKeyBodyParam & RequestParameters; export type CollectionsGetCollectionParameters = RequestParameters; @@ -31,8 +44,15 @@ export interface CollectionsCreateOrUpdateCollectionBodyParam { body: Collection; } +export interface CollectionsCreateOrUpdateCollectionMediaTypesParam { + /** Request content type */ + contentType?: "application/json"; +} + export type CollectionsCreateOrUpdateCollectionParameters = - CollectionsCreateOrUpdateCollectionBodyParam & RequestParameters; + CollectionsCreateOrUpdateCollectionMediaTypesParam & + CollectionsCreateOrUpdateCollectionBodyParam & + RequestParameters; export type CollectionsDeleteCollectionParameters = RequestParameters; export interface CollectionsListCollectionsQueryParamProperties { @@ -63,8 +83,15 @@ export interface ResourceSetRulesCreateOrUpdateResourceSetRuleBodyParam { body: ResourceSetRuleConfig; } +export interface ResourceSetRulesCreateOrUpdateResourceSetRuleMediaTypesParam { + /** Request content type */ + contentType?: "application/json"; +} + export type ResourceSetRulesCreateOrUpdateResourceSetRuleParameters = - ResourceSetRulesCreateOrUpdateResourceSetRuleBodyParam & RequestParameters; + ResourceSetRulesCreateOrUpdateResourceSetRuleMediaTypesParam & + ResourceSetRulesCreateOrUpdateResourceSetRuleBodyParam & + RequestParameters; export type ResourceSetRulesDeleteResourceSetRuleParameters = RequestParameters; export interface ResourceSetRulesListResourceSetRulesQueryParamProperties { diff --git a/sdk/purview/purview-administration-rest/src/account/purviewAccount.ts b/sdk/purview/purview-administration-rest/src/account/purviewAccount.ts index e65b792b035a..598616341dcc 100644 --- a/sdk/purview/purview-administration-rest/src/account/purviewAccount.ts +++ b/sdk/purview/purview-administration-rest/src/account/purviewAccount.ts @@ -1,23 +1,65 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import type { ClientOptions } from "@azure-rest/core-client"; import { getClient } from "@azure-rest/core-client"; +import { logger } from "../logger.js"; import type { TokenCredential } from "@azure/core-auth"; -import type { PurviewAccountRestClient } from "./clientDefinitions.js"; +import type { PurviewAccountClient } from "./clientDefinitions.js"; + +/** The optional parameters for the client */ +export interface PurviewAccountClientOptions extends ClientOptions { + /** The api version option of the client */ + apiVersion?: string; +} -export function PurviewAccountClient( +/** + * Initialize a new instance of `PurviewAccountClient` + * @param endpoint - The account endpoint of your Purview account. Example: https://\{accountName\}.purview.azure.com/account/ + * @param credentials - uniquely identify client credential + * @param options - the parameter for all optional parameters + */ +export function createClient( endpoint: string, credentials: TokenCredential, - options: ClientOptions = {}, -): PurviewAccountRestClient { - const baseUrl = options.baseUrl ?? `${endpoint}`; - options.apiVersion = options.apiVersion ?? "2019-11-01-preview"; + { apiVersion = "2019-11-01-preview", ...options }: PurviewAccountClientOptions = {}, +): PurviewAccountClient { + const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpoint}`; + const userAgentInfo = `azsdk-js-purview-administration-rest/1.0.0-beta.2`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; options = { ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, credentials: { scopes: ["https://purview.azure.net/.default"], }, }; + const client = getClient(endpointUrl, credentials, options) as PurviewAccountClient; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + client.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version") && apiVersion) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); - return getClient(baseUrl, credentials, options) as PurviewAccountRestClient; + return client; } diff --git a/sdk/purview/purview-administration-rest/src/account/responses.ts b/sdk/purview/purview-administration-rest/src/account/responses.ts index 996b82ed620d..a7e85eca15c4 100644 --- a/sdk/purview/purview-administration-rest/src/account/responses.ts +++ b/sdk/purview/purview-administration-rest/src/account/responses.ts @@ -3,187 +3,184 @@ import type { HttpResponse } from "@azure-rest/core-client"; import type { - AccessKeys, - Account, - Collection, - CollectionList, - CollectionNameResponseList, - CollectionPathResponse, - ErrorResponseModel, - ResourceSetRuleConfig, - ResourceSetRuleConfigList, -} from "./models.js"; + AccountOutput, + ErrorResponseModelOutput, + AccessKeysOutput, + CollectionOutput, + CollectionListOutput, + CollectionNameResponseListOutput, + CollectionPathResponseOutput, + ResourceSetRuleConfigOutput, + ResourceSetRuleConfigListOutput, +} from "./outputModels.js"; /** Get an account */ export interface AccountsGetAccountProperties200Response extends HttpResponse { status: "200"; - body: Account; + body: AccountOutput; } /** Get an account */ -export interface AccountsGetAccountPropertiesdefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; +export interface AccountsGetAccountPropertiesDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; } /** Updates an account */ export interface AccountsUpdateAccountProperties200Response extends HttpResponse { status: "200"; - body: Account; + body: AccountOutput; } /** Updates an account */ -export interface AccountsUpdateAccountPropertiesdefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; +export interface AccountsUpdateAccountPropertiesDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; } /** List the authorization keys associated with this account. */ export interface AccountsGetAccessKeys200Response extends HttpResponse { status: "200"; - body: AccessKeys; + body: AccessKeysOutput; } /** List the authorization keys associated with this account. */ -export interface AccountsGetAccessKeysdefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; +export interface AccountsGetAccessKeysDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; } /** Regenerate the authorization keys associated with this data catalog. */ export interface AccountsRegenerateAccessKey200Response extends HttpResponse { status: "200"; - body: AccessKeys; + body: AccessKeysOutput; } /** Regenerate the authorization keys associated with this data catalog. */ -export interface AccountsRegenerateAccessKeydefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; +export interface AccountsRegenerateAccessKeyDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; } /** Get a collection */ export interface CollectionsGetCollection200Response extends HttpResponse { status: "200"; - body: Collection; + body: CollectionOutput; } /** Get a collection */ -export interface CollectionsGetCollectiondefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; +export interface CollectionsGetCollectionDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; } /** Creates or updates a collection entity. */ export interface CollectionsCreateOrUpdateCollection200Response extends HttpResponse { status: "200"; - body: Collection; + body: CollectionOutput; } /** Creates or updates a collection entity. */ -export interface CollectionsCreateOrUpdateCollectiondefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; +export interface CollectionsCreateOrUpdateCollectionDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; } /** Deletes a Collection entity. */ export interface CollectionsDeleteCollection204Response extends HttpResponse { status: "204"; - body: Record; } /** Deletes a Collection entity. */ -export interface CollectionsDeleteCollectiondefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; +export interface CollectionsDeleteCollectionDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; } /** List the collections in the account. */ export interface CollectionsListCollections200Response extends HttpResponse { status: "200"; - body: CollectionList; + body: CollectionListOutput; } /** List the collections in the account. */ -export interface CollectionsListCollectionsdefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; +export interface CollectionsListCollectionsDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; } /** Lists the child collections names in the collection. */ export interface CollectionsListChildCollectionNames200Response extends HttpResponse { status: "200"; - body: CollectionNameResponseList; + body: CollectionNameResponseListOutput; } /** Lists the child collections names in the collection. */ -export interface CollectionsListChildCollectionNamesdefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; +export interface CollectionsListChildCollectionNamesDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; } /** Gets the parent name and parent friendly name chains that represent the collection path. */ export interface CollectionsGetCollectionPath200Response extends HttpResponse { status: "200"; - body: CollectionPathResponse; + body: CollectionPathResponseOutput; } /** Gets the parent name and parent friendly name chains that represent the collection path. */ -export interface CollectionsGetCollectionPathdefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; +export interface CollectionsGetCollectionPathDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; } /** Get a resource set config service model. */ export interface ResourceSetRulesGetResourceSetRule200Response extends HttpResponse { status: "200"; - body: ResourceSetRuleConfig; + body: ResourceSetRuleConfigOutput; } /** Get a resource set config service model. */ -export interface ResourceSetRulesGetResourceSetRuledefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; +export interface ResourceSetRulesGetResourceSetRuleDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; } /** Creates or updates an resource set config. */ export interface ResourceSetRulesCreateOrUpdateResourceSetRule200Response extends HttpResponse { status: "200"; - body: ResourceSetRuleConfig; + body: ResourceSetRuleConfigOutput; } /** Creates or updates an resource set config. */ -export interface ResourceSetRulesCreateOrUpdateResourceSetRuledefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; +export interface ResourceSetRulesCreateOrUpdateResourceSetRuleDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; } /** Deletes a ResourceSetRuleConfig resource. */ export interface ResourceSetRulesDeleteResourceSetRule200Response extends HttpResponse { status: "200"; - body: Record; } /** Deletes a ResourceSetRuleConfig resource. */ export interface ResourceSetRulesDeleteResourceSetRule204Response extends HttpResponse { status: "204"; - body: Record; } /** Deletes a ResourceSetRuleConfig resource. */ -export interface ResourceSetRulesDeleteResourceSetRuledefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; +export interface ResourceSetRulesDeleteResourceSetRuleDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; } /** Get a resource set config service model. */ export interface ResourceSetRulesListResourceSetRules200Response extends HttpResponse { status: "200"; - body: ResourceSetRuleConfigList; + body: ResourceSetRuleConfigListOutput; } /** Get a resource set config service model. */ -export interface ResourceSetRulesListResourceSetRulesdefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; +export interface ResourceSetRulesListResourceSetRulesDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; } diff --git a/sdk/purview/purview-administration-rest/src/index.ts b/sdk/purview/purview-administration-rest/src/index.ts index 5c8325b9571b..8fe29275e261 100644 --- a/sdk/purview/purview-administration-rest/src/index.ts +++ b/sdk/purview/purview-administration-rest/src/index.ts @@ -1,10 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import * as PurviewAccount from "./account/index.js"; import * as PurviewMetadataPolicies from "./metadataPolicies/index.js"; +import * as PurviewAccount from "./account/index.js"; -export { PurviewAccount }; -export { PurviewMetadataPolicies }; -export { PurviewAccountClient } from "./account/purviewAccount.js"; -export { PurviewMetadataPoliciesClient } from "./metadataPolicies/purviewMetadataPolicies.js"; +export { PurviewMetadataPolicies, PurviewAccount }; diff --git a/sdk/purview/purview-administration-rest/src/logger.ts b/sdk/purview/purview-administration-rest/src/logger.ts new file mode 100644 index 000000000000..f5d8affecfff --- /dev/null +++ b/sdk/purview/purview-administration-rest/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("purview-administration"); diff --git a/sdk/purview/purview-administration-rest/src/metadataPolicies/clientDefinitions.ts b/sdk/purview/purview-administration-rest/src/metadataPolicies/clientDefinitions.ts index 841db945ece0..5fbcd01bbbb8 100644 --- a/sdk/purview/purview-administration-rest/src/metadataPolicies/clientDefinitions.ts +++ b/sdk/purview/purview-administration-rest/src/metadataPolicies/clientDefinitions.ts @@ -1,47 +1,47 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { Client } from "@azure-rest/core-client"; import type { - MetadataPolicyGetParameters, + MetadataRolesListParameters, MetadataPolicyListAllParameters, MetadataPolicyUpdateParameters, - MetadataRolesListParameters, + MetadataPolicyGetParameters, } from "./parameters.js"; import type { - MetadataPolicyGet200Response, - MetadataPolicyGetdefaultResponse, + MetadataRolesList200Response, + MetadataRolesListDefaultResponse, MetadataPolicyListAll200Response, - MetadataPolicyListAlldefaultResponse, + MetadataPolicyListAllDefaultResponse, MetadataPolicyUpdate200Response, - MetadataPolicyUpdatedefaultResponse, - MetadataRolesList200Response, - MetadataRolesListdefaultResponse, + MetadataPolicyUpdateDefaultResponse, + MetadataPolicyGet200Response, + MetadataPolicyGetDefaultResponse, } from "./responses.js"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface MetadataRolesList { /** Lists roles for Purview Account */ get( options?: MetadataRolesListParameters, - ): Promise; + ): StreamableMethod; } export interface MetadataPolicyListAll { /** List or Get metadata policies */ get( options?: MetadataPolicyListAllParameters, - ): Promise; + ): StreamableMethod; } export interface MetadataPolicyUpdate { /** Updates a metadata policy */ put( options?: MetadataPolicyUpdateParameters, - ): Promise; + ): StreamableMethod; /** Gets a metadata policy */ get( options?: MetadataPolicyGetParameters, - ): Promise; + ): StreamableMethod; } export interface Routes { @@ -53,6 +53,6 @@ export interface Routes { (path: "/metadataPolicies/{policyId}", policyId: string): MetadataPolicyUpdate; } -export type PurviewMetadataPoliciesRestClient = Client & { +export type PurviewMetadataPoliciesClient = Client & { path: Routes; }; diff --git a/sdk/purview/purview-administration-rest/src/metadataPolicies/index.ts b/sdk/purview/purview-administration-rest/src/metadataPolicies/index.ts index 40ab5ad8300f..d0be37103484 100644 --- a/sdk/purview/purview-administration-rest/src/metadataPolicies/index.ts +++ b/sdk/purview/purview-administration-rest/src/metadataPolicies/index.ts @@ -1,10 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import * as Models from "./models.js"; -import * as Pagination from "./paginateHelper.js"; import * as Parameters from "./parameters.js"; -import * as Client from "./clientDefinitions.js"; import * as Responses from "./responses.js"; -export { PurviewMetadataPoliciesClient } from "./purviewMetadataPolicies.js"; -export { Models, Pagination, Parameters, Client, Responses }; +import * as Client from "./clientDefinitions.js"; +import * as Models from "./models.js"; +import * as OutputModels from "./outputModels.js"; +import * as PaginateHelper from "./paginateHelper.js"; +import * as UnexpectedHelper from "./isUnexpected.js"; + +export { createClient, PurviewMetadataPoliciesClientOptions } from "./purviewMetadataPolicies.js"; +export { Parameters, Responses, Client, Models, OutputModels, PaginateHelper, UnexpectedHelper }; diff --git a/sdk/purview/purview-administration-rest/src/metadataPolicies/isUnexpected.ts b/sdk/purview/purview-administration-rest/src/metadataPolicies/isUnexpected.ts new file mode 100644 index 000000000000..8c0a2387e5ff --- /dev/null +++ b/sdk/purview/purview-administration-rest/src/metadataPolicies/isUnexpected.ts @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + MetadataRolesList200Response, + MetadataRolesListDefaultResponse, + MetadataPolicyListAll200Response, + MetadataPolicyListAllDefaultResponse, + MetadataPolicyUpdate200Response, + MetadataPolicyUpdateDefaultResponse, + MetadataPolicyGet200Response, + MetadataPolicyGetDefaultResponse, +} from "./responses.js"; + +const responseMap: Record = { + "GET /metadataRoles": ["200"], + "GET /metadataPolicies": ["200"], + "PUT /metadataPolicies/{policyId}": ["200"], + "GET /metadataPolicies/{policyId}": ["200"], +}; + +export function isUnexpected( + response: MetadataRolesList200Response | MetadataRolesListDefaultResponse, +): response is MetadataRolesListDefaultResponse; +export function isUnexpected( + response: MetadataPolicyListAll200Response | MetadataPolicyListAllDefaultResponse, +): response is MetadataPolicyListAllDefaultResponse; +export function isUnexpected( + response: MetadataPolicyUpdate200Response | MetadataPolicyUpdateDefaultResponse, +): response is MetadataPolicyUpdateDefaultResponse; +export function isUnexpected( + response: MetadataPolicyGet200Response | MetadataPolicyGetDefaultResponse, +): response is MetadataPolicyGetDefaultResponse; +export function isUnexpected( + response: + | MetadataRolesList200Response + | MetadataRolesListDefaultResponse + | MetadataPolicyListAll200Response + | MetadataPolicyListAllDefaultResponse + | MetadataPolicyUpdate200Response + | MetadataPolicyUpdateDefaultResponse + | MetadataPolicyGet200Response + | MetadataPolicyGetDefaultResponse, +): response is + | MetadataRolesListDefaultResponse + | MetadataPolicyListAllDefaultResponse + | MetadataPolicyUpdateDefaultResponse + | MetadataPolicyGetDefaultResponse { + const lroOriginal = response.headers["x-ms-original-url"]; + const url = new URL(lroOriginal ?? response.request.url); + const method = response.request.method; + let pathDetails = responseMap[`${method} ${url.pathname}`]; + if (!pathDetails) { + pathDetails = getParametrizedPathSuccess(method, url.pathname); + } + return !pathDetails.includes(response.status); +} + +function getParametrizedPathSuccess(method: string, path: string): string[] { + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: string[] = []; + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(responseMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // track if we have found a match to return the values found. + let found = true; + for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { + if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( + pathParts[j] || "", + ); + + if (!isMatched) { + found = false; + break; + } + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} diff --git a/sdk/purview/purview-administration-rest/src/metadataPolicies/models.ts b/sdk/purview/purview-administration-rest/src/metadataPolicies/models.ts index b5257759a9f7..c8ee3fb8a3b7 100644 --- a/sdk/purview/purview-administration-rest/src/metadataPolicies/models.ts +++ b/sdk/purview/purview-administration-rest/src/metadataPolicies/models.ts @@ -1,38 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -export interface MetadataRoleList { - values: Array; - nextLink?: string; -} - -export interface MetadataRole { - /** The Id of role */ - id?: string; - /** The name of role */ - name?: string; - /** The type of role */ - type?: string; - properties?: MetadataRoleProperties; -} - -export interface MetadataRoleProperties { - /** The provisioningState of role */ - provisioningState?: string; - /** The type of role */ - roleType?: string; - /** The friendly name of role */ - friendlyName?: string; - /** The description of role */ - description?: string; - /** The cnf Condition for a rule */ - cnfCondition?: Array>; - /** The dnf Condition for a rule */ - dnfCondition?: Array>; - /** The version of role */ - version?: number; -} - +/** Attribute matcher for a rule */ export interface AttributeMatcher { /** AttributeName */ attributeName?: string; @@ -46,27 +15,6 @@ export interface AttributeMatcher { attributeValueExcludedIn?: Array; } -export interface ErrorResponseModel { - /** The error model for metadata policy */ - error: ErrorModel; -} - -export interface ErrorModel { - /** The error code */ - code: string; - /** The error message */ - message: string; - /** The error target */ - target?: string; - /** The error details */ - details?: Array; -} - -export interface MetadataPolicyList { - values: Array; - nextLink?: string; -} - export interface MetadataPolicy { /** The name of policy */ name?: string; @@ -90,18 +38,16 @@ export interface MetadataPolicyProperties { parentCollectionName?: string; } +/** The decision rule for a policy */ export interface DecisionRule { - /** The kind of rule */ - kind?: "decisionrule" | "attributerule"; /** The effect for rule */ effect?: "Deny" | "Permit"; /** The dnf Condition for a rule */ dnfCondition?: Array>; } +/** The attribute rule for a policy */ export interface AttributeRule { - /** The kind of rule */ - kind?: "decisionrule" | "attributerule"; /** The id for rule */ id?: string; /** The name for rule */ @@ -110,6 +56,7 @@ export interface AttributeRule { dnfCondition?: Array>; } +/** The collection reference for a policy */ export interface CollectionReference { /** The type of reference */ type?: string; diff --git a/sdk/purview/purview-administration-rest/src/metadataPolicies/outputModels.ts b/sdk/purview/purview-administration-rest/src/metadataPolicies/outputModels.ts new file mode 100644 index 000000000000..90bc7ac21963 --- /dev/null +++ b/sdk/purview/purview-administration-rest/src/metadataPolicies/outputModels.ts @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** List of Metadata roles */ +export interface MetadataRoleListOutput { + values: Array; + nextLink?: string; +} + +export interface MetadataRoleOutput { + /** The Id of role */ + id?: string; + /** The name of role */ + name?: string; + /** The type of role */ + type?: string; + properties?: MetadataRolePropertiesOutput; +} + +export interface MetadataRolePropertiesOutput { + /** The provisioningState of role */ + provisioningState?: string; + /** The type of role */ + roleType?: string; + /** The friendly name of role */ + friendlyName?: string; + /** The description of role */ + description?: string; + /** The cnf Condition for a rule */ + cnfCondition?: Array>; + /** The dnf Condition for a rule */ + dnfCondition?: Array>; + /** The version of role */ + version?: number; +} + +/** Attribute matcher for a rule */ +export interface AttributeMatcherOutput { + /** AttributeName */ + attributeName?: string; + /** Value for attribute */ + attributeValueIncludes?: string; + /** List of values for attribute */ + attributeValueIncludedIn?: Array; + /** Value excluded for attribute */ + attributeValueExcludes?: string; + /** List of values excluded for attribute */ + attributeValueExcludedIn?: Array; +} + +/** The error response model for metadata policy */ +export interface ErrorResponseModelOutput { + /** The error model for metadata policy */ + error: ErrorModelOutput; +} + +/** The error model for metadata policy */ +export interface ErrorModelOutput { + /** The error code */ + code: string; + /** The error message */ + message: string; + /** The error target */ + target?: string; + /** The error details */ + details?: Array; +} + +/** List of Metadata Policies */ +export interface MetadataPolicyListOutput { + values: Array; + nextLink?: string; +} + +export interface MetadataPolicyOutput { + /** The name of policy */ + name?: string; + /** The id of policy */ + id?: string; + /** The version of policy */ + version?: number; + properties?: MetadataPolicyPropertiesOutput; +} + +export interface MetadataPolicyPropertiesOutput { + /** The description of policy */ + description?: string; + /** The DecisionRules of policy */ + decisionRules?: Array; + /** The AttributeRules of policy */ + attributeRules?: Array; + /** The collection reference for a policy */ + collection?: CollectionReferenceOutput; + /** The parent collection of the policy */ + parentCollectionName?: string; +} + +/** The decision rule for a policy */ +export interface DecisionRuleOutput { + /** The kind of rule */ + readonly kind?: "decisionrule" | "attributerule"; + /** The effect for rule */ + effect?: "Deny" | "Permit"; + /** The dnf Condition for a rule */ + dnfCondition?: Array>; +} + +/** The attribute rule for a policy */ +export interface AttributeRuleOutput { + /** The kind of rule */ + readonly kind?: "decisionrule" | "attributerule"; + /** The id for rule */ + id?: string; + /** The name for rule */ + name?: string; + /** The dnf Condition for a rule */ + dnfCondition?: Array>; +} + +/** The collection reference for a policy */ +export interface CollectionReferenceOutput { + /** The type of reference */ + type?: string; + /** The name of reference */ + referenceName?: string; +} diff --git a/sdk/purview/purview-administration-rest/src/metadataPolicies/paginateHelper.ts b/sdk/purview/purview-administration-rest/src/metadataPolicies/paginateHelper.ts index eb9582b5c730..fe3ccda2d8ce 100644 --- a/sdk/purview/purview-administration-rest/src/metadataPolicies/paginateHelper.ts +++ b/sdk/purview/purview-administration-rest/src/metadataPolicies/paginateHelper.ts @@ -1,11 +1,148 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { PagedAsyncIterableIterator, PagedResult } from "@azure/core-paging"; -import { getPagedAsyncIterator } from "@azure/core-paging"; import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; import { createRestError } from "@azure-rest/core-client"; +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings = PageSettings, + TLink = string, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + (((settings?: PageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken as unknown as TLink | undefined, + }); + }) as unknown as (settings?: TPageSettings) => AsyncIterableIterator), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + const firstVal = await pages.next(); + // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is + if (!Array.isArray(firstVal.value)) { + // can extract elements from this page + const { toElements } = pagedResult; + if (toElements) { + yield* toElements(firstVal.value) as TElement[]; + for await (const page of pages) { + yield* toElements(page) as TElement[]; + } + } else { + yield firstVal.value; + // `pages` is of type `AsyncIterableIterator` but TPage = TElement in this case + yield* pages as unknown as AsyncIterableIterator; + } + } else { + yield* firstVal.value; + for await (const page of pages) { + // pages is of type `AsyncIterableIterator` so `page` is of type `TPage`. In this branch, + // it must be the case that `TPage = TElement[]` + yield* page as unknown as TElement[]; + } + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: TLink; + } = {}, +): AsyncIterableIterator { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + yield response.page; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + yield response.page; + } +} + +/** + * An interface that tracks the settings for paged iteration + */ +export interface PageSettings { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +} + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator; +} + +/** + * An interface that describes how to communicate with the service. + */ +interface PagedResult { + /** + * Link to the first page of results. + */ + firstPageLink: TLink; + /** + * A method that returns a page of results. + */ + getPage: (pageLink: TLink) => Promise<{ page: TPage; nextPageLink?: TLink } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => unknown[]; +} + /** * Helper type to extract the type of an array */ @@ -14,10 +151,7 @@ export type GetArrayType = T extends Array ? TData : never; /** * The type of a custom function that defines how to get a page and a link to the next one if any. */ -export type GetPage = ( - pageLink: string, - maxPageSize?: number, -) => Promise<{ +export type GetPage = (pageLink: string) => Promise<{ page: TPage; nextPageLink?: string; }>; diff --git a/sdk/purview/purview-administration-rest/src/metadataPolicies/parameters.ts b/sdk/purview/purview-administration-rest/src/metadataPolicies/parameters.ts index 88e85e8d2437..914fd9ed3810 100644 --- a/sdk/purview/purview-administration-rest/src/metadataPolicies/parameters.ts +++ b/sdk/purview/purview-administration-rest/src/metadataPolicies/parameters.ts @@ -22,5 +22,12 @@ export interface MetadataPolicyUpdateBodyParam { body?: MetadataPolicy; } -export type MetadataPolicyUpdateParameters = MetadataPolicyUpdateBodyParam & RequestParameters; +export interface MetadataPolicyUpdateMediaTypesParam { + /** Request content type */ + contentType?: "application/json"; +} + +export type MetadataPolicyUpdateParameters = MetadataPolicyUpdateMediaTypesParam & + MetadataPolicyUpdateBodyParam & + RequestParameters; export type MetadataPolicyGetParameters = RequestParameters; diff --git a/sdk/purview/purview-administration-rest/src/metadataPolicies/purviewMetadataPolicies.ts b/sdk/purview/purview-administration-rest/src/metadataPolicies/purviewMetadataPolicies.ts index fc806edb29b1..2cf364fb6cca 100644 --- a/sdk/purview/purview-administration-rest/src/metadataPolicies/purviewMetadataPolicies.ts +++ b/sdk/purview/purview-administration-rest/src/metadataPolicies/purviewMetadataPolicies.ts @@ -3,22 +3,63 @@ import type { ClientOptions } from "@azure-rest/core-client"; import { getClient } from "@azure-rest/core-client"; +import { logger } from "../logger.js"; import type { TokenCredential } from "@azure/core-auth"; -import type { PurviewMetadataPoliciesRestClient } from "./clientDefinitions.js"; +import type { PurviewMetadataPoliciesClient } from "./clientDefinitions.js"; -export function PurviewMetadataPoliciesClient( - Endpoint: string, +/** The optional parameters for the client */ +export interface PurviewMetadataPoliciesClientOptions extends ClientOptions { + /** The api version option of the client */ + apiVersion?: string; +} + +/** + * Initialize a new instance of `PurviewMetadataPoliciesClient` + * @param endpoint - The endpoint of your Purview account. Example: https://\{accountName\}.purview.azure.com. + * @param credentials - uniquely identify client credential + * @param options - the parameter for all optional parameters + */ +export function createClient( + endpoint: string, credentials: TokenCredential, - options: ClientOptions = {}, -): PurviewMetadataPoliciesRestClient { - const baseUrl = options.baseUrl ?? `${Endpoint}/policyStore`; - options.apiVersion = options.apiVersion ?? "2021-07-01-preview"; + { apiVersion = "2021-07-01-preview", ...options }: PurviewMetadataPoliciesClientOptions = {}, +): PurviewMetadataPoliciesClient { + const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpoint}/policyStore`; + const userAgentInfo = `azsdk-js-purview-administration-rest/1.0.0-beta.2`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; options = { ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, credentials: { scopes: ["https://purview.azure.net/.default"], }, }; + const client = getClient(endpointUrl, credentials, options) as PurviewMetadataPoliciesClient; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + client.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version") && apiVersion) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); - return getClient(baseUrl, credentials, options) as PurviewMetadataPoliciesRestClient; + return client; } diff --git a/sdk/purview/purview-administration-rest/src/metadataPolicies/responses.ts b/sdk/purview/purview-administration-rest/src/metadataPolicies/responses.ts index 0c3076520fdb..11317a6fa51d 100644 --- a/sdk/purview/purview-administration-rest/src/metadataPolicies/responses.ts +++ b/sdk/purview/purview-administration-rest/src/metadataPolicies/responses.ts @@ -1,83 +1,83 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { HttpResponse } from "@azure-rest/core-client"; import type { RawHttpHeaders } from "@azure/core-rest-pipeline"; +import type { HttpResponse } from "@azure-rest/core-client"; import type { - ErrorResponseModel, - MetadataPolicy, - MetadataPolicyList, - MetadataRoleList, -} from "./models.js"; + MetadataRoleListOutput, + ErrorResponseModelOutput, + MetadataPolicyListOutput, + MetadataPolicyOutput, +} from "./outputModels.js"; /** Lists roles for Purview Account */ export interface MetadataRolesList200Response extends HttpResponse { status: "200"; - body: MetadataRoleList; + body: MetadataRoleListOutput; } -export interface MetadataRolesListdefaultHeaders { +export interface MetadataRolesListDefaultHeaders { /** The error code */ "x-ms-error-code"?: string; } /** Lists roles for Purview Account */ -export interface MetadataRolesListdefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; - headers: RawHttpHeaders & MetadataRolesListdefaultHeaders; +export interface MetadataRolesListDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; + headers: RawHttpHeaders & MetadataRolesListDefaultHeaders; } /** List or Get metadata policies */ export interface MetadataPolicyListAll200Response extends HttpResponse { status: "200"; - body: MetadataPolicyList; + body: MetadataPolicyListOutput; } -export interface MetadataPolicyListAlldefaultHeaders { +export interface MetadataPolicyListAllDefaultHeaders { /** The error code */ "x-ms-error-code"?: string; } /** List or Get metadata policies */ -export interface MetadataPolicyListAlldefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; - headers: RawHttpHeaders & MetadataPolicyListAlldefaultHeaders; +export interface MetadataPolicyListAllDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; + headers: RawHttpHeaders & MetadataPolicyListAllDefaultHeaders; } /** Updates a metadata policy */ export interface MetadataPolicyUpdate200Response extends HttpResponse { status: "200"; - body: MetadataPolicy; + body: MetadataPolicyOutput; } -export interface MetadataPolicyUpdatedefaultHeaders { +export interface MetadataPolicyUpdateDefaultHeaders { /** The error code */ "x-ms-error-code"?: string; } /** Updates a metadata policy */ -export interface MetadataPolicyUpdatedefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; - headers: RawHttpHeaders & MetadataPolicyUpdatedefaultHeaders; +export interface MetadataPolicyUpdateDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; + headers: RawHttpHeaders & MetadataPolicyUpdateDefaultHeaders; } /** Gets a metadata policy */ export interface MetadataPolicyGet200Response extends HttpResponse { status: "200"; - body: MetadataPolicy; + body: MetadataPolicyOutput; } -export interface MetadataPolicyGetdefaultHeaders { +export interface MetadataPolicyGetDefaultHeaders { /** The error code */ "x-ms-error-code"?: string; } /** Gets a metadata policy */ -export interface MetadataPolicyGetdefaultResponse extends HttpResponse { - status: "500"; - body: ErrorResponseModel; - headers: RawHttpHeaders & MetadataPolicyGetdefaultHeaders; +export interface MetadataPolicyGetDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseModelOutput; + headers: RawHttpHeaders & MetadataPolicyGetDefaultHeaders; } diff --git a/sdk/purview/purview-administration-rest/swagger/README.md b/sdk/purview/purview-administration-rest/swagger/README.md index 10099375fe9a..3cd368039c63 100644 --- a/sdk/purview/purview-administration-rest/swagger/README.md +++ b/sdk/purview/purview-administration-rest/swagger/README.md @@ -7,21 +7,23 @@ ```yaml $(purview-account) == true title: PurviewAccount description: Purview Account Client -output-folder: ../src/account -source-code-folder-path: ./ +output-folder: ../ +source-code-folder-path: ./src/account input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/purview/data-plane/Azure.Analytics.Purview.Account/preview/2019-11-01-preview/account.json ``` ```yaml $(purview-metadata) == true title: PurviewMetadataPolicies description: Purview Metadata Policies Client -output-folder: ../src/metadataPolicies -source-code-folder-path: ./ +output-folder: ../ +source-code-folder-path: ./src/metadataPolicies input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/purview/data-plane/Azure.Analytics.Purview.MetadataPolicies/preview/2021-07-01-preview/purviewMetadataPolicy.json ``` ```yaml +flavor: azure +openapi-type: data-plane modelerfour.lenient-model-deduplication: true package-name: "@azure-rest/purview-administration" generate-metadata: false @@ -32,4 +34,7 @@ add-credentials: true credential-scopes: "https://purview.azure.net/.default" use-extension: "@autorest/typescript": "latest" +batch: + - purview-metadata: true + - purview-account: true ``` diff --git a/sdk/purview/purview-administration-rest/test/public/account.spec.ts b/sdk/purview/purview-administration-rest/test/public/account.spec.ts index e6e182b0fd41..ad3a5e74ac35 100644 --- a/sdk/purview/purview-administration-rest/test/public/account.spec.ts +++ b/sdk/purview/purview-administration-rest/test/public/account.spec.ts @@ -7,7 +7,7 @@ import { describe, it, assert, beforeEach, afterEach } from "vitest"; describe("Get account info", () => { let recorder: Recorder; - let client: PurviewAccount.Client.PurviewAccountRestClient; + let client: PurviewAccount.Client.PurviewAccountClient; beforeEach(async (ctx) => { recorder = new Recorder(ctx); diff --git a/sdk/purview/purview-administration-rest/test/public/collections.spec.ts b/sdk/purview/purview-administration-rest/test/public/collections.spec.ts index 0de3f587a791..8dd567e02952 100644 --- a/sdk/purview/purview-administration-rest/test/public/collections.spec.ts +++ b/sdk/purview/purview-administration-rest/test/public/collections.spec.ts @@ -7,7 +7,7 @@ import { describe, it, assert, beforeEach, afterEach } from "vitest"; describe("List collections", () => { let recorder: Recorder; - let client: PurviewAccount.Client.PurviewAccountRestClient; + let client: PurviewAccount.Client.PurviewAccountClient; beforeEach(async (ctx) => { recorder = new Recorder(ctx); diff --git a/sdk/purview/purview-administration-rest/test/public/metadataPolicies.spec.ts b/sdk/purview/purview-administration-rest/test/public/metadataPolicies.spec.ts index ca2bb46e90d1..762800314499 100644 --- a/sdk/purview/purview-administration-rest/test/public/metadataPolicies.spec.ts +++ b/sdk/purview/purview-administration-rest/test/public/metadataPolicies.spec.ts @@ -5,10 +5,11 @@ import type { PurviewMetadataPolicies } from "../../src/index.js"; import { Recorder } from "@azure-tools/test-recorder"; import { createMetadataClient } from "./utils/recordedClient.js"; import { describe, it, assert, beforeEach, afterEach } from "vitest"; +import { MetadataPolicyListOutput } from "../../src/metadataPolicies/outputModels.js"; describe("List Metadata", () => { let recorder: Recorder; - let client: PurviewMetadataPolicies.Client.PurviewMetadataPoliciesRestClient; + let client: PurviewMetadataPolicies.Client.PurviewMetadataPoliciesClient; beforeEach(async (ctx) => { recorder = new Recorder(ctx); @@ -26,7 +27,7 @@ describe("List Metadata", () => { console.log(result.request.url); assert.fail(`GET "/metadataPolicies" failed with ${result.status}`); } - - assert.isDefined(result.body.values.length); + const metadataPolicyListOutput = result.body as MetadataPolicyListOutput; + assert.isDefined(metadataPolicyListOutput.values.length); }); }); diff --git a/sdk/purview/purview-administration-rest/test/public/utils/recordedClient.ts b/sdk/purview/purview-administration-rest/test/public/utils/recordedClient.ts index 18ce77f699c1..acfdbc2c8c41 100644 --- a/sdk/purview/purview-administration-rest/test/public/utils/recordedClient.ts +++ b/sdk/purview/purview-administration-rest/test/public/utils/recordedClient.ts @@ -5,8 +5,7 @@ import type { Recorder, RecorderStartOptions } from "@azure-tools/test-recorder"; import { env } from "@azure-tools/test-recorder"; -import type { PurviewAccount, PurviewMetadataPolicies } from "../../../src/index.js"; -import { PurviewAccountClient, PurviewMetadataPoliciesClient } from "../../../src/index.js"; +import { PurviewAccount, PurviewMetadataPolicies } from "../../../src/index.js"; import { createTestCredential } from "@azure-tools/test-credential"; import type { ClientOptions } from "@azure-rest/core-client"; @@ -25,11 +24,11 @@ const recorderOptions: RecorderStartOptions = { export async function createAccountClient( recorder: Recorder, options?: ClientOptions, -): Promise { +): Promise { const credential = createTestCredential(); await recorder.start(recorderOptions); - return PurviewAccountClient( + return PurviewAccount.createClient( env.ENDPOINT ?? "", credential, recorder.configureClientOptions({ options }), @@ -39,11 +38,11 @@ export async function createAccountClient( export async function createMetadataClient( recorder: Recorder, options?: ClientOptions, -): Promise { +): Promise { const credential = createTestCredential(); await recorder.start(recorderOptions); - return PurviewMetadataPoliciesClient( + return PurviewMetadataPolicies.createClient( env.ENDPOINT ?? "", credential, recorder.configureClientOptions({ options }),