diff --git a/sdk/resourcemanager/purview/armpurview/CHANGELOG.md b/sdk/resourcemanager/purview/armpurview/CHANGELOG.md index 1f0af398a29e..b58e3211983d 100644 --- a/sdk/resourcemanager/purview/armpurview/CHANGELOG.md +++ b/sdk/resourcemanager/purview/armpurview/CHANGELOG.md @@ -1,5 +1,80 @@ # Release History +## 2.0.0-beta.1 (2024-05-03) +### Breaking Changes + +- Type of `AccountSKU.Name` has been changed from `*Name` to `*AccountSKUName` +- Type of `AccountSKUAutoGenerated.Name` has been changed from `*Name` to `*AccountSKUName` +- Type of `Identity.Type` has been changed from `*Type` to `*ManagedIdentityType` +- Type of `PrivateLinkServiceConnectionState.Status` has been changed from `*Status` to `*PrivateEndpointConnectionStatus` +- Enum `Name` has been removed +- Enum `Status` has been removed +- Enum `Type` has been removed +- Field `Guardian` of struct `AccountEndpoints` has been removed +- Field `Count` of struct `AccountList` has been removed +- Field `Guardian` of struct `AccountPropertiesEndpoints` has been removed +- Field `Count` of struct `PrivateEndpointConnectionList` has been removed +- Field `Count` of struct `PrivateLinkResourceList` has been removed + +### Features Added + +- New enum type `AccountProvisioningState` with values `AccountProvisioningStateCanceled`, `AccountProvisioningStateCreating`, `AccountProvisioningStateDeleting`, `AccountProvisioningStateFailed`, `AccountProvisioningStateMoving`, `AccountProvisioningStateSoftDeleted`, `AccountProvisioningStateSoftDeleting`, `AccountProvisioningStateSucceeded`, `AccountProvisioningStateUnknown`, `AccountProvisioningStateUpdating` +- New enum type `AccountSKUName` with values `AccountSKUNameFree`, `AccountSKUNameStandard` +- New enum type `ConsentKind` with values `ConsentKindGovernance`, `ConsentKindMetadata` +- New enum type `ConsentScopeType` with values `ConsentScopeTypeAzure`, `ConsentScopeTypeDatabricks`, `ConsentScopeTypeFabric`, `ConsentScopeTypeS3`, `ConsentScopeTypeSnowflake` +- New enum type `ConsentStatus` with values `ConsentStatusDisabled`, `ConsentStatusEnabled`, `ConsentStatusNotSpecified` +- New enum type `EventHubType` with values `EventHubTypeHook`, `EventHubTypeNotification` +- New enum type `EventStreamingState` with values `EventStreamingStateDisabled`, `EventStreamingStateEnabled` +- New enum type `EventStreamingType` with values `EventStreamingTypeAzure`, `EventStreamingTypeManaged`, `EventStreamingTypeNone` +- New enum type `KafkaConfigurationIdentityType` with values `KafkaConfigurationIdentityTypeNone`, `KafkaConfigurationIdentityTypeSystemAssigned`, `KafkaConfigurationIdentityTypeUserAssigned` +- New enum type `ManagedEventHubState` with values `ManagedEventHubStateDisabled`, `ManagedEventHubStateEnabled`, `ManagedEventHubStateNotSpecified` +- New enum type `ManagedIdentityType` with values `ManagedIdentityTypeNone`, `ManagedIdentityTypeSystemAssigned`, `ManagedIdentityTypeUserAssigned` +- New enum type `MergeAccountType` with values `MergeAccountTypePrimary`, `MergeAccountTypeSecondary` +- New enum type `MergeStatus` with values `MergeStatusFailed`, `MergeStatusInProgress`, `MergeStatusSucceeded` +- New enum type `PrivateEndpointConnectionStatus` with values `PrivateEndpointConnectionStatusApproved`, `PrivateEndpointConnectionStatusDisconnected`, `PrivateEndpointConnectionStatusPending`, `PrivateEndpointConnectionStatusRejected`, `PrivateEndpointConnectionStatusUnknown` +- New enum type `TenantEndpointState` with values `TenantEndpointStateDisabled`, `TenantEndpointStateEnabled`, `TenantEndpointStateNotSpecified` +- New function `*ClientFactory.NewFeaturesClient() *FeaturesClient` +- New function `*ClientFactory.NewIngestionPrivateEndpointConnectionsClient() *IngestionPrivateEndpointConnectionsClient` +- New function `*ClientFactory.NewKafkaConfigurationsClient() *KafkaConfigurationsClient` +- New function `*ClientFactory.NewUsagesClient() *UsagesClient` +- New function `NewFeaturesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*FeaturesClient, error)` +- New function `*FeaturesClient.AccountGet(context.Context, string, string, BatchFeatureRequest, *FeaturesClientAccountGetOptions) (FeaturesClientAccountGetResponse, error)` +- New function `*FeaturesClient.SubscriptionGet(context.Context, string, BatchFeatureRequest, *FeaturesClientSubscriptionGetOptions) (FeaturesClientSubscriptionGetResponse, error)` +- New function `NewIngestionPrivateEndpointConnectionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*IngestionPrivateEndpointConnectionsClient, error)` +- New function `*IngestionPrivateEndpointConnectionsClient.NewListPager(string, string, *IngestionPrivateEndpointConnectionsClientListOptions) *runtime.Pager[IngestionPrivateEndpointConnectionsClientListResponse]` +- New function `*IngestionPrivateEndpointConnectionsClient.UpdateStatus(context.Context, string, string, PrivateEndpointConnectionStatusUpdateRequest, *IngestionPrivateEndpointConnectionsClientUpdateStatusOptions) (IngestionPrivateEndpointConnectionsClientUpdateStatusResponse, error)` +- New function `NewKafkaConfigurationsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*KafkaConfigurationsClient, error)` +- New function `*KafkaConfigurationsClient.CreateOrUpdate(context.Context, string, string, string, KafkaConfiguration, *KafkaConfigurationsClientCreateOrUpdateOptions) (KafkaConfigurationsClientCreateOrUpdateResponse, error)` +- New function `*KafkaConfigurationsClient.Delete(context.Context, string, string, string, *KafkaConfigurationsClientDeleteOptions) (KafkaConfigurationsClientDeleteResponse, error)` +- New function `*KafkaConfigurationsClient.Get(context.Context, string, string, string, *KafkaConfigurationsClientGetOptions) (KafkaConfigurationsClientGetResponse, error)` +- New function `*KafkaConfigurationsClient.NewListByAccountPager(string, string, *KafkaConfigurationsClientListByAccountOptions) *runtime.Pager[KafkaConfigurationsClientListByAccountResponse]` +- New function `NewUsagesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*UsagesClient, error)` +- New function `*UsagesClient.Get(context.Context, string, *UsagesClientGetOptions) (UsagesClientGetResponse, error)` +- New struct `AccountMergeInfo` +- New struct `AccountPropertiesAccountStatus` +- New struct `AccountStatus` +- New struct `AccountStatusErrorDetails` +- New struct `BatchFeatureRequest` +- New struct `BatchFeatureStatus` +- New struct `Consent` +- New struct `ConsentProperties` +- New struct `Credentials` +- New struct `IngestionStorage` +- New struct `KafkaConfiguration` +- New struct `KafkaConfigurationList` +- New struct `KafkaConfigurationProperties` +- New struct `PrivateEndpointConnectionStatusUpdateRequest` +- New struct `PrivateEndpointConnectionStatusUpdateResponse` +- New struct `ProxyResourceSystemData` +- New struct `QuotaName` +- New struct `Usage` +- New struct `UsageList` +- New struct `UsageName` +- New field `AccountStatus`, `DefaultDomain`, `IngestionStorage`, `ManagedEventHubState`, `ManagedResourcesPublicNetworkAccess`, `MergeInfo`, `TenantEndpointState` in struct `AccountProperties` +- New field `SystemData` in struct `PrivateEndpointConnection` +- New field `SystemData` in struct `ProxyResource` + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/purview/armpurview/README.md b/sdk/resourcemanager/purview/armpurview/README.md index f2af88d64255..8f8f72cc9f82 100644 --- a/sdk/resourcemanager/purview/armpurview/README.md +++ b/sdk/resourcemanager/purview/armpurview/README.md @@ -1,6 +1,6 @@ # Azure Purview Module for Go -[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview/v2)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview/v2) The `armpurview` module provides operations for working with Azure Purview. @@ -20,7 +20,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Purview module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview/v2 ``` ## Authorization diff --git a/sdk/resourcemanager/purview/armpurview/accounts_client.go b/sdk/resourcemanager/purview/armpurview/accounts_client.go index 853cf3e31b33..74a3fc2ae375 100644 --- a/sdk/resourcemanager/purview/armpurview/accounts_client.go +++ b/sdk/resourcemanager/purview/armpurview/accounts_client.go @@ -46,7 +46,7 @@ func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, // AddRootCollectionAdmin - Add the administrator for root collection associated with this account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - resourceGroupName - The resource group name. // - accountName - The name of the account. // - collectionAdminUpdate - The collection admin update payload. @@ -93,7 +93,7 @@ func (client *AccountsClient) addRootCollectionAdminCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, collectionAdminUpdate); err != nil { @@ -105,7 +105,7 @@ func (client *AccountsClient) addRootCollectionAdminCreateRequest(ctx context.Co // CheckNameAvailability - Checks if account name is available. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - checkNameAvailabilityRequest - The check name availability request. // - options - AccountsClientCheckNameAvailabilityOptions contains the optional parameters for the AccountsClient.CheckNameAvailability // method. @@ -143,7 +143,7 @@ func (client *AccountsClient) checkNameAvailabilityCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, checkNameAvailabilityRequest); err != nil { @@ -164,7 +164,7 @@ func (client *AccountsClient) checkNameAvailabilityHandleResponse(resp *http.Res // BeginCreateOrUpdate - Creates or updates an account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - resourceGroupName - The resource group name. // - accountName - The name of the account. // - account - The account. @@ -190,7 +190,7 @@ func (client *AccountsClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Creates or updates an account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview func (client *AccountsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, account Account, options *AccountsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.BeginCreateOrUpdate" @@ -232,7 +232,7 @@ func (client *AccountsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, account); err != nil { @@ -244,7 +244,7 @@ func (client *AccountsClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Deletes an account resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - resourceGroupName - The resource group name. // - accountName - The name of the account. // - options - AccountsClientBeginDeleteOptions contains the optional parameters for the AccountsClient.BeginDelete method. @@ -268,7 +268,7 @@ func (client *AccountsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes an account resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview func (client *AccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.BeginDelete" @@ -310,7 +310,7 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -319,7 +319,7 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get an account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - resourceGroupName - The resource group name. // - accountName - The name of the account. // - options - AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. @@ -365,7 +365,7 @@ func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -382,7 +382,7 @@ func (client *AccountsClient) getHandleResponse(resp *http.Response) (AccountsCl // NewListByResourceGroupPager - List accounts in ResourceGroup // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - resourceGroupName - The resource group name. // - options - AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager // method. @@ -425,10 +425,10 @@ func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -445,7 +445,7 @@ func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - List accounts in Subscription // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - options - AccountsClientListBySubscriptionOptions contains the optional parameters for the AccountsClient.NewListBySubscriptionPager // method. func (client *AccountsClient) NewListBySubscriptionPager(options *AccountsClientListBySubscriptionOptions) *runtime.Pager[AccountsClientListBySubscriptionResponse] { @@ -483,10 +483,10 @@ func (client *AccountsClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -504,7 +504,7 @@ func (client *AccountsClient) listBySubscriptionHandleResponse(resp *http.Respon // ListKeys - List the authorization keys associated with this account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - resourceGroupName - The resource group name. // - accountName - The name of the account. // - options - AccountsClientListKeysOptions contains the optional parameters for the AccountsClient.ListKeys method. @@ -550,7 +550,7 @@ func (client *AccountsClient) listKeysCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -568,7 +568,7 @@ func (client *AccountsClient) listKeysHandleResponse(resp *http.Response) (Accou // BeginUpdate - Updates an account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - resourceGroupName - The resource group name. // - accountName - The name of the account. // - accountUpdateParameters - The account update parameters. @@ -593,7 +593,7 @@ func (client *AccountsClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Updates an account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview func (client *AccountsClient) update(ctx context.Context, resourceGroupName string, accountName string, accountUpdateParameters AccountUpdateParameters, options *AccountsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.BeginUpdate" @@ -635,7 +635,7 @@ func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, accountUpdateParameters); err != nil { diff --git a/sdk/resourcemanager/purview/armpurview/accounts_client_example_test.go b/sdk/resourcemanager/purview/armpurview/accounts_client_example_test.go deleted file mode 100644 index e4217a4228a1..000000000000 --- a/sdk/resourcemanager/purview/armpurview/accounts_client_example_test.go +++ /dev/null @@ -1,496 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armpurview_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/Accounts_ListByResourceGroup.json -func ExampleAccountsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAccountsClient().NewListByResourceGroupPager("SampleResourceGroup", &armpurview.AccountsClientListByResourceGroupOptions{SkipToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AccountList = armpurview.AccountList{ - // Value: []*armpurview.Account{ - // { - // Name: to.Ptr("account1"), - // Type: to.Ptr("Microsoft.Purview/accounts"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1"), - // Location: to.Ptr("West US 2"), - // SystemData: &armpurview.TrackedResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-22T18:39:58.692Z"); return t}()), - // CreatedBy: to.Ptr("client-name"), - // CreatedByType: to.Ptr(armpurview.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-16T23:24:34.343Z"); return t}()), - // LastModifiedBy: to.Ptr("client-name"), - // LastModifiedByType: to.Ptr(armpurview.LastModifiedByTypeUser), - // }, - // Properties: &armpurview.AccountProperties{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-22T18:39:58.692Z"); return t}()), - // CreatedBy: to.Ptr("client-name"), - // CreatedByObjectID: to.Ptr("client-objectId"), - // Endpoints: &armpurview.AccountPropertiesEndpoints{ - // Catalog: to.Ptr("https://account1.catalog.purview.azure-test.com"), - // Guardian: to.Ptr("https://account1.guardian.purview.azure-test.com"), - // Scan: to.Ptr("https://account1.scan.purview.azure-test.com"), - // }, - // FriendlyName: to.Ptr("friendly-account1"), - // ProvisioningState: to.Ptr(armpurview.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armpurview.PublicNetworkAccessEnabled), - // }, - // SKU: &armpurview.AccountSKU{ - // Name: to.Ptr(armpurview.NameStandard), - // Capacity: to.Ptr[int32](1), - // }, - // }, - // { - // Name: to.Ptr("account2"), - // Type: to.Ptr("Microsoft.Purview/accounts"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account2"), - // Location: to.Ptr("West US 2"), - // SystemData: &armpurview.TrackedResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-22T18:39:58.692Z"); return t}()), - // CreatedBy: to.Ptr("client-name"), - // CreatedByType: to.Ptr(armpurview.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-16T23:24:34.343Z"); return t}()), - // LastModifiedBy: to.Ptr("client-name"), - // LastModifiedByType: to.Ptr(armpurview.LastModifiedByTypeUser), - // }, - // Properties: &armpurview.AccountProperties{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-22T18:39:58.692Z"); return t}()), - // CreatedBy: to.Ptr("client-name"), - // CreatedByObjectID: to.Ptr("client-objectId"), - // Endpoints: &armpurview.AccountPropertiesEndpoints{ - // Catalog: to.Ptr("https://account2.catalog.purview.azure-test.com"), - // Guardian: to.Ptr("https://account1.guardian.purview.azure-test.com"), - // Scan: to.Ptr("https://account2.scan.purview.azure-test.com"), - // }, - // FriendlyName: to.Ptr("friendly-account1"), - // ProvisioningState: to.Ptr(armpurview.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armpurview.PublicNetworkAccessEnabled), - // }, - // SKU: &armpurview.AccountSKU{ - // Name: to.Ptr(armpurview.NameStandard), - // Capacity: to.Ptr[int32](1), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/Accounts_ListBySubscription.json -func ExampleAccountsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAccountsClient().NewListBySubscriptionPager(&armpurview.AccountsClientListBySubscriptionOptions{SkipToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AccountList = armpurview.AccountList{ - // Value: []*armpurview.Account{ - // { - // Name: to.Ptr("account1"), - // Type: to.Ptr("Microsoft.Purview/accounts"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1"), - // Location: to.Ptr("West US 2"), - // SystemData: &armpurview.TrackedResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-22T18:39:58.692Z"); return t}()), - // CreatedBy: to.Ptr("client-name"), - // CreatedByType: to.Ptr(armpurview.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-16T23:24:34.343Z"); return t}()), - // LastModifiedBy: to.Ptr("client-name"), - // LastModifiedByType: to.Ptr(armpurview.LastModifiedByTypeUser), - // }, - // Properties: &armpurview.AccountProperties{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-22T18:39:58.692Z"); return t}()), - // CreatedBy: to.Ptr("client-name"), - // CreatedByObjectID: to.Ptr("client-objectId"), - // Endpoints: &armpurview.AccountPropertiesEndpoints{ - // Catalog: to.Ptr("https://account1.catalog.purview.azure-test.com"), - // Guardian: to.Ptr("https://account1.guardian.purview.azure-test.com"), - // Scan: to.Ptr("https://account1.scan.purview.azure-test.com"), - // }, - // FriendlyName: to.Ptr("friendly-account1"), - // ProvisioningState: to.Ptr(armpurview.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armpurview.PublicNetworkAccessEnabled), - // }, - // SKU: &armpurview.AccountSKU{ - // Name: to.Ptr(armpurview.NameStandard), - // Capacity: to.Ptr[int32](1), - // }, - // }, - // { - // Name: to.Ptr("account2"), - // Type: to.Ptr("Microsoft.Purview/accounts"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account2"), - // Location: to.Ptr("West US 2"), - // SystemData: &armpurview.TrackedResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-22T18:39:58.692Z"); return t}()), - // CreatedBy: to.Ptr("client-name"), - // CreatedByType: to.Ptr(armpurview.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-16T23:24:34.343Z"); return t}()), - // LastModifiedBy: to.Ptr("client-name"), - // LastModifiedByType: to.Ptr(armpurview.LastModifiedByTypeUser), - // }, - // Properties: &armpurview.AccountProperties{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-22T18:39:58.692Z"); return t}()), - // CreatedBy: to.Ptr("client-name"), - // CreatedByObjectID: to.Ptr("client-objectId"), - // Endpoints: &armpurview.AccountPropertiesEndpoints{ - // Catalog: to.Ptr("https://account2.catalog.purview.azure-test.com"), - // Guardian: to.Ptr("https://account1.guardian.purview.azure-test.com"), - // Scan: to.Ptr("https://account2.scan.purview.azure-test.com"), - // }, - // FriendlyName: to.Ptr("friendly-account1"), - // ProvisioningState: to.Ptr(armpurview.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armpurview.PublicNetworkAccessEnabled), - // }, - // SKU: &armpurview.AccountSKU{ - // Name: to.Ptr(armpurview.NameStandard), - // Capacity: to.Ptr[int32](1), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/Accounts_Get.json -func ExampleAccountsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().Get(ctx, "SampleResourceGroup", "account1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armpurview.Account{ - // Name: to.Ptr("account1"), - // Type: to.Ptr("Microsoft.Purview/accounts"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1"), - // Location: to.Ptr("West US 2"), - // SystemData: &armpurview.TrackedResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-22T18:39:58.692Z"); return t}()), - // CreatedBy: to.Ptr("client-name"), - // CreatedByType: to.Ptr(armpurview.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-16T23:24:34.343Z"); return t}()), - // LastModifiedBy: to.Ptr("client-name"), - // LastModifiedByType: to.Ptr(armpurview.LastModifiedByTypeUser), - // }, - // Properties: &armpurview.AccountProperties{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-22T18:39:58.692Z"); return t}()), - // CreatedBy: to.Ptr("client-name"), - // CreatedByObjectID: to.Ptr("client-objectId"), - // Endpoints: &armpurview.AccountPropertiesEndpoints{ - // Catalog: to.Ptr("https://account1.catalog.purview.azure-test.com"), - // Guardian: to.Ptr("https://account1.guardian.purview.azure-test.com"), - // Scan: to.Ptr("https://account1.scan.purview.azure-test.com"), - // }, - // FriendlyName: to.Ptr("friendly-account1"), - // ManagedResourceGroupName: to.Ptr("managed-rg-mwjotkl"), - // ManagedResources: &armpurview.AccountPropertiesManagedResources{ - // EventHubNamespace: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl/providers/Microsoft.EventHub/namespaces/atlas-westusdddnbtp"), - // ResourceGroup: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl"), - // StorageAccount: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl/providers/Microsoft.Storage/storageAccounts/scanwestustzaagzr"), - // }, - // PrivateEndpointConnections: []*armpurview.PrivateEndpointConnection{ - // { - // Name: to.Ptr("peName-8536c337-7b36-4d67-a7ce-081655baf59e"), - // Type: to.Ptr("Microsoft.Purview/accounts/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateEndpointConnections/peName-8536c337-7b36-4d67-a7ce-081655baf59e"), - // Properties: &armpurview.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armpurview.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/baca8a88-4527-4c35-a13e-b2775ce0d7fc/resourceGroups/nrpResourceGroupName/providers/Microsoft.Network/privateEndpoints/peName"), - // }, - // PrivateLinkServiceConnectionState: &armpurview.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Please approve my connection, thanks."), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armpurview.StatusPending), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // ProvisioningState: to.Ptr(armpurview.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armpurview.PublicNetworkAccessEnabled), - // }, - // SKU: &armpurview.AccountSKU{ - // Name: to.Ptr(armpurview.NameStandard), - // Capacity: to.Ptr[int32](1), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/Accounts_CreateOrUpdate.json -func ExampleAccountsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAccountsClient().BeginCreateOrUpdate(ctx, "SampleResourceGroup", "account1", armpurview.Account{ - Location: to.Ptr("West US 2"), - Properties: &armpurview.AccountProperties{ - ManagedResourceGroupName: to.Ptr("custom-rgname"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armpurview.Account{ - // Name: to.Ptr("account1"), - // Type: to.Ptr("Microsoft.Purview/accounts"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1"), - // Location: to.Ptr("West US 2"), - // SystemData: &armpurview.TrackedResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-22T18:39:58.692Z"); return t}()), - // CreatedBy: to.Ptr("client-name"), - // CreatedByType: to.Ptr(armpurview.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-16T23:24:34.343Z"); return t}()), - // LastModifiedBy: to.Ptr("client-name"), - // LastModifiedByType: to.Ptr(armpurview.LastModifiedByTypeUser), - // }, - // Properties: &armpurview.AccountProperties{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-22T18:39:58.692Z"); return t}()), - // CreatedBy: to.Ptr("client-name"), - // CreatedByObjectID: to.Ptr("client-objectId"), - // Endpoints: &armpurview.AccountPropertiesEndpoints{ - // Catalog: to.Ptr("https://account1.catalog.purview.azure-test.com"), - // Guardian: to.Ptr("https://account1.guardian.purview.azure-test.com"), - // Scan: to.Ptr("https://account1.scan.purview.azure-test.com"), - // }, - // FriendlyName: to.Ptr("friendly-account1"), - // ManagedResourceGroupName: to.Ptr("custom-rgname"), - // ManagedResources: &armpurview.AccountPropertiesManagedResources{ - // EventHubNamespace: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/custom-rgname/providers/Microsoft.EventHub/namespaces/atlas-westusdddnbtp"), - // ResourceGroup: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/custom-rgname"), - // StorageAccount: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/custom-rgname/providers/Microsoft.Storage/storageAccounts/scanwestustzaagzr"), - // }, - // ProvisioningState: to.Ptr(armpurview.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armpurview.PublicNetworkAccessEnabled), - // }, - // SKU: &armpurview.AccountSKU{ - // Name: to.Ptr(armpurview.NameStandard), - // Capacity: to.Ptr[int32](1), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/Accounts_Delete.json -func ExampleAccountsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAccountsClient().BeginDelete(ctx, "SampleResourceGroup", "account1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/Accounts_Update.json -func ExampleAccountsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAccountsClient().BeginUpdate(ctx, "SampleResourceGroup", "account1", armpurview.AccountUpdateParameters{ - Tags: map[string]*string{ - "newTag": to.Ptr("New tag value."), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armpurview.Account{ - // Name: to.Ptr("account1"), - // Type: to.Ptr("Microsoft.Purview/accounts"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1"), - // Location: to.Ptr("West US 2"), - // SystemData: &armpurview.TrackedResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-22T18:39:58.692Z"); return t}()), - // CreatedBy: to.Ptr("client-name"), - // CreatedByType: to.Ptr(armpurview.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-16T23:24:34.343Z"); return t}()), - // LastModifiedBy: to.Ptr("client-name"), - // LastModifiedByType: to.Ptr(armpurview.LastModifiedByTypeUser), - // }, - // Tags: map[string]*string{ - // "newTag": to.Ptr("New tag value."), - // }, - // Properties: &armpurview.AccountProperties{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-22T18:39:58.692Z"); return t}()), - // CreatedBy: to.Ptr("client-name"), - // CreatedByObjectID: to.Ptr("client-objectId"), - // Endpoints: &armpurview.AccountPropertiesEndpoints{ - // Catalog: to.Ptr("https://account2.catalog.purview.azure-test.com"), - // Guardian: to.Ptr("https://account1.guardian.purview.azure-test.com"), - // Scan: to.Ptr("https://account2.scan.purview.azure-test.com"), - // }, - // FriendlyName: to.Ptr("friendly-account1"), - // ManagedResources: &armpurview.AccountPropertiesManagedResources{ - // EventHubNamespace: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl/providers/Microsoft.EventHub/namespaces/atlas-westusdddnbtp"), - // ResourceGroup: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl"), - // StorageAccount: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/managed-rg-mwjotkl/providers/Microsoft.Storage/storageAccounts/scanwestustzaagzr"), - // }, - // ProvisioningState: to.Ptr(armpurview.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armpurview.PublicNetworkAccessEnabled), - // }, - // SKU: &armpurview.AccountSKU{ - // Name: to.Ptr(armpurview.NameStandard), - // Capacity: to.Ptr[int32](1), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/Accounts_ListKeys.json -func ExampleAccountsClient_ListKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().ListKeys(ctx, "SampleResourceGroup", "account1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccessKeys = armpurview.AccessKeys{ - // AtlasKafkaPrimaryEndpoint: to.Ptr("Endpoint=sb://fake_objectId.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=ASDASasdfmasdf123412341234="), - // AtlasKafkaSecondaryEndpoint: to.Ptr("Endpoint=sb://fake_objectId.servicebus.windows.net/;SharedAccessKeyName=AlternateSharedAccessKey;SharedAccessKey=BSDASasdfmasdf123412341234="), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/Accounts_AddRootCollectionAdmin.json -func ExampleAccountsClient_AddRootCollectionAdmin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAccountsClient().AddRootCollectionAdmin(ctx, "SampleResourceGroup", "account1", armpurview.CollectionAdminUpdate{ - ObjectID: to.Ptr("7e8de0e7-2bfc-4e1f-9659-2a5785e4356f"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/Accounts_CheckNameAvailability.json -func ExampleAccountsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().CheckNameAvailability(ctx, armpurview.CheckNameAvailabilityRequest{ - Name: to.Ptr("account1"), - Type: to.Ptr("Microsoft.Purview/accounts"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameAvailabilityResult = armpurview.CheckNameAvailabilityResult{ - // NameAvailable: to.Ptr(true), - // } -} diff --git a/sdk/resourcemanager/purview/armpurview/autorest.md b/sdk/resourcemanager/purview/armpurview/autorest.md index 7083c90ccf70..2aa8fe0bca8e 100644 --- a/sdk/resourcemanager/purview/armpurview/autorest.md +++ b/sdk/resourcemanager/purview/armpurview/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/purview/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/purview/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 +module-version: 2.0.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/purview/armpurview/client_factory.go b/sdk/resourcemanager/purview/armpurview/client_factory.go index 293efade2f74..ff46a7a09379 100644 --- a/sdk/resourcemanager/purview/armpurview/client_factory.go +++ b/sdk/resourcemanager/purview/armpurview/client_factory.go @@ -17,8 +17,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -27,42 +26,82 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } // NewAccountsClient creates a new instance of AccountsClient. func (c *ClientFactory) NewAccountsClient() *AccountsClient { - subClient, _ := NewAccountsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &AccountsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewDefaultAccountsClient creates a new instance of DefaultAccountsClient. func (c *ClientFactory) NewDefaultAccountsClient() *DefaultAccountsClient { - subClient, _ := NewDefaultAccountsClient(c.credential, c.options) - return subClient + return &DefaultAccountsClient{ + internal: c.internal, + } +} + +// NewFeaturesClient creates a new instance of FeaturesClient. +func (c *ClientFactory) NewFeaturesClient() *FeaturesClient { + return &FeaturesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewIngestionPrivateEndpointConnectionsClient creates a new instance of IngestionPrivateEndpointConnectionsClient. +func (c *ClientFactory) NewIngestionPrivateEndpointConnectionsClient() *IngestionPrivateEndpointConnectionsClient { + return &IngestionPrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewKafkaConfigurationsClient creates a new instance of KafkaConfigurationsClient. +func (c *ClientFactory) NewKafkaConfigurationsClient() *KafkaConfigurationsClient { + return &KafkaConfigurationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewUsagesClient creates a new instance of UsagesClient. +func (c *ClientFactory) NewUsagesClient() *UsagesClient { + return &UsagesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/purview/armpurview/constants.go b/sdk/resourcemanager/purview/armpurview/constants.go index 5f0cd763c79c..ac5c0e458de0 100644 --- a/sdk/resourcemanager/purview/armpurview/constants.go +++ b/sdk/resourcemanager/purview/armpurview/constants.go @@ -10,9 +10,113 @@ package armpurview const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview" - moduleVersion = "v1.2.0" + moduleVersion = "v2.0.0-beta.1" ) +// AccountProvisioningState - Gets the account status code. +type AccountProvisioningState string + +const ( + AccountProvisioningStateCanceled AccountProvisioningState = "Canceled" + AccountProvisioningStateCreating AccountProvisioningState = "Creating" + AccountProvisioningStateDeleting AccountProvisioningState = "Deleting" + AccountProvisioningStateFailed AccountProvisioningState = "Failed" + AccountProvisioningStateMoving AccountProvisioningState = "Moving" + AccountProvisioningStateSoftDeleted AccountProvisioningState = "SoftDeleted" + AccountProvisioningStateSoftDeleting AccountProvisioningState = "SoftDeleting" + AccountProvisioningStateSucceeded AccountProvisioningState = "Succeeded" + AccountProvisioningStateUnknown AccountProvisioningState = "Unknown" + AccountProvisioningStateUpdating AccountProvisioningState = "Updating" +) + +// PossibleAccountProvisioningStateValues returns the possible values for the AccountProvisioningState const type. +func PossibleAccountProvisioningStateValues() []AccountProvisioningState { + return []AccountProvisioningState{ + AccountProvisioningStateCanceled, + AccountProvisioningStateCreating, + AccountProvisioningStateDeleting, + AccountProvisioningStateFailed, + AccountProvisioningStateMoving, + AccountProvisioningStateSoftDeleted, + AccountProvisioningStateSoftDeleting, + AccountProvisioningStateSucceeded, + AccountProvisioningStateUnknown, + AccountProvisioningStateUpdating, + } +} + +// AccountSKUName - Gets or sets the sku name. +type AccountSKUName string + +const ( + AccountSKUNameFree AccountSKUName = "Free" + AccountSKUNameStandard AccountSKUName = "Standard" +) + +// PossibleAccountSKUNameValues returns the possible values for the AccountSKUName const type. +func PossibleAccountSKUNameValues() []AccountSKUName { + return []AccountSKUName{ + AccountSKUNameFree, + AccountSKUNameStandard, + } +} + +// ConsentKind - Gets or sets the consent kind. +type ConsentKind string + +const ( + ConsentKindGovernance ConsentKind = "Governance" + ConsentKindMetadata ConsentKind = "Metadata" +) + +// PossibleConsentKindValues returns the possible values for the ConsentKind const type. +func PossibleConsentKindValues() []ConsentKind { + return []ConsentKind{ + ConsentKindGovernance, + ConsentKindMetadata, + } +} + +// ConsentScopeType - Defines consent scope type. +type ConsentScopeType string + +const ( + ConsentScopeTypeAzure ConsentScopeType = "Azure" + ConsentScopeTypeDatabricks ConsentScopeType = "Databricks" + ConsentScopeTypeFabric ConsentScopeType = "Fabric" + ConsentScopeTypeS3 ConsentScopeType = "S3" + ConsentScopeTypeSnowflake ConsentScopeType = "Snowflake" +) + +// PossibleConsentScopeTypeValues returns the possible values for the ConsentScopeType const type. +func PossibleConsentScopeTypeValues() []ConsentScopeType { + return []ConsentScopeType{ + ConsentScopeTypeAzure, + ConsentScopeTypeDatabricks, + ConsentScopeTypeFabric, + ConsentScopeTypeS3, + ConsentScopeTypeSnowflake, + } +} + +// ConsentStatus - Defines consent status. +type ConsentStatus string + +const ( + ConsentStatusDisabled ConsentStatus = "Disabled" + ConsentStatusEnabled ConsentStatus = "Enabled" + ConsentStatusNotSpecified ConsentStatus = "NotSpecified" +) + +// PossibleConsentStatusValues returns the possible values for the ConsentStatus const type. +func PossibleConsentStatusValues() []ConsentStatus { + return []ConsentStatus{ + ConsentStatusDisabled, + ConsentStatusEnabled, + ConsentStatusNotSpecified, + } +} + // CreatedByType - The type of identity that created the resource. type CreatedByType string @@ -33,6 +137,74 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// EventHubType - The event hub type. +type EventHubType string + +const ( + EventHubTypeHook EventHubType = "Hook" + EventHubTypeNotification EventHubType = "Notification" +) + +// PossibleEventHubTypeValues returns the possible values for the EventHubType const type. +func PossibleEventHubTypeValues() []EventHubType { + return []EventHubType{ + EventHubTypeHook, + EventHubTypeNotification, + } +} + +// EventStreamingState - The state of the event streaming service +type EventStreamingState string + +const ( + EventStreamingStateDisabled EventStreamingState = "Disabled" + EventStreamingStateEnabled EventStreamingState = "Enabled" +) + +// PossibleEventStreamingStateValues returns the possible values for the EventStreamingState const type. +func PossibleEventStreamingStateValues() []EventStreamingState { + return []EventStreamingState{ + EventStreamingStateDisabled, + EventStreamingStateEnabled, + } +} + +// EventStreamingType - The event streaming service type +type EventStreamingType string + +const ( + EventStreamingTypeAzure EventStreamingType = "Azure" + EventStreamingTypeManaged EventStreamingType = "Managed" + EventStreamingTypeNone EventStreamingType = "None" +) + +// PossibleEventStreamingTypeValues returns the possible values for the EventStreamingType const type. +func PossibleEventStreamingTypeValues() []EventStreamingType { + return []EventStreamingType{ + EventStreamingTypeAzure, + EventStreamingTypeManaged, + EventStreamingTypeNone, + } +} + +// KafkaConfigurationIdentityType - Identity Type. +type KafkaConfigurationIdentityType string + +const ( + KafkaConfigurationIdentityTypeNone KafkaConfigurationIdentityType = "None" + KafkaConfigurationIdentityTypeSystemAssigned KafkaConfigurationIdentityType = "SystemAssigned" + KafkaConfigurationIdentityTypeUserAssigned KafkaConfigurationIdentityType = "UserAssigned" +) + +// PossibleKafkaConfigurationIdentityTypeValues returns the possible values for the KafkaConfigurationIdentityType const type. +func PossibleKafkaConfigurationIdentityTypeValues() []KafkaConfigurationIdentityType { + return []KafkaConfigurationIdentityType{ + KafkaConfigurationIdentityTypeNone, + KafkaConfigurationIdentityTypeSystemAssigned, + KafkaConfigurationIdentityTypeUserAssigned, + } +} + // LastModifiedByType - The type of identity that last modified the resource. type LastModifiedByType string @@ -53,17 +225,96 @@ func PossibleLastModifiedByTypeValues() []LastModifiedByType { } } -// Name - Gets or sets the sku name. -type Name string +// ManagedEventHubState - Gets or sets the state of managed eventhub. If enabled managed eventhub will be created, if disabled +// the managed eventhub will be removed. +type ManagedEventHubState string + +const ( + ManagedEventHubStateDisabled ManagedEventHubState = "Disabled" + ManagedEventHubStateEnabled ManagedEventHubState = "Enabled" + ManagedEventHubStateNotSpecified ManagedEventHubState = "NotSpecified" +) + +// PossibleManagedEventHubStateValues returns the possible values for the ManagedEventHubState const type. +func PossibleManagedEventHubStateValues() []ManagedEventHubState { + return []ManagedEventHubState{ + ManagedEventHubStateDisabled, + ManagedEventHubStateEnabled, + ManagedEventHubStateNotSpecified, + } +} + +// ManagedIdentityType - Identity Type +type ManagedIdentityType string const ( - NameStandard Name = "Standard" + ManagedIdentityTypeNone ManagedIdentityType = "None" + ManagedIdentityTypeSystemAssigned ManagedIdentityType = "SystemAssigned" + ManagedIdentityTypeUserAssigned ManagedIdentityType = "UserAssigned" ) -// PossibleNameValues returns the possible values for the Name const type. -func PossibleNameValues() []Name { - return []Name{ - NameStandard, +// PossibleManagedIdentityTypeValues returns the possible values for the ManagedIdentityType const type. +func PossibleManagedIdentityTypeValues() []ManagedIdentityType { + return []ManagedIdentityType{ + ManagedIdentityTypeNone, + ManagedIdentityTypeSystemAssigned, + ManagedIdentityTypeUserAssigned, + } +} + +// MergeAccountType - The account's type for the merge operation. +type MergeAccountType string + +const ( + MergeAccountTypePrimary MergeAccountType = "Primary" + MergeAccountTypeSecondary MergeAccountType = "Secondary" +) + +// PossibleMergeAccountTypeValues returns the possible values for the MergeAccountType const type. +func PossibleMergeAccountTypeValues() []MergeAccountType { + return []MergeAccountType{ + MergeAccountTypePrimary, + MergeAccountTypeSecondary, + } +} + +// MergeStatus - The status of the merge operation. +type MergeStatus string + +const ( + MergeStatusFailed MergeStatus = "Failed" + MergeStatusInProgress MergeStatus = "InProgress" + MergeStatusSucceeded MergeStatus = "Succeeded" +) + +// PossibleMergeStatusValues returns the possible values for the MergeStatus const type. +func PossibleMergeStatusValues() []MergeStatus { + return []MergeStatus{ + MergeStatusFailed, + MergeStatusInProgress, + MergeStatusSucceeded, + } +} + +// PrivateEndpointConnectionStatus - The status. +type PrivateEndpointConnectionStatus string + +const ( + PrivateEndpointConnectionStatusApproved PrivateEndpointConnectionStatus = "Approved" + PrivateEndpointConnectionStatusDisconnected PrivateEndpointConnectionStatus = "Disconnected" + PrivateEndpointConnectionStatusPending PrivateEndpointConnectionStatus = "Pending" + PrivateEndpointConnectionStatusRejected PrivateEndpointConnectionStatus = "Rejected" + PrivateEndpointConnectionStatusUnknown PrivateEndpointConnectionStatus = "Unknown" +) + +// PossiblePrivateEndpointConnectionStatusValues returns the possible values for the PrivateEndpointConnectionStatus const type. +func PossiblePrivateEndpointConnectionStatusValues() []PrivateEndpointConnectionStatus { + return []PrivateEndpointConnectionStatus{ + PrivateEndpointConnectionStatusApproved, + PrivateEndpointConnectionStatusDisconnected, + PrivateEndpointConnectionStatusPending, + PrivateEndpointConnectionStatusRejected, + PrivateEndpointConnectionStatusUnknown, } } @@ -97,7 +348,7 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } -// PublicNetworkAccess - Gets or sets the public network access. +// PublicNetworkAccess - Gets or sets the public network access for managed resources. type PublicNetworkAccess string const ( @@ -147,42 +398,20 @@ func PossibleScopeTypeValues() []ScopeType { } } -// Status - The status. -type Status string - -const ( - StatusApproved Status = "Approved" - StatusDisconnected Status = "Disconnected" - StatusPending Status = "Pending" - StatusRejected Status = "Rejected" - StatusUnknown Status = "Unknown" -) - -// PossibleStatusValues returns the possible values for the Status const type. -func PossibleStatusValues() []Status { - return []Status{ - StatusApproved, - StatusDisconnected, - StatusPending, - StatusRejected, - StatusUnknown, - } -} - -// Type - Identity Type -type Type string +// TenantEndpointState - Gets or sets the state of tenant endpoint. +type TenantEndpointState string const ( - TypeNone Type = "None" - TypeSystemAssigned Type = "SystemAssigned" - TypeUserAssigned Type = "UserAssigned" + TenantEndpointStateDisabled TenantEndpointState = "Disabled" + TenantEndpointStateEnabled TenantEndpointState = "Enabled" + TenantEndpointStateNotSpecified TenantEndpointState = "NotSpecified" ) -// PossibleTypeValues returns the possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{ - TypeNone, - TypeSystemAssigned, - TypeUserAssigned, +// PossibleTenantEndpointStateValues returns the possible values for the TenantEndpointState const type. +func PossibleTenantEndpointStateValues() []TenantEndpointState { + return []TenantEndpointState{ + TenantEndpointStateDisabled, + TenantEndpointStateEnabled, + TenantEndpointStateNotSpecified, } } diff --git a/sdk/resourcemanager/purview/armpurview/defaultaccounts_client.go b/sdk/resourcemanager/purview/armpurview/defaultaccounts_client.go index 32ca9d93adfa..8443c80e63ca 100644 --- a/sdk/resourcemanager/purview/armpurview/defaultaccounts_client.go +++ b/sdk/resourcemanager/purview/armpurview/defaultaccounts_client.go @@ -40,7 +40,7 @@ func NewDefaultAccountsClient(credential azcore.TokenCredential, options *arm.Cl // Get - Get the default account for the scope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - scopeTenantID - The tenant ID. // - scopeType - The scope for the default account. // - options - DefaultAccountsClientGetOptions contains the optional parameters for the DefaultAccountsClient.Get method. @@ -74,12 +74,12 @@ func (client *DefaultAccountsClient) getCreateRequest(ctx context.Context, scope return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("scopeTenantId", scopeTenantID) - reqQP.Set("scopeType", string(scopeType)) + reqQP.Set("api-version", "2024-04-01-preview") if options != nil && options.Scope != nil { reqQP.Set("scope", *options.Scope) } - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("scopeTenantId", scopeTenantID) + reqQP.Set("scopeType", string(scopeType)) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -97,7 +97,7 @@ func (client *DefaultAccountsClient) getHandleResponse(resp *http.Response) (Def // Remove - Removes the default account from the scope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - scopeTenantID - The tenant ID. // - scopeType - The scope for the default account. // - options - DefaultAccountsClientRemoveOptions contains the optional parameters for the DefaultAccountsClient.Remove method. @@ -130,12 +130,12 @@ func (client *DefaultAccountsClient) removeCreateRequest(ctx context.Context, sc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("scopeTenantId", scopeTenantID) - reqQP.Set("scopeType", string(scopeType)) + reqQP.Set("api-version", "2024-04-01-preview") if options != nil && options.Scope != nil { reqQP.Set("scope", *options.Scope) } - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("scopeTenantId", scopeTenantID) + reqQP.Set("scopeType", string(scopeType)) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -144,7 +144,7 @@ func (client *DefaultAccountsClient) removeCreateRequest(ctx context.Context, sc // Set - Sets the default account for the scope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - defaultAccountPayload - The payload containing the default account information and the scope. // - options - DefaultAccountsClientSetOptions contains the optional parameters for the DefaultAccountsClient.Set method. func (client *DefaultAccountsClient) Set(ctx context.Context, defaultAccountPayload DefaultAccountPayload, options *DefaultAccountsClientSetOptions) (DefaultAccountsClientSetResponse, error) { @@ -177,7 +177,7 @@ func (client *DefaultAccountsClient) setCreateRequest(ctx context.Context, defau return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, defaultAccountPayload); err != nil { diff --git a/sdk/resourcemanager/purview/armpurview/defaultaccounts_client_example_test.go b/sdk/resourcemanager/purview/armpurview/defaultaccounts_client_example_test.go deleted file mode 100644 index 0c774fccf647..000000000000 --- a/sdk/resourcemanager/purview/armpurview/defaultaccounts_client_example_test.go +++ /dev/null @@ -1,99 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armpurview_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/DefaultAccounts_Get.json -func ExampleDefaultAccountsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDefaultAccountsClient().Get(ctx, "11733A4E-BA84-46FF-91D1-AFF1A3215A90", armpurview.ScopeTypeTenant, &armpurview.DefaultAccountsClientGetOptions{Scope: to.Ptr("11733A4E-BA84-46FF-91D1-AFF1A3215A90")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DefaultAccountPayload = armpurview.DefaultAccountPayload{ - // AccountName: to.Ptr("myDefaultAccount"), - // ResourceGroupName: to.Ptr("rg-1"), - // Scope: to.Ptr("11733A4E-BA84-46FF-91D1-AFF1A3215A90"), - // ScopeTenantID: to.Ptr("11733A4E-BA84-46FF-91D1-AFF1A3215A90"), - // ScopeType: to.Ptr(armpurview.ScopeTypeTenant), - // SubscriptionID: to.Ptr("12345678-1234-1234-12345678aaa"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/DefaultAccounts_Set.json -func ExampleDefaultAccountsClient_Set() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDefaultAccountsClient().Set(ctx, armpurview.DefaultAccountPayload{ - AccountName: to.Ptr("myDefaultAccount"), - ResourceGroupName: to.Ptr("rg-1"), - Scope: to.Ptr("11733A4E-BA84-46FF-91D1-AFF1A3215A90"), - ScopeTenantID: to.Ptr("11733A4E-BA84-46FF-91D1-AFF1A3215A90"), - ScopeType: to.Ptr(armpurview.ScopeTypeTenant), - SubscriptionID: to.Ptr("12345678-1234-1234-12345678aaa"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DefaultAccountPayload = armpurview.DefaultAccountPayload{ - // AccountName: to.Ptr("myDefaultAccount"), - // ResourceGroupName: to.Ptr("rg-1"), - // Scope: to.Ptr("11733A4E-BA84-46FF-91D1-AFF1A3215A90"), - // ScopeTenantID: to.Ptr("11733A4E-BA84-46FF-91D1-AFF1A3215A90"), - // ScopeType: to.Ptr(armpurview.ScopeTypeTenant), - // SubscriptionID: to.Ptr("12345678-1234-1234-12345678aaa"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/DefaultAccounts_Remove.json -func ExampleDefaultAccountsClient_Remove() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDefaultAccountsClient().Remove(ctx, "11733A4E-BA84-46FF-91D1-AFF1A3215A90", armpurview.ScopeTypeTenant, &armpurview.DefaultAccountsClientRemoveOptions{Scope: to.Ptr("11733A4E-BA84-46FF-91D1-AFF1A3215A90")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/purview/armpurview/fake/accounts_server.go b/sdk/resourcemanager/purview/armpurview/fake/accounts_server.go index dd7b17b90555..4546f544a987 100644 --- a/sdk/resourcemanager/purview/armpurview/fake/accounts_server.go +++ b/sdk/resourcemanager/purview/armpurview/fake/accounts_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/purview/armpurview/fake/defaultaccounts_server.go b/sdk/resourcemanager/purview/armpurview/fake/defaultaccounts_server.go index 940ed5aa1b43..388d30ba99d7 100644 --- a/sdk/resourcemanager/purview/armpurview/fake/defaultaccounts_server.go +++ b/sdk/resourcemanager/purview/armpurview/fake/defaultaccounts_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview/v2" "net/http" "net/url" ) diff --git a/sdk/resourcemanager/purview/armpurview/fake/features_server.go b/sdk/resourcemanager/purview/armpurview/fake/features_server.go new file mode 100644 index 000000000000..9e88ebcbcc70 --- /dev/null +++ b/sdk/resourcemanager/purview/armpurview/fake/features_server.go @@ -0,0 +1,143 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview/v2" + "net/http" + "net/url" + "regexp" +) + +// FeaturesServer is a fake server for instances of the armpurview.FeaturesClient type. +type FeaturesServer struct { + // AccountGet is the fake for method FeaturesClient.AccountGet + // HTTP status codes to indicate success: http.StatusOK + AccountGet func(ctx context.Context, resourceGroupName string, accountName string, featureRequest armpurview.BatchFeatureRequest, options *armpurview.FeaturesClientAccountGetOptions) (resp azfake.Responder[armpurview.FeaturesClientAccountGetResponse], errResp azfake.ErrorResponder) + + // SubscriptionGet is the fake for method FeaturesClient.SubscriptionGet + // HTTP status codes to indicate success: http.StatusOK + SubscriptionGet func(ctx context.Context, locations string, featureRequest armpurview.BatchFeatureRequest, options *armpurview.FeaturesClientSubscriptionGetOptions) (resp azfake.Responder[armpurview.FeaturesClientSubscriptionGetResponse], errResp azfake.ErrorResponder) +} + +// NewFeaturesServerTransport creates a new instance of FeaturesServerTransport with the provided implementation. +// The returned FeaturesServerTransport instance is connected to an instance of armpurview.FeaturesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFeaturesServerTransport(srv *FeaturesServer) *FeaturesServerTransport { + return &FeaturesServerTransport{srv: srv} +} + +// FeaturesServerTransport connects instances of armpurview.FeaturesClient to instances of FeaturesServer. +// Don't use this type directly, use NewFeaturesServerTransport instead. +type FeaturesServerTransport struct { + srv *FeaturesServer +} + +// Do implements the policy.Transporter interface for FeaturesServerTransport. +func (f *FeaturesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "FeaturesClient.AccountGet": + resp, err = f.dispatchAccountGet(req) + case "FeaturesClient.SubscriptionGet": + resp, err = f.dispatchSubscriptionGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (f *FeaturesServerTransport) dispatchAccountGet(req *http.Request) (*http.Response, error) { + if f.srv.AccountGet == nil { + return nil, &nonRetriableError{errors.New("fake for method AccountGet not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Purview/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listFeatures` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armpurview.BatchFeatureRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.AccountGet(req.Context(), resourceGroupNameParam, accountNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BatchFeatureStatus, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FeaturesServerTransport) dispatchSubscriptionGet(req *http.Request) (*http.Response, error) { + if f.srv.SubscriptionGet == nil { + return nil, &nonRetriableError{errors.New("fake for method SubscriptionGet not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Purview/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listFeatures` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armpurview.BatchFeatureRequest](req) + if err != nil { + return nil, err + } + locationsParam, err := url.PathUnescape(matches[regex.SubexpIndex("locations")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.SubscriptionGet(req.Context(), locationsParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BatchFeatureStatus, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/purview/armpurview/fake/ingestionprivateendpointconnections_server.go b/sdk/resourcemanager/purview/armpurview/fake/ingestionprivateendpointconnections_server.go new file mode 100644 index 000000000000..5f9f41d248d3 --- /dev/null +++ b/sdk/resourcemanager/purview/armpurview/fake/ingestionprivateendpointconnections_server.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview/v2" + "net/http" + "net/url" + "regexp" +) + +// IngestionPrivateEndpointConnectionsServer is a fake server for instances of the armpurview.IngestionPrivateEndpointConnectionsClient type. +type IngestionPrivateEndpointConnectionsServer struct { + // NewListPager is the fake for method IngestionPrivateEndpointConnectionsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, accountName string, options *armpurview.IngestionPrivateEndpointConnectionsClientListOptions) (resp azfake.PagerResponder[armpurview.IngestionPrivateEndpointConnectionsClientListResponse]) + + // UpdateStatus is the fake for method IngestionPrivateEndpointConnectionsClient.UpdateStatus + // HTTP status codes to indicate success: http.StatusOK + UpdateStatus func(ctx context.Context, resourceGroupName string, accountName string, request armpurview.PrivateEndpointConnectionStatusUpdateRequest, options *armpurview.IngestionPrivateEndpointConnectionsClientUpdateStatusOptions) (resp azfake.Responder[armpurview.IngestionPrivateEndpointConnectionsClientUpdateStatusResponse], errResp azfake.ErrorResponder) +} + +// NewIngestionPrivateEndpointConnectionsServerTransport creates a new instance of IngestionPrivateEndpointConnectionsServerTransport with the provided implementation. +// The returned IngestionPrivateEndpointConnectionsServerTransport instance is connected to an instance of armpurview.IngestionPrivateEndpointConnectionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewIngestionPrivateEndpointConnectionsServerTransport(srv *IngestionPrivateEndpointConnectionsServer) *IngestionPrivateEndpointConnectionsServerTransport { + return &IngestionPrivateEndpointConnectionsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armpurview.IngestionPrivateEndpointConnectionsClientListResponse]](), + } +} + +// IngestionPrivateEndpointConnectionsServerTransport connects instances of armpurview.IngestionPrivateEndpointConnectionsClient to instances of IngestionPrivateEndpointConnectionsServer. +// Don't use this type directly, use NewIngestionPrivateEndpointConnectionsServerTransport instead. +type IngestionPrivateEndpointConnectionsServerTransport struct { + srv *IngestionPrivateEndpointConnectionsServer + newListPager *tracker[azfake.PagerResponder[armpurview.IngestionPrivateEndpointConnectionsClientListResponse]] +} + +// Do implements the policy.Transporter interface for IngestionPrivateEndpointConnectionsServerTransport. +func (i *IngestionPrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "IngestionPrivateEndpointConnectionsClient.NewListPager": + resp, err = i.dispatchNewListPager(req) + case "IngestionPrivateEndpointConnectionsClient.UpdateStatus": + resp, err = i.dispatchUpdateStatus(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (i *IngestionPrivateEndpointConnectionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if i.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := i.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Purview/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ingestionPrivateEndpointConnections` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + resp := i.srv.NewListPager(resourceGroupNameParam, accountNameParam, nil) + newListPager = &resp + i.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armpurview.IngestionPrivateEndpointConnectionsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + i.newListPager.remove(req) + } + return resp, nil +} + +func (i *IngestionPrivateEndpointConnectionsServerTransport) dispatchUpdateStatus(req *http.Request) (*http.Response, error) { + if i.srv.UpdateStatus == nil { + return nil, &nonRetriableError{errors.New("fake for method UpdateStatus not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Purview/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ingestionPrivateEndpointConnectionStatus` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armpurview.PrivateEndpointConnectionStatusUpdateRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.UpdateStatus(req.Context(), resourceGroupNameParam, accountNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnectionStatusUpdateResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/purview/armpurview/fake/kafkaconfigurations_server.go b/sdk/resourcemanager/purview/armpurview/fake/kafkaconfigurations_server.go new file mode 100644 index 000000000000..4f49fdbcc72e --- /dev/null +++ b/sdk/resourcemanager/purview/armpurview/fake/kafkaconfigurations_server.go @@ -0,0 +1,258 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview/v2" + "net/http" + "net/url" + "regexp" +) + +// KafkaConfigurationsServer is a fake server for instances of the armpurview.KafkaConfigurationsClient type. +type KafkaConfigurationsServer struct { + // CreateOrUpdate is the fake for method KafkaConfigurationsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, accountName string, kafkaConfigurationName string, kafkaConfiguration armpurview.KafkaConfiguration, options *armpurview.KafkaConfigurationsClientCreateOrUpdateOptions) (resp azfake.Responder[armpurview.KafkaConfigurationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method KafkaConfigurationsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, accountName string, kafkaConfigurationName string, options *armpurview.KafkaConfigurationsClientDeleteOptions) (resp azfake.Responder[armpurview.KafkaConfigurationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method KafkaConfigurationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, kafkaConfigurationName string, options *armpurview.KafkaConfigurationsClientGetOptions) (resp azfake.Responder[armpurview.KafkaConfigurationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByAccountPager is the fake for method KafkaConfigurationsClient.NewListByAccountPager + // HTTP status codes to indicate success: http.StatusOK + NewListByAccountPager func(resourceGroupName string, accountName string, options *armpurview.KafkaConfigurationsClientListByAccountOptions) (resp azfake.PagerResponder[armpurview.KafkaConfigurationsClientListByAccountResponse]) +} + +// NewKafkaConfigurationsServerTransport creates a new instance of KafkaConfigurationsServerTransport with the provided implementation. +// The returned KafkaConfigurationsServerTransport instance is connected to an instance of armpurview.KafkaConfigurationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewKafkaConfigurationsServerTransport(srv *KafkaConfigurationsServer) *KafkaConfigurationsServerTransport { + return &KafkaConfigurationsServerTransport{ + srv: srv, + newListByAccountPager: newTracker[azfake.PagerResponder[armpurview.KafkaConfigurationsClientListByAccountResponse]](), + } +} + +// KafkaConfigurationsServerTransport connects instances of armpurview.KafkaConfigurationsClient to instances of KafkaConfigurationsServer. +// Don't use this type directly, use NewKafkaConfigurationsServerTransport instead. +type KafkaConfigurationsServerTransport struct { + srv *KafkaConfigurationsServer + newListByAccountPager *tracker[azfake.PagerResponder[armpurview.KafkaConfigurationsClientListByAccountResponse]] +} + +// Do implements the policy.Transporter interface for KafkaConfigurationsServerTransport. +func (k *KafkaConfigurationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "KafkaConfigurationsClient.CreateOrUpdate": + resp, err = k.dispatchCreateOrUpdate(req) + case "KafkaConfigurationsClient.Delete": + resp, err = k.dispatchDelete(req) + case "KafkaConfigurationsClient.Get": + resp, err = k.dispatchGet(req) + case "KafkaConfigurationsClient.NewListByAccountPager": + resp, err = k.dispatchNewListByAccountPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (k *KafkaConfigurationsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if k.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Purview/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/kafkaConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armpurview.KafkaConfiguration](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + kafkaConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("kafkaConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := k.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, accountNameParam, kafkaConfigurationNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).KafkaConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (k *KafkaConfigurationsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if k.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Purview/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/kafkaConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + kafkaConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("kafkaConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := k.srv.Delete(req.Context(), resourceGroupNameParam, accountNameParam, kafkaConfigurationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (k *KafkaConfigurationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if k.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Purview/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/kafkaConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + kafkaConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("kafkaConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := k.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, kafkaConfigurationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).KafkaConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (k *KafkaConfigurationsServerTransport) dispatchNewListByAccountPager(req *http.Request) (*http.Response, error) { + if k.srv.NewListByAccountPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByAccountPager not implemented")} + } + newListByAccountPager := k.newListByAccountPager.get(req) + if newListByAccountPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Purview/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/kafkaConfigurations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) + if err != nil { + return nil, err + } + skipTokenParam := getOptional(skipTokenUnescaped) + var options *armpurview.KafkaConfigurationsClientListByAccountOptions + if skipTokenParam != nil { + options = &armpurview.KafkaConfigurationsClientListByAccountOptions{ + SkipToken: skipTokenParam, + } + } + resp := k.srv.NewListByAccountPager(resourceGroupNameParam, accountNameParam, options) + newListByAccountPager = &resp + k.newListByAccountPager.add(req, newListByAccountPager) + server.PagerResponderInjectNextLinks(newListByAccountPager, req, func(page *armpurview.KafkaConfigurationsClientListByAccountResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByAccountPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + k.newListByAccountPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByAccountPager) { + k.newListByAccountPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/purview/armpurview/fake/operations_server.go b/sdk/resourcemanager/purview/armpurview/fake/operations_server.go index ad2a3cad5fef..1e808db42204 100644 --- a/sdk/resourcemanager/purview/armpurview/fake/operations_server.go +++ b/sdk/resourcemanager/purview/armpurview/fake/operations_server.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview/v2" "net/http" ) diff --git a/sdk/resourcemanager/purview/armpurview/fake/privateendpointconnections_server.go b/sdk/resourcemanager/purview/armpurview/fake/privateendpointconnections_server.go index 67eb55af4a55..02915b0ac73f 100644 --- a/sdk/resourcemanager/purview/armpurview/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/purview/armpurview/fake/privateendpointconnections_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/purview/armpurview/fake/privatelinkresources_server.go b/sdk/resourcemanager/purview/armpurview/fake/privatelinkresources_server.go index 8c5e227915f1..c52f2bf3a2d9 100644 --- a/sdk/resourcemanager/purview/armpurview/fake/privatelinkresources_server.go +++ b/sdk/resourcemanager/purview/armpurview/fake/privatelinkresources_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/purview/armpurview/fake/server_factory.go b/sdk/resourcemanager/purview/armpurview/fake/server_factory.go index e73f7397fbf5..64f50a33e4ab 100644 --- a/sdk/resourcemanager/purview/armpurview/fake/server_factory.go +++ b/sdk/resourcemanager/purview/armpurview/fake/server_factory.go @@ -19,11 +19,15 @@ import ( // ServerFactory is a fake server for instances of the armpurview.ClientFactory type. type ServerFactory struct { - AccountsServer AccountsServer - DefaultAccountsServer DefaultAccountsServer - OperationsServer OperationsServer - PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer - PrivateLinkResourcesServer PrivateLinkResourcesServer + AccountsServer AccountsServer + DefaultAccountsServer DefaultAccountsServer + FeaturesServer FeaturesServer + IngestionPrivateEndpointConnectionsServer IngestionPrivateEndpointConnectionsServer + KafkaConfigurationsServer KafkaConfigurationsServer + OperationsServer OperationsServer + PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer + PrivateLinkResourcesServer PrivateLinkResourcesServer + UsagesServer UsagesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -38,13 +42,17 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armpurview.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trAccountsServer *AccountsServerTransport - trDefaultAccountsServer *DefaultAccountsServerTransport - trOperationsServer *OperationsServerTransport - trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport - trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport + srv *ServerFactory + trMu sync.Mutex + trAccountsServer *AccountsServerTransport + trDefaultAccountsServer *DefaultAccountsServerTransport + trFeaturesServer *FeaturesServerTransport + trIngestionPrivateEndpointConnectionsServer *IngestionPrivateEndpointConnectionsServerTransport + trKafkaConfigurationsServer *KafkaConfigurationsServerTransport + trOperationsServer *OperationsServerTransport + trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport + trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport + trUsagesServer *UsagesServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -68,6 +76,19 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewDefaultAccountsServerTransport(&s.srv.DefaultAccountsServer) }) resp, err = s.trDefaultAccountsServer.Do(req) + case "FeaturesClient": + initServer(s, &s.trFeaturesServer, func() *FeaturesServerTransport { return NewFeaturesServerTransport(&s.srv.FeaturesServer) }) + resp, err = s.trFeaturesServer.Do(req) + case "IngestionPrivateEndpointConnectionsClient": + initServer(s, &s.trIngestionPrivateEndpointConnectionsServer, func() *IngestionPrivateEndpointConnectionsServerTransport { + return NewIngestionPrivateEndpointConnectionsServerTransport(&s.srv.IngestionPrivateEndpointConnectionsServer) + }) + resp, err = s.trIngestionPrivateEndpointConnectionsServer.Do(req) + case "KafkaConfigurationsClient": + initServer(s, &s.trKafkaConfigurationsServer, func() *KafkaConfigurationsServerTransport { + return NewKafkaConfigurationsServerTransport(&s.srv.KafkaConfigurationsServer) + }) + resp, err = s.trKafkaConfigurationsServer.Do(req) case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) @@ -81,6 +102,9 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) }) resp, err = s.trPrivateLinkResourcesServer.Do(req) + case "UsagesClient": + initServer(s, &s.trUsagesServer, func() *UsagesServerTransport { return NewUsagesServerTransport(&s.srv.UsagesServer) }) + resp, err = s.trUsagesServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/purview/armpurview/fake/time_rfc3339.go b/sdk/resourcemanager/purview/armpurview/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/purview/armpurview/fake/time_rfc3339.go +++ b/sdk/resourcemanager/purview/armpurview/fake/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/purview/armpurview/fake/usages_server.go b/sdk/resourcemanager/purview/armpurview/fake/usages_server.go new file mode 100644 index 000000000000..df0d4d05ea15 --- /dev/null +++ b/sdk/resourcemanager/purview/armpurview/fake/usages_server.go @@ -0,0 +1,108 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview/v2" + "net/http" + "net/url" + "regexp" +) + +// UsagesServer is a fake server for instances of the armpurview.UsagesClient type. +type UsagesServer struct { + // Get is the fake for method UsagesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, location string, options *armpurview.UsagesClientGetOptions) (resp azfake.Responder[armpurview.UsagesClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewUsagesServerTransport creates a new instance of UsagesServerTransport with the provided implementation. +// The returned UsagesServerTransport instance is connected to an instance of armpurview.UsagesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewUsagesServerTransport(srv *UsagesServer) *UsagesServerTransport { + return &UsagesServerTransport{srv: srv} +} + +// UsagesServerTransport connects instances of armpurview.UsagesClient to instances of UsagesServer. +// Don't use this type directly, use NewUsagesServerTransport instead. +type UsagesServerTransport struct { + srv *UsagesServer +} + +// Do implements the policy.Transporter interface for UsagesServerTransport. +func (u *UsagesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "UsagesClient.Get": + resp, err = u.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (u *UsagesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if u.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Purview/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/usages` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + var options *armpurview.UsagesClientGetOptions + if filterParam != nil { + options = &armpurview.UsagesClientGetOptions{ + Filter: filterParam, + } + } + respr, errRespr := u.srv.Get(req.Context(), locationParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).UsageList, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/purview/armpurview/features_client.go b/sdk/resourcemanager/purview/armpurview/features_client.go new file mode 100644 index 000000000000..ef8986d55d11 --- /dev/null +++ b/sdk/resourcemanager/purview/armpurview/features_client.go @@ -0,0 +1,176 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armpurview + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FeaturesClient contains the methods for the Features group. +// Don't use this type directly, use NewFeaturesClient() instead. +type FeaturesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFeaturesClient creates a new instance of FeaturesClient with the specified values. +// - subscriptionID - The subscription identifier +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFeaturesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FeaturesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FeaturesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// AccountGet - Gets details from a list of feature names. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-04-01-preview +// - resourceGroupName - The resource group name. +// - accountName - The name of the account. +// - featureRequest - Request body with feature names. +// - options - FeaturesClientAccountGetOptions contains the optional parameters for the FeaturesClient.AccountGet method. +func (client *FeaturesClient) AccountGet(ctx context.Context, resourceGroupName string, accountName string, featureRequest BatchFeatureRequest, options *FeaturesClientAccountGetOptions) (FeaturesClientAccountGetResponse, error) { + var err error + const operationName = "FeaturesClient.AccountGet" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.accountGetCreateRequest(ctx, resourceGroupName, accountName, featureRequest, options) + if err != nil { + return FeaturesClientAccountGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FeaturesClientAccountGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FeaturesClientAccountGetResponse{}, err + } + resp, err := client.accountGetHandleResponse(httpResp) + return resp, err +} + +// accountGetCreateRequest creates the AccountGet request. +func (client *FeaturesClient) accountGetCreateRequest(ctx context.Context, resourceGroupName string, accountName string, featureRequest BatchFeatureRequest, options *FeaturesClientAccountGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/listFeatures" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, featureRequest); err != nil { + return nil, err + } + return req, nil +} + +// accountGetHandleResponse handles the AccountGet response. +func (client *FeaturesClient) accountGetHandleResponse(resp *http.Response) (FeaturesClientAccountGetResponse, error) { + result := FeaturesClientAccountGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BatchFeatureStatus); err != nil { + return FeaturesClientAccountGetResponse{}, err + } + return result, nil +} + +// SubscriptionGet - Gets details from a list of feature names. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-04-01-preview +// - locations - Location of feature. +// - featureRequest - Request body with feature names. +// - options - FeaturesClientSubscriptionGetOptions contains the optional parameters for the FeaturesClient.SubscriptionGet +// method. +func (client *FeaturesClient) SubscriptionGet(ctx context.Context, locations string, featureRequest BatchFeatureRequest, options *FeaturesClientSubscriptionGetOptions) (FeaturesClientSubscriptionGetResponse, error) { + var err error + const operationName = "FeaturesClient.SubscriptionGet" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.subscriptionGetCreateRequest(ctx, locations, featureRequest, options) + if err != nil { + return FeaturesClientSubscriptionGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FeaturesClientSubscriptionGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FeaturesClientSubscriptionGetResponse{}, err + } + resp, err := client.subscriptionGetHandleResponse(httpResp) + return resp, err +} + +// subscriptionGetCreateRequest creates the SubscriptionGet request. +func (client *FeaturesClient) subscriptionGetCreateRequest(ctx context.Context, locations string, featureRequest BatchFeatureRequest, options *FeaturesClientSubscriptionGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Purview/locations/{locations}/listFeatures" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locations == "" { + return nil, errors.New("parameter locations cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locations}", url.PathEscape(locations)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, featureRequest); err != nil { + return nil, err + } + return req, nil +} + +// subscriptionGetHandleResponse handles the SubscriptionGet response. +func (client *FeaturesClient) subscriptionGetHandleResponse(resp *http.Response) (FeaturesClientSubscriptionGetResponse, error) { + result := FeaturesClientSubscriptionGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BatchFeatureStatus); err != nil { + return FeaturesClientSubscriptionGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/purview/armpurview/go.mod b/sdk/resourcemanager/purview/armpurview/go.mod index 179c433c81fc..9d9c1ddb5b6e 100644 --- a/sdk/resourcemanager/purview/armpurview/go.mod +++ b/sdk/resourcemanager/purview/armpurview/go.mod @@ -1,21 +1,11 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.7.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.22.0 // indirect golang.org/x/net v0.24.0 // indirect - golang.org/x/sys v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect ) diff --git a/sdk/resourcemanager/purview/armpurview/go.sum b/sdk/resourcemanager/purview/armpurview/go.sum index 453385ef9f88..ffdff03203f8 100644 --- a/sdk/resourcemanager/purview/armpurview/go.sum +++ b/sdk/resourcemanager/purview/armpurview/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 h1:E+OJmp2tPvt1W+amx48v1eqbjDYsgN+RzP4q16yV5eM= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1/go.mod h1:a6xsAQUZg+VsS3TJ05SRp524Hs4pZ/AeFSr5ENf0Yjo= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.2 h1:FDif4R1+UUR+00q6wquyX90K7A8dN+R5E8GEadoP7sU= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.2/go.mod h1:aiYBYui4BJ/BJCAIKs92XiPyQfTaBWqvHujDwKb6CBU= github.com/Azure/azure-sdk-for-go/sdk/internal v1.7.0 h1:rTfKOCZGy5ViVrlA74ZPE99a+SgoEE2K/yg3RyW9dFA= github.com/Azure/azure-sdk-for-go/sdk/internal v1.7.0/go.mod h1:4OG6tQ9EOP/MT0NMjDlRzWoVFxfu9rN9B2X+tlSVktg= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= -golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/purview/armpurview/ingestionprivateendpointconnections_client.go b/sdk/resourcemanager/purview/armpurview/ingestionprivateendpointconnections_client.go new file mode 100644 index 000000000000..d043bfc1d3f5 --- /dev/null +++ b/sdk/resourcemanager/purview/armpurview/ingestionprivateendpointconnections_client.go @@ -0,0 +1,178 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armpurview + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// IngestionPrivateEndpointConnectionsClient contains the methods for the IngestionPrivateEndpointConnections group. +// Don't use this type directly, use NewIngestionPrivateEndpointConnectionsClient() instead. +type IngestionPrivateEndpointConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewIngestionPrivateEndpointConnectionsClient creates a new instance of IngestionPrivateEndpointConnectionsClient with the specified values. +// - subscriptionID - The subscription identifier +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewIngestionPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IngestionPrivateEndpointConnectionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &IngestionPrivateEndpointConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Lists all ingestion private endpoint connections +// +// Generated from API version 2024-04-01-preview +// - resourceGroupName - The resource group name. +// - accountName - The name of the account. +// - options - IngestionPrivateEndpointConnectionsClientListOptions contains the optional parameters for the IngestionPrivateEndpointConnectionsClient.NewListPager +// method. +func (client *IngestionPrivateEndpointConnectionsClient) NewListPager(resourceGroupName string, accountName string, options *IngestionPrivateEndpointConnectionsClientListOptions) *runtime.Pager[IngestionPrivateEndpointConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[IngestionPrivateEndpointConnectionsClientListResponse]{ + More: func(page IngestionPrivateEndpointConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *IngestionPrivateEndpointConnectionsClientListResponse) (IngestionPrivateEndpointConnectionsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IngestionPrivateEndpointConnectionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, nil) + if err != nil { + return IngestionPrivateEndpointConnectionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *IngestionPrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *IngestionPrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/ingestionPrivateEndpointConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *IngestionPrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (IngestionPrivateEndpointConnectionsClientListResponse, error) { + result := IngestionPrivateEndpointConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionList); err != nil { + return IngestionPrivateEndpointConnectionsClientListResponse{}, err + } + return result, nil +} + +// UpdateStatus - Update ingestion private endpoint connection status +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-04-01-preview +// - resourceGroupName - The resource group name. +// - accountName - The name of the account. +// - request - The ingestion private endpoint connection status update request. +// - options - IngestionPrivateEndpointConnectionsClientUpdateStatusOptions contains the optional parameters for the IngestionPrivateEndpointConnectionsClient.UpdateStatus +// method. +func (client *IngestionPrivateEndpointConnectionsClient) UpdateStatus(ctx context.Context, resourceGroupName string, accountName string, request PrivateEndpointConnectionStatusUpdateRequest, options *IngestionPrivateEndpointConnectionsClientUpdateStatusOptions) (IngestionPrivateEndpointConnectionsClientUpdateStatusResponse, error) { + var err error + const operationName = "IngestionPrivateEndpointConnectionsClient.UpdateStatus" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateStatusCreateRequest(ctx, resourceGroupName, accountName, request, options) + if err != nil { + return IngestionPrivateEndpointConnectionsClientUpdateStatusResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IngestionPrivateEndpointConnectionsClientUpdateStatusResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IngestionPrivateEndpointConnectionsClientUpdateStatusResponse{}, err + } + resp, err := client.updateStatusHandleResponse(httpResp) + return resp, err +} + +// updateStatusCreateRequest creates the UpdateStatus request. +func (client *IngestionPrivateEndpointConnectionsClient) updateStatusCreateRequest(ctx context.Context, resourceGroupName string, accountName string, request PrivateEndpointConnectionStatusUpdateRequest, options *IngestionPrivateEndpointConnectionsClientUpdateStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/ingestionPrivateEndpointConnectionStatus" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, request); err != nil { + return nil, err + } + return req, nil +} + +// updateStatusHandleResponse handles the UpdateStatus response. +func (client *IngestionPrivateEndpointConnectionsClient) updateStatusHandleResponse(resp *http.Response) (IngestionPrivateEndpointConnectionsClientUpdateStatusResponse, error) { + result := IngestionPrivateEndpointConnectionsClientUpdateStatusResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionStatusUpdateResponse); err != nil { + return IngestionPrivateEndpointConnectionsClientUpdateStatusResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/purview/armpurview/kafkaconfigurations_client.go b/sdk/resourcemanager/purview/armpurview/kafkaconfigurations_client.go new file mode 100644 index 000000000000..e4ad97a573c8 --- /dev/null +++ b/sdk/resourcemanager/purview/armpurview/kafkaconfigurations_client.go @@ -0,0 +1,315 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armpurview + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// KafkaConfigurationsClient contains the methods for the KafkaConfigurations group. +// Don't use this type directly, use NewKafkaConfigurationsClient() instead. +type KafkaConfigurationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewKafkaConfigurationsClient creates a new instance of KafkaConfigurationsClient with the specified values. +// - subscriptionID - The subscription identifier +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewKafkaConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*KafkaConfigurationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &KafkaConfigurationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create or update Kafka Configuration +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-04-01-preview +// - resourceGroupName - The resource group name. +// - accountName - The name of the account. +// - kafkaConfigurationName - The kafka configuration name. +// - kafkaConfiguration - The kafka configuration of the account. +// - options - KafkaConfigurationsClientCreateOrUpdateOptions contains the optional parameters for the KafkaConfigurationsClient.CreateOrUpdate +// method. +func (client *KafkaConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, kafkaConfigurationName string, kafkaConfiguration KafkaConfiguration, options *KafkaConfigurationsClientCreateOrUpdateOptions) (KafkaConfigurationsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "KafkaConfigurationsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, kafkaConfigurationName, kafkaConfiguration, options) + if err != nil { + return KafkaConfigurationsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return KafkaConfigurationsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return KafkaConfigurationsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *KafkaConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, kafkaConfigurationName string, kafkaConfiguration KafkaConfiguration, options *KafkaConfigurationsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/kafkaConfigurations/{kafkaConfigurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if kafkaConfigurationName == "" { + return nil, errors.New("parameter kafkaConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{kafkaConfigurationName}", url.PathEscape(kafkaConfigurationName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, kafkaConfiguration); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *KafkaConfigurationsClient) createOrUpdateHandleResponse(resp *http.Response) (KafkaConfigurationsClientCreateOrUpdateResponse, error) { + result := KafkaConfigurationsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.KafkaConfiguration); err != nil { + return KafkaConfigurationsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes a KafkaConfiguration resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-04-01-preview +// - resourceGroupName - The resource group name. +// - accountName - The name of the account. +// - kafkaConfigurationName - Name of kafka configuration. +// - options - KafkaConfigurationsClientDeleteOptions contains the optional parameters for the KafkaConfigurationsClient.Delete +// method. +func (client *KafkaConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, kafkaConfigurationName string, options *KafkaConfigurationsClientDeleteOptions) (KafkaConfigurationsClientDeleteResponse, error) { + var err error + const operationName = "KafkaConfigurationsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, kafkaConfigurationName, options) + if err != nil { + return KafkaConfigurationsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return KafkaConfigurationsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return KafkaConfigurationsClientDeleteResponse{}, err + } + return KafkaConfigurationsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *KafkaConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, kafkaConfigurationName string, options *KafkaConfigurationsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/kafkaConfigurations/{kafkaConfigurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if kafkaConfigurationName == "" { + return nil, errors.New("parameter kafkaConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{kafkaConfigurationName}", url.PathEscape(kafkaConfigurationName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the kafka configuration for the account +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-04-01-preview +// - resourceGroupName - The resource group name. +// - accountName - The name of the account. +// - kafkaConfigurationName - Name of kafka configuration. +// - options - KafkaConfigurationsClientGetOptions contains the optional parameters for the KafkaConfigurationsClient.Get method. +func (client *KafkaConfigurationsClient) Get(ctx context.Context, resourceGroupName string, accountName string, kafkaConfigurationName string, options *KafkaConfigurationsClientGetOptions) (KafkaConfigurationsClientGetResponse, error) { + var err error + const operationName = "KafkaConfigurationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, kafkaConfigurationName, options) + if err != nil { + return KafkaConfigurationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return KafkaConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return KafkaConfigurationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *KafkaConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, kafkaConfigurationName string, options *KafkaConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/kafkaConfigurations/{kafkaConfigurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if kafkaConfigurationName == "" { + return nil, errors.New("parameter kafkaConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{kafkaConfigurationName}", url.PathEscape(kafkaConfigurationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *KafkaConfigurationsClient) getHandleResponse(resp *http.Response) (KafkaConfigurationsClientGetResponse, error) { + result := KafkaConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.KafkaConfiguration); err != nil { + return KafkaConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByAccountPager - Lists the Kafka configurations in the Account +// +// Generated from API version 2024-04-01-preview +// - resourceGroupName - The resource group name. +// - accountName - The name of the account. +// - options - KafkaConfigurationsClientListByAccountOptions contains the optional parameters for the KafkaConfigurationsClient.NewListByAccountPager +// method. +func (client *KafkaConfigurationsClient) NewListByAccountPager(resourceGroupName string, accountName string, options *KafkaConfigurationsClientListByAccountOptions) *runtime.Pager[KafkaConfigurationsClientListByAccountResponse] { + return runtime.NewPager(runtime.PagingHandler[KafkaConfigurationsClientListByAccountResponse]{ + More: func(page KafkaConfigurationsClientListByAccountResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *KafkaConfigurationsClientListByAccountResponse) (KafkaConfigurationsClientListByAccountResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "KafkaConfigurationsClient.NewListByAccountPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByAccountCreateRequest(ctx, resourceGroupName, accountName, options) + }, nil) + if err != nil { + return KafkaConfigurationsClientListByAccountResponse{}, err + } + return client.listByAccountHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByAccountCreateRequest creates the ListByAccount request. +func (client *KafkaConfigurationsClient) listByAccountCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *KafkaConfigurationsClientListByAccountOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/kafkaConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + reqQP.Set("api-version", "2024-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByAccountHandleResponse handles the ListByAccount response. +func (client *KafkaConfigurationsClient) listByAccountHandleResponse(resp *http.Response) (KafkaConfigurationsClientListByAccountResponse, error) { + result := KafkaConfigurationsClientListByAccountResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.KafkaConfigurationList); err != nil { + return KafkaConfigurationsClientListByAccountResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/purview/armpurview/models.go b/sdk/resourcemanager/purview/armpurview/models.go index e4b5ee42239a..6cf6facd97cd 100644 --- a/sdk/resourcemanager/purview/armpurview/models.go +++ b/sdk/resourcemanager/purview/armpurview/models.go @@ -10,7 +10,7 @@ package armpurview import "time" -// AccessKeys - The Account access keys. +// AccessKeys - The Purview Account access keys. type AccessKeys struct { // Gets or sets the primary connection string. AtlasKafkaPrimaryEndpoint *string @@ -21,15 +21,18 @@ type AccessKeys struct { // Account resource type Account struct { - // Identity Info on the tracked resource + // The Managed Identity of the resource Identity *Identity // Gets or sets the location. Location *string - // Gets or sets the properties. + // The account properties Properties *AccountProperties + // Gets or sets the Sku. + SKU *AccountSKU + // Tags on the azure resource. Tags map[string]*string @@ -39,9 +42,6 @@ type Account struct { // READ-ONLY; Gets or sets the name. Name *string - // READ-ONLY; Gets or sets the Sku. - SKU *AccountSKU - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. SystemData *TrackedResourceSystemData @@ -54,36 +54,73 @@ type AccountEndpoints struct { // READ-ONLY; Gets the catalog endpoint. Catalog *string - // READ-ONLY; Gets the guardian endpoint. - Guardian *string - // READ-ONLY; Gets the scan endpoint. Scan *string } -// AccountList - Paged list of account resources +// AccountList - Paged list of Account resources type AccountList struct { // REQUIRED; Collection of items of type results. Value []*Account - // Total item count. - Count *int64 - // The Url of next result page. NextLink *string } +// AccountMergeInfo - The public Account Merge Info model. +type AccountMergeInfo struct { + // READ-ONLY; The account location of the other account in the merge operation. + AccountLocation *string + + // READ-ONLY; The account name of the other account in the merge operation. + AccountName *string + + // READ-ONLY; The resource group name of the other account in the merge operation. + AccountResourceGroupName *string + + // READ-ONLY; The subscription id of the other account in the merge operation. + AccountSubscriptionID *string + + // READ-ONLY; The deprovisioned status of the account. Only applicable for the secondary account. + Deprovisioned *bool + + // READ-ONLY; The status of the merge operation. + MergeStatus *MergeStatus + + // READ-ONLY; The account's type for the merge operation. + TypeOfAccount *MergeAccountType +} + // AccountProperties - The account properties type AccountProperties struct { - // Cloud connectors. External cloud identifier used as part of scanning configuration. + // External Cloud Service connectors CloudConnectors *CloudConnectors + // Ingestion Storage Account Info + IngestionStorage *IngestionStorage + + // Gets or sets the state of managed eventhub. If enabled managed eventhub will be created, if disabled the managed eventhub + // will be removed. + ManagedEventHubState *ManagedEventHubState + // Gets or sets the managed resource group name ManagedResourceGroupName *string + // Gets or sets the public network access for managed resources. + ManagedResourcesPublicNetworkAccess *PublicNetworkAccess + + // Gets or sets the Merge Info. + MergeInfo *AccountMergeInfo + // Gets or sets the public network access. PublicNetworkAccess *PublicNetworkAccess + // Gets or sets the state of tenant endpoint. + TenantEndpointState *TenantEndpointState + + // READ-ONLY; Gets or sets the status of the account. + AccountStatus *AccountPropertiesAccountStatus + // READ-ONLY; Gets the time at which the entity was created. CreatedAt *time.Time @@ -93,6 +130,9 @@ type AccountProperties struct { // READ-ONLY; Gets the creators of the entity's object id. CreatedByObjectID *string + // READ-ONLY; Gets the default domain in the account. + DefaultDomain *string + // READ-ONLY; The URIs that are the public endpoints of the account. Endpoints *AccountPropertiesEndpoints @@ -109,14 +149,20 @@ type AccountProperties struct { ProvisioningState *ProvisioningState } +// AccountPropertiesAccountStatus - Gets or sets the status of the account. +type AccountPropertiesAccountStatus struct { + // READ-ONLY; Gets the account status code. + AccountProvisioningState *AccountProvisioningState + + // READ-ONLY; Gets the account error details. + ErrorDetails *AccountStatusErrorDetails +} + // AccountPropertiesEndpoints - The URIs that are the public endpoints of the account. type AccountPropertiesEndpoints struct { // READ-ONLY; Gets the catalog endpoint. Catalog *string - // READ-ONLY; Gets the guardian endpoint. - Guardian *string - // READ-ONLY; Gets the scan endpoint. Scan *string } @@ -140,7 +186,7 @@ type AccountSKU struct { Capacity *int32 // Gets or sets the sku name. - Name *Name + Name *AccountSKUName } // AccountSKUAutoGenerated - The Sku @@ -149,21 +195,57 @@ type AccountSKUAutoGenerated struct { Capacity *int32 // Gets or sets the sku name. - Name *Name + Name *AccountSKUName +} + +// AccountStatus - The account status. +type AccountStatus struct { + // READ-ONLY; Gets the account status code. + AccountProvisioningState *AccountProvisioningState + + // READ-ONLY; Gets the account error details. + ErrorDetails *AccountStatusErrorDetails +} + +// AccountStatusErrorDetails - Gets the account error details. +type AccountStatusErrorDetails struct { + // READ-ONLY; Gets or sets the code. + Code *string + + // READ-ONLY; Gets or sets the details. + Details []*ErrorModel + + // READ-ONLY; Gets or sets the messages. + Message *string + + // READ-ONLY; Gets or sets the target. + Target *string } // AccountUpdateParameters - The account update properties. type AccountUpdateParameters struct { - // Identity related info to add/remove userAssignedIdentities. + // The Managed Identity of the resource Identity *Identity - // The account properties. + // The account properties Properties *AccountProperties // Tags on the azure resource. Tags map[string]*string } +// BatchFeatureRequest - Feature request model +type BatchFeatureRequest struct { + // Set of features + Features []*string +} + +// BatchFeatureStatus - List of features with enabled status +type BatchFeatureStatus struct { + // READ-ONLY; Features with enabled status + Features map[string]*bool +} + // CheckNameAvailabilityRequest - The request payload for CheckNameAvailability API type CheckNameAvailabilityRequest struct { // Resource name to verify for availability @@ -197,6 +279,48 @@ type CollectionAdminUpdate struct { ObjectID *string } +// Consent extension resource +type Consent struct { + // Gets or sets the consent kind. + Kind *ConsentKind + + // The consent properties + Properties *ConsentProperties + + // READ-ONLY; Gets or sets the identifier. + ID *string + + // READ-ONLY; Gets or sets the name. + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *ProxyResourceSystemData + + // READ-ONLY; Gets or sets the type. + Type *string +} + +// ConsentProperties - The consent properties +type ConsentProperties struct { + // READ-ONLY + Scope *string + + // READ-ONLY; Defines consent scope type. + ScopeType *ConsentScopeType + + // READ-ONLY; Defines consent status. + Status *ConsentStatus +} + +// Credentials to access the event streaming service attached to the purview account. +type Credentials struct { + // Identity identifier for UserAssign type. + IdentityID *string + + // Identity Type. + Type *KafkaConfigurationIdentityType +} + // DefaultAccountPayload - Payload to get and set the default account in the given scope type DefaultAccountPayload struct { // The name of the account that is set as the default. @@ -269,7 +393,7 @@ type ErrorResponseModelError struct { // Identity - The Managed Identity of the resource type Identity struct { // Identity Type - Type *Type + Type *ManagedIdentityType // User Assigned Identities UserAssignedIdentities map[string]*UserAssignedIdentity @@ -281,6 +405,69 @@ type Identity struct { TenantID *string } +// IngestionStorage - Ingestion Storage Account Info +type IngestionStorage struct { + // Gets or sets the public network access setting + PublicNetworkAccess *PublicNetworkAccess + + // READ-ONLY; Gets or sets the Id. + ID *string + + // READ-ONLY; Gets or sets the primary endpoint. + PrimaryEndpoint *string +} + +// KafkaConfiguration - The configuration of the event streaming service resource attached to the Purview account for kafka +// notifications. +type KafkaConfiguration struct { + // The kafka configuration properties of the event streaming service attached to the Purview account for kafka notifications. + Properties *KafkaConfigurationProperties + + // READ-ONLY; Gets or sets the identifier. + ID *string + + // READ-ONLY; Gets or sets the name. + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *ProxyResourceSystemData + + // READ-ONLY; Gets or sets the type. + Type *string +} + +// KafkaConfigurationList - Paged list of kafka configuration resources +type KafkaConfigurationList struct { + // REQUIRED; Collection of items of type results. + Value []*KafkaConfiguration + + // The Url of next result page. + NextLink *string +} + +// KafkaConfigurationProperties - The kafka configuration properties of the event streaming service attached to the Purview +// account for kafka notifications. +type KafkaConfigurationProperties struct { + // Consumer group for hook event hub. + ConsumerGroup *string + + // Credentials to access the event streaming service attached to the purview account. + Credentials *Credentials + + // Optional partition Id for notification event hub. If not set, all partitions will be leveraged. + EventHubPartitionID *string + EventHubResourceID *string + + // The event hub type. + EventHubType *EventHubType + + // The state of the event streaming service + EventStreamingState *EventStreamingState + + // The event streaming service type + EventStreamingType *EventStreamingType +} + // ManagedResources - The managed resources in customer subscription. type ManagedResources struct { // READ-ONLY; Gets the managed event hub namespace resource identifier. @@ -296,7 +483,7 @@ type ManagedResources struct { // Operation resource type Operation struct { - // Properties on the operation + // The response model for get operation properties Display *OperationDisplay // Whether operation is a data action @@ -308,7 +495,7 @@ type Operation struct { // origin of the operation Origin *string - // properties for the operation meta info + // properties on meta info Properties *OperationProperties } @@ -402,7 +589,7 @@ type OperationMetaServiceSpecification struct { // OperationProperties - properties on meta info type OperationProperties struct { - // meta service specification + // The operation meta service specification ServiceSpecification *OperationMetaServiceSpecification } @@ -423,6 +610,9 @@ type PrivateEndpointConnection struct { // READ-ONLY; Gets or sets the name. Name *string + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *ProxyResourceSystemData + // READ-ONLY; Gets or sets the type. Type *string } @@ -432,9 +622,6 @@ type PrivateEndpointConnectionList struct { // REQUIRED; Collection of items of type results. Value []*PrivateEndpointConnection - // Total item count. - Count *int64 - // The Url of next result page. NextLink *string } @@ -451,6 +638,24 @@ type PrivateEndpointConnectionProperties struct { ProvisioningState *string } +// PrivateEndpointConnectionStatusUpdateRequest - A private endpoint connection status update request class. +type PrivateEndpointConnectionStatusUpdateRequest struct { + // The private endpoint resource identifier. + PrivateEndpointID *string + + // The private endpoint connection status. + Status *string +} + +// PrivateEndpointConnectionStatusUpdateResponse - A private endpoint connection status update response class. +type PrivateEndpointConnectionStatusUpdateResponse struct { + // The private endpoint resource identifier. + PrivateEndpointID *string + + // The private endpoint connection status. + Status *string +} + // PrivateLinkResource - A privately linkable resource. type PrivateLinkResource struct { // READ-ONLY; The private link resource identifier. @@ -471,9 +676,6 @@ type PrivateLinkResourceList struct { // REQUIRED; Collection of items of type results. Value []*PrivateLinkResource - // Total item count. - Count *int64 - // The Url of next result page. NextLink *string } @@ -499,7 +701,7 @@ type PrivateLinkServiceConnectionState struct { Description *string // The status. - Status *Status + Status *PrivateEndpointConnectionStatus } // ProxyResource - Proxy Azure Resource @@ -510,10 +712,43 @@ type ProxyResource struct { // READ-ONLY; Gets or sets the name. Name *string + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *ProxyResourceSystemData + // READ-ONLY; Gets or sets the type. Type *string } +// ProxyResourceSystemData - Metadata pertaining to creation and last modification of the resource. +type ProxyResourceSystemData struct { + // READ-ONLY; The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // READ-ONLY; The identity that created the resource. + CreatedBy *string + + // READ-ONLY; The type of identity that created the resource. + CreatedByType *CreatedByType + + // READ-ONLY; The timestamp of the last modification the resource (UTC). + LastModifiedAt *time.Time + + // READ-ONLY; The identity that last modified the resource. + LastModifiedBy *string + + // READ-ONLY; The type of identity that last modified the resource. + LastModifiedByType *LastModifiedByType +} + +// QuotaName - Quota name +type QuotaName struct { + // Gets or sets the localized name value. + LocalizedValue *string + + // Gets or sets the name value. + Value *string +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // READ-ONLY; The timestamp of resource creation (UTC). @@ -537,7 +772,7 @@ type SystemData struct { // TrackedResource - Azure ARM Tracked Resource type TrackedResource struct { - // Identity Info on the tracked resource + // The Managed Identity of the resource Identity *Identity // Gets or sets the location. @@ -580,6 +815,42 @@ type TrackedResourceSystemData struct { LastModifiedByType *LastModifiedByType } +// Usage - Response for usage information +type Usage struct { + // READ-ONLY; Current usage quota value + CurrentValue *int32 + + // READ-ONLY; Fully qualified resource Id + ID *string + + // READ-ONLY; Usage quota limit + Limit *int32 + + // READ-ONLY; Quota name + Name *UsageName + + // READ-ONLY; Quota usage unit. + Unit *string +} + +// UsageList - List of usage information +type UsageList struct { + // The Url of next link. + NextLink *string + + // READ-ONLY; Collection of usage values. + Value []*Usage +} + +// UsageName - Quota name +type UsageName struct { + // Gets or sets the localized name value. + LocalizedValue *string + + // Gets or sets the name value. + Value *string +} + // UserAssignedIdentity - Uses client ID and Principal ID type UserAssignedIdentity struct { // READ-ONLY; Gets or Sets Client ID diff --git a/sdk/resourcemanager/purview/armpurview/models_serde.go b/sdk/resourcemanager/purview/armpurview/models_serde.go index 08656ad8a284..278dfee389bb 100644 --- a/sdk/resourcemanager/purview/armpurview/models_serde.go +++ b/sdk/resourcemanager/purview/armpurview/models_serde.go @@ -109,7 +109,6 @@ func (a *Account) UnmarshalJSON(data []byte) error { func (a AccountEndpoints) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "catalog", a.Catalog) - populate(objectMap, "guardian", a.Guardian) populate(objectMap, "scan", a.Scan) return json.Marshal(objectMap) } @@ -126,9 +125,6 @@ func (a *AccountEndpoints) UnmarshalJSON(data []byte) error { case "catalog": err = unpopulate(val, "Catalog", &a.Catalog) delete(rawMsg, key) - case "guardian": - err = unpopulate(val, "Guardian", &a.Guardian) - delete(rawMsg, key) case "scan": err = unpopulate(val, "Scan", &a.Scan) delete(rawMsg, key) @@ -143,7 +139,6 @@ func (a *AccountEndpoints) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AccountList. func (a AccountList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", a.Count) populate(objectMap, "nextLink", a.NextLink) populate(objectMap, "value", a.Value) return json.Marshal(objectMap) @@ -158,9 +153,6 @@ func (a *AccountList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &a.Count) - delete(rawMsg, key) case "nextLink": err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) @@ -175,20 +167,78 @@ func (a *AccountList) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AccountMergeInfo. +func (a AccountMergeInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accountLocation", a.AccountLocation) + populate(objectMap, "accountName", a.AccountName) + populate(objectMap, "accountResourceGroupName", a.AccountResourceGroupName) + populate(objectMap, "accountSubscriptionId", a.AccountSubscriptionID) + populate(objectMap, "deprovisioned", a.Deprovisioned) + populate(objectMap, "mergeStatus", a.MergeStatus) + populate(objectMap, "typeOfAccount", a.TypeOfAccount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountMergeInfo. +func (a *AccountMergeInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accountLocation": + err = unpopulate(val, "AccountLocation", &a.AccountLocation) + delete(rawMsg, key) + case "accountName": + err = unpopulate(val, "AccountName", &a.AccountName) + delete(rawMsg, key) + case "accountResourceGroupName": + err = unpopulate(val, "AccountResourceGroupName", &a.AccountResourceGroupName) + delete(rawMsg, key) + case "accountSubscriptionId": + err = unpopulate(val, "AccountSubscriptionID", &a.AccountSubscriptionID) + delete(rawMsg, key) + case "deprovisioned": + err = unpopulate(val, "Deprovisioned", &a.Deprovisioned) + delete(rawMsg, key) + case "mergeStatus": + err = unpopulate(val, "MergeStatus", &a.MergeStatus) + delete(rawMsg, key) + case "typeOfAccount": + err = unpopulate(val, "TypeOfAccount", &a.TypeOfAccount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AccountProperties. func (a AccountProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "accountStatus", a.AccountStatus) populate(objectMap, "cloudConnectors", a.CloudConnectors) populateDateTimeRFC3339(objectMap, "createdAt", a.CreatedAt) populate(objectMap, "createdBy", a.CreatedBy) populate(objectMap, "createdByObjectId", a.CreatedByObjectID) + populate(objectMap, "defaultDomain", a.DefaultDomain) populate(objectMap, "endpoints", a.Endpoints) populate(objectMap, "friendlyName", a.FriendlyName) + populate(objectMap, "ingestionStorage", a.IngestionStorage) + populate(objectMap, "managedEventHubState", a.ManagedEventHubState) populate(objectMap, "managedResourceGroupName", a.ManagedResourceGroupName) populate(objectMap, "managedResources", a.ManagedResources) + populate(objectMap, "managedResourcesPublicNetworkAccess", a.ManagedResourcesPublicNetworkAccess) + populate(objectMap, "mergeInfo", a.MergeInfo) populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) populate(objectMap, "provisioningState", a.ProvisioningState) populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) + populate(objectMap, "tenantEndpointState", a.TenantEndpointState) return json.Marshal(objectMap) } @@ -201,6 +251,9 @@ func (a *AccountProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "accountStatus": + err = unpopulate(val, "AccountStatus", &a.AccountStatus) + delete(rawMsg, key) case "cloudConnectors": err = unpopulate(val, "CloudConnectors", &a.CloudConnectors) delete(rawMsg, key) @@ -213,18 +266,33 @@ func (a *AccountProperties) UnmarshalJSON(data []byte) error { case "createdByObjectId": err = unpopulate(val, "CreatedByObjectID", &a.CreatedByObjectID) delete(rawMsg, key) + case "defaultDomain": + err = unpopulate(val, "DefaultDomain", &a.DefaultDomain) + delete(rawMsg, key) case "endpoints": err = unpopulate(val, "Endpoints", &a.Endpoints) delete(rawMsg, key) case "friendlyName": err = unpopulate(val, "FriendlyName", &a.FriendlyName) delete(rawMsg, key) + case "ingestionStorage": + err = unpopulate(val, "IngestionStorage", &a.IngestionStorage) + delete(rawMsg, key) + case "managedEventHubState": + err = unpopulate(val, "ManagedEventHubState", &a.ManagedEventHubState) + delete(rawMsg, key) case "managedResourceGroupName": err = unpopulate(val, "ManagedResourceGroupName", &a.ManagedResourceGroupName) delete(rawMsg, key) case "managedResources": err = unpopulate(val, "ManagedResources", &a.ManagedResources) delete(rawMsg, key) + case "managedResourcesPublicNetworkAccess": + err = unpopulate(val, "ManagedResourcesPublicNetworkAccess", &a.ManagedResourcesPublicNetworkAccess) + delete(rawMsg, key) + case "mergeInfo": + err = unpopulate(val, "MergeInfo", &a.MergeInfo) + delete(rawMsg, key) case "privateEndpointConnections": err = unpopulate(val, "PrivateEndpointConnections", &a.PrivateEndpointConnections) delete(rawMsg, key) @@ -234,6 +302,40 @@ func (a *AccountProperties) UnmarshalJSON(data []byte) error { case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &a.PublicNetworkAccess) delete(rawMsg, key) + case "tenantEndpointState": + err = unpopulate(val, "TenantEndpointState", &a.TenantEndpointState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccountPropertiesAccountStatus. +func (a AccountPropertiesAccountStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accountProvisioningState", a.AccountProvisioningState) + populate(objectMap, "errorDetails", a.ErrorDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountPropertiesAccountStatus. +func (a *AccountPropertiesAccountStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accountProvisioningState": + err = unpopulate(val, "AccountProvisioningState", &a.AccountProvisioningState) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &a.ErrorDetails) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -246,7 +348,6 @@ func (a *AccountProperties) UnmarshalJSON(data []byte) error { func (a AccountPropertiesEndpoints) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "catalog", a.Catalog) - populate(objectMap, "guardian", a.Guardian) populate(objectMap, "scan", a.Scan) return json.Marshal(objectMap) } @@ -263,9 +364,6 @@ func (a *AccountPropertiesEndpoints) UnmarshalJSON(data []byte) error { case "catalog": err = unpopulate(val, "Catalog", &a.Catalog) delete(rawMsg, key) - case "guardian": - err = unpopulate(val, "Guardian", &a.Guardian) - delete(rawMsg, key) case "scan": err = unpopulate(val, "Scan", &a.Scan) delete(rawMsg, key) @@ -374,6 +472,76 @@ func (a *AccountSKUAutoGenerated) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AccountStatus. +func (a AccountStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accountProvisioningState", a.AccountProvisioningState) + populate(objectMap, "errorDetails", a.ErrorDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountStatus. +func (a *AccountStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accountProvisioningState": + err = unpopulate(val, "AccountProvisioningState", &a.AccountProvisioningState) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &a.ErrorDetails) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccountStatusErrorDetails. +func (a AccountStatusErrorDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", a.Code) + populate(objectMap, "details", a.Details) + populate(objectMap, "message", a.Message) + populate(objectMap, "target", a.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountStatusErrorDetails. +func (a *AccountStatusErrorDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &a.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &a.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &a.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &a.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AccountUpdateParameters. func (a AccountUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -409,6 +577,60 @@ func (a *AccountUpdateParameters) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type BatchFeatureRequest. +func (b BatchFeatureRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "features", b.Features) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BatchFeatureRequest. +func (b *BatchFeatureRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "features": + err = unpopulate(val, "Features", &b.Features) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BatchFeatureStatus. +func (b BatchFeatureStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "features", b.Features) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BatchFeatureStatus. +func (b *BatchFeatureStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "features": + err = unpopulate(val, "Features", &b.Features) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityRequest. func (c CheckNameAvailabilityRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -529,6 +751,119 @@ func (c *CollectionAdminUpdate) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Consent. +func (c Consent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "kind", c.Kind) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Consent. +func (c *Consent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &c.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConsentProperties. +func (c ConsentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "scope", c.Scope) + populate(objectMap, "scopeType", c.ScopeType) + populate(objectMap, "status", c.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConsentProperties. +func (c *ConsentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "scope": + err = unpopulate(val, "Scope", &c.Scope) + delete(rawMsg, key) + case "scopeType": + err = unpopulate(val, "ScopeType", &c.ScopeType) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Credentials. +func (c Credentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identityId", c.IdentityID) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Credentials. +func (c *Credentials) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identityId": + err = unpopulate(val, "IdentityID", &c.IdentityID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DefaultAccountPayload. func (d DefaultAccountPayload) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -755,6 +1090,166 @@ func (i *Identity) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type IngestionStorage. +func (i IngestionStorage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + populate(objectMap, "primaryEndpoint", i.PrimaryEndpoint) + populate(objectMap, "publicNetworkAccess", i.PublicNetworkAccess) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IngestionStorage. +func (i *IngestionStorage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "primaryEndpoint": + err = unpopulate(val, "PrimaryEndpoint", &i.PrimaryEndpoint) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &i.PublicNetworkAccess) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KafkaConfiguration. +func (k KafkaConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", k.ID) + populate(objectMap, "name", k.Name) + populate(objectMap, "properties", k.Properties) + populate(objectMap, "systemData", k.SystemData) + populate(objectMap, "type", k.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KafkaConfiguration. +func (k *KafkaConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &k.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &k.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &k.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &k.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &k.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KafkaConfigurationList. +func (k KafkaConfigurationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", k.NextLink) + populate(objectMap, "value", k.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KafkaConfigurationList. +func (k *KafkaConfigurationList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &k.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &k.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KafkaConfigurationProperties. +func (k KafkaConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "consumerGroup", k.ConsumerGroup) + populate(objectMap, "credentials", k.Credentials) + populate(objectMap, "eventHubPartitionId", k.EventHubPartitionID) + populate(objectMap, "eventHubResourceId", k.EventHubResourceID) + populate(objectMap, "eventHubType", k.EventHubType) + populate(objectMap, "eventStreamingState", k.EventStreamingState) + populate(objectMap, "eventStreamingType", k.EventStreamingType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KafkaConfigurationProperties. +func (k *KafkaConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "consumerGroup": + err = unpopulate(val, "ConsumerGroup", &k.ConsumerGroup) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &k.Credentials) + delete(rawMsg, key) + case "eventHubPartitionId": + err = unpopulate(val, "EventHubPartitionID", &k.EventHubPartitionID) + delete(rawMsg, key) + case "eventHubResourceId": + err = unpopulate(val, "EventHubResourceID", &k.EventHubResourceID) + delete(rawMsg, key) + case "eventHubType": + err = unpopulate(val, "EventHubType", &k.EventHubType) + delete(rawMsg, key) + case "eventStreamingState": + err = unpopulate(val, "EventStreamingState", &k.EventStreamingState) + delete(rawMsg, key) + case "eventStreamingType": + err = unpopulate(val, "EventStreamingType", &k.EventStreamingType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedResources. func (m ManagedResources) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1104,6 +1599,7 @@ func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } @@ -1126,6 +1622,9 @@ func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -1140,7 +1639,6 @@ func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionList. func (p PrivateEndpointConnectionList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", p.Count) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) @@ -1155,9 +1653,6 @@ func (p *PrivateEndpointConnectionList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &p.Count) - delete(rawMsg, key) case "nextLink": err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) @@ -1207,6 +1702,68 @@ func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionStatusUpdateRequest. +func (p PrivateEndpointConnectionStatusUpdateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpointId", p.PrivateEndpointID) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionStatusUpdateRequest. +func (p *PrivateEndpointConnectionStatusUpdateRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpointId": + err = unpopulate(val, "PrivateEndpointID", &p.PrivateEndpointID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionStatusUpdateResponse. +func (p PrivateEndpointConnectionStatusUpdateResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpointId", p.PrivateEndpointID) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionStatusUpdateResponse. +func (p *PrivateEndpointConnectionStatusUpdateResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpointId": + err = unpopulate(val, "PrivateEndpointID", &p.PrivateEndpointID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1249,7 +1806,6 @@ func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceList. func (p PrivateLinkResourceList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", p.Count) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) @@ -1264,9 +1820,6 @@ func (p *PrivateLinkResourceList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &p.Count) - delete(rawMsg, key) case "nextLink": err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) @@ -1356,6 +1909,7 @@ func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } @@ -1375,6 +1929,9 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -1386,6 +1943,84 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ProxyResourceSystemData. +func (p ProxyResourceSystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", p.CreatedAt) + populate(objectMap, "createdBy", p.CreatedBy) + populate(objectMap, "createdByType", p.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", p.LastModifiedAt) + populate(objectMap, "lastModifiedBy", p.LastModifiedBy) + populate(objectMap, "lastModifiedByType", p.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResourceSystemData. +func (p *ProxyResourceSystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &p.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &p.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &p.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &p.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &p.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &p.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaName. +func (q QuotaName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "localizedValue", q.LocalizedValue) + populate(objectMap, "value", q.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaName. +func (q *QuotaName) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &q.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &q.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1531,6 +2166,111 @@ func (t *TrackedResourceSystemData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Usage. +func (u Usage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "currentValue", u.CurrentValue) + populate(objectMap, "id", u.ID) + populate(objectMap, "limit", u.Limit) + populate(objectMap, "name", u.Name) + populate(objectMap, "unit", u.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Usage. +func (u *Usage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentValue": + err = unpopulate(val, "CurrentValue", &u.CurrentValue) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &u.ID) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &u.Limit) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &u.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UsageList. +func (u UsageList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UsageList. +func (u *UsageList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &u.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &u.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UsageName. +func (u UsageName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "localizedValue", u.LocalizedValue) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UsageName. +func (u *UsageName) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &u.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &u.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1573,7 +2313,7 @@ func populate(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/purview/armpurview/operations_client.go b/sdk/resourcemanager/purview/armpurview/operations_client.go index 778bd4160aa9..4a7fa2d6e8af 100644 --- a/sdk/resourcemanager/purview/armpurview/operations_client.go +++ b/sdk/resourcemanager/purview/armpurview/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List of available operations // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/purview/armpurview/operations_client_example_test.go b/sdk/resourcemanager/purview/armpurview/operations_client_example_test.go deleted file mode 100644 index 2ea340b3ee13..000000000000 --- a/sdk/resourcemanager/purview/armpurview/operations_client_example_test.go +++ /dev/null @@ -1,100 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armpurview_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/Operations_List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationList = armpurview.OperationList{ - // Value: []*armpurview.Operation{ - // { - // Name: to.Ptr("Microsoft.Purview/operations/read"), - // Display: &armpurview.OperationDisplay{ - // Description: to.Ptr("Reads all available operations in Purview Resource Provider."), - // Operation: to.Ptr("Read all operations"), - // Provider: to.Ptr("Microsoft Purview"), - // Resource: to.Ptr("Operations"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Purview/register/action"), - // Display: &armpurview.OperationDisplay{ - // Description: to.Ptr("Register the subscription for Purview Resource Provider"), - // Operation: to.Ptr("Register Purview Resource Provider"), - // Provider: to.Ptr("Microsoft Purview"), - // Resource: to.Ptr("Purview Resource Provider"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Purview/unregister/action"), - // Display: &armpurview.OperationDisplay{ - // Description: to.Ptr("Unregister the subscription for Purview Resource Provider"), - // Operation: to.Ptr("Unregister Purview Resource Provider"), - // Provider: to.Ptr("Microsoft Purview"), - // Resource: to.Ptr("Purview Resource Provider"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Purview/accounts/read"), - // Display: &armpurview.OperationDisplay{ - // Description: to.Ptr("Read account resource for Purview Resource Provider."), - // Operation: to.Ptr("Read account resource"), - // Provider: to.Ptr("Microsoft Purview"), - // Resource: to.Ptr("Account"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Purview/accounts/write"), - // Display: &armpurview.OperationDisplay{ - // Description: to.Ptr("Write account resource for Purview Resource Provider."), - // Operation: to.Ptr("Write account resource"), - // Provider: to.Ptr("Microsoft Purview"), - // Resource: to.Ptr("Account"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Purview/accounts/delete"), - // Display: &armpurview.OperationDisplay{ - // Description: to.Ptr("Delete account resource for Purview Resource Provider."), - // Operation: to.Ptr("Delete account resource"), - // Provider: to.Ptr("Microsoft Purview"), - // Resource: to.Ptr("Account"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/purview/armpurview/options.go b/sdk/resourcemanager/purview/armpurview/options.go index 872975e5c6d1..102fefc740b4 100644 --- a/sdk/resourcemanager/purview/armpurview/options.go +++ b/sdk/resourcemanager/purview/armpurview/options.go @@ -79,6 +79,51 @@ type DefaultAccountsClientSetOptions struct { // placeholder for future optional parameters } +// FeaturesClientAccountGetOptions contains the optional parameters for the FeaturesClient.AccountGet method. +type FeaturesClientAccountGetOptions struct { + // placeholder for future optional parameters +} + +// FeaturesClientSubscriptionGetOptions contains the optional parameters for the FeaturesClient.SubscriptionGet method. +type FeaturesClientSubscriptionGetOptions struct { + // placeholder for future optional parameters +} + +// IngestionPrivateEndpointConnectionsClientListOptions contains the optional parameters for the IngestionPrivateEndpointConnectionsClient.NewListPager +// method. +type IngestionPrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// IngestionPrivateEndpointConnectionsClientUpdateStatusOptions contains the optional parameters for the IngestionPrivateEndpointConnectionsClient.UpdateStatus +// method. +type IngestionPrivateEndpointConnectionsClientUpdateStatusOptions struct { + // placeholder for future optional parameters +} + +// KafkaConfigurationsClientCreateOrUpdateOptions contains the optional parameters for the KafkaConfigurationsClient.CreateOrUpdate +// method. +type KafkaConfigurationsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// KafkaConfigurationsClientDeleteOptions contains the optional parameters for the KafkaConfigurationsClient.Delete method. +type KafkaConfigurationsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// KafkaConfigurationsClientGetOptions contains the optional parameters for the KafkaConfigurationsClient.Get method. +type KafkaConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// KafkaConfigurationsClientListByAccountOptions contains the optional parameters for the KafkaConfigurationsClient.NewListByAccountPager +// method. +type KafkaConfigurationsClientListByAccountOptions struct { + // The skip token. + SkipToken *string +} + // OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters @@ -122,3 +167,9 @@ type PrivateLinkResourcesClientGetByGroupIDOptions struct { type PrivateLinkResourcesClientListByAccountOptions struct { // placeholder for future optional parameters } + +// UsagesClientGetOptions contains the optional parameters for the UsagesClient.Get method. +type UsagesClientGetOptions struct { + // The filter, currently unused. + Filter *string +} diff --git a/sdk/resourcemanager/purview/armpurview/privateendpointconnections_client.go b/sdk/resourcemanager/purview/armpurview/privateendpointconnections_client.go index 54ea4441380a..1e1e3d4ad51d 100644 --- a/sdk/resourcemanager/purview/armpurview/privateendpointconnections_client.go +++ b/sdk/resourcemanager/purview/armpurview/privateendpointconnections_client.go @@ -46,7 +46,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Create or update a private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - resourceGroupName - The resource group name. // - accountName - The name of the account. // - privateEndpointConnectionName - Name of the private endpoint connection. @@ -73,7 +73,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Create or update a private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, request PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" @@ -119,7 +119,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, request); err != nil { @@ -131,7 +131,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Delete a private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - resourceGroupName - The resource group name. // - accountName - The name of the account. // - privateEndpointConnectionName - Name of the private endpoint connection. @@ -157,7 +157,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Delete a private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -203,7 +203,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,7 +212,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Get a private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - resourceGroupName - The resource group name. // - accountName - The name of the account. // - privateEndpointConnectionName - Name of the private endpoint connection. @@ -264,7 +264,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,7 +281,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByAccountPager - Get private endpoint connections for account // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - resourceGroupName - The resource group name. // - accountName - The name of the account. // - options - PrivateEndpointConnectionsClientListByAccountOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByAccountPager @@ -329,10 +329,10 @@ func (client *PrivateEndpointConnectionsClient) listByAccountCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/purview/armpurview/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/purview/armpurview/privateendpointconnections_client_example_test.go deleted file mode 100644 index 3a1a8506252e..000000000000 --- a/sdk/resourcemanager/purview/armpurview/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,179 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armpurview_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/PrivateEndpointConnections_ListByAccount.json -func ExamplePrivateEndpointConnectionsClient_NewListByAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListByAccountPager("SampleResourceGroup", "account1", &armpurview.PrivateEndpointConnectionsClientListByAccountOptions{SkipToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointConnectionList = armpurview.PrivateEndpointConnectionList{ - // Value: []*armpurview.PrivateEndpointConnection{ - // { - // Name: to.Ptr("privateEndpointConnection1"), - // Type: to.Ptr("Microsoft.Purview/accounts/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateEndpointConnections/privateEndpointConnection1"), - // Properties: &armpurview.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armpurview.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint1"), - // }, - // PrivateLinkServiceConnectionState: &armpurview.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Approved by johndoe@company.com"), - // Status: to.Ptr(armpurview.StatusApproved), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }, - // { - // Name: to.Ptr("privateEndpointConnection2"), - // Type: to.Ptr("Microsoft.Purview/accounts/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateEndpointConnections/privateEndpointConnection2"), - // Properties: &armpurview.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armpurview.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armpurview.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Rejected by johndoe@company.com"), - // Status: to.Ptr(armpurview.StatusRejected), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/PrivateEndpointConnections_Get.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "SampleResourceGroup", "account1", "privateEndpointConnection1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armpurview.PrivateEndpointConnection{ - // Name: to.Ptr("privateEndpointConnection1"), - // Type: to.Ptr("Microsoft.Purview/accounts/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateEndpointConnections/privateEndpointConnection1"), - // Properties: &armpurview.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armpurview.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armpurview.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Approved by johndoe@company.com"), - // Status: to.Ptr(armpurview.StatusApproved), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/PrivateEndpointConnections_CreateOrUpdate.json -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreateOrUpdate(ctx, "SampleResourceGroup", "account1", "privateEndpointConnection1", armpurview.PrivateEndpointConnection{ - Properties: &armpurview.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armpurview.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Approved by johndoe@company.com"), - Status: to.Ptr(armpurview.StatusApproved), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armpurview.PrivateEndpointConnection{ - // Name: to.Ptr("privateEndpointConnection1"), - // Type: to.Ptr("Microsoft.Purview/accounts/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateEndpointConnections/privateEndpointConnection1"), - // Properties: &armpurview.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armpurview.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-12345678abc/resourceGroups/SampleResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armpurview.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Approved by johndoe@company.com"), - // Status: to.Ptr(armpurview.StatusApproved), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/PrivateEndpointConnections_Delete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "SampleResourceGroup", "account1", "privateEndpointConnection1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/purview/armpurview/privatelinkresources_client.go b/sdk/resourcemanager/purview/armpurview/privatelinkresources_client.go index 0d7feea4c2a0..2e60b061e127 100644 --- a/sdk/resourcemanager/purview/armpurview/privatelinkresources_client.go +++ b/sdk/resourcemanager/purview/armpurview/privatelinkresources_client.go @@ -46,7 +46,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // GetByGroupID - Gets a privately linkable resources for an account with given group identifier // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - resourceGroupName - The resource group name. // - accountName - The name of the account. // - groupID - The group identifier. @@ -98,7 +98,7 @@ func (client *PrivateLinkResourcesClient) getByGroupIDCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -115,7 +115,7 @@ func (client *PrivateLinkResourcesClient) getByGroupIDHandleResponse(resp *http. // NewListByAccountPager - Gets a list of privately linkable resources for an account // -// Generated from API version 2021-07-01 +// Generated from API version 2024-04-01-preview // - resourceGroupName - The resource group name. // - accountName - The name of the account. // - options - PrivateLinkResourcesClientListByAccountOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByAccountPager @@ -163,7 +163,7 @@ func (client *PrivateLinkResourcesClient) listByAccountCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2024-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/purview/armpurview/privatelinkresources_client_example_test.go b/sdk/resourcemanager/purview/armpurview/privatelinkresources_client_example_test.go deleted file mode 100644 index 9bf461cffabc..000000000000 --- a/sdk/resourcemanager/purview/armpurview/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,102 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armpurview_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/purview/armpurview" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/PrivateLinkResources_ListByAccount.json -func ExamplePrivateLinkResourcesClient_NewListByAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkResourcesClient().NewListByAccountPager("SampleResourceGroup", "account1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateLinkResourceList = armpurview.PrivateLinkResourceList{ - // Value: []*armpurview.PrivateLinkResource{ - // { - // Name: to.Ptr("plr1"), - // Type: to.Ptr("Microsoft.Purview/accounts/privateLinkResources"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateLinkResources/plr1"), - // Properties: &armpurview.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("account1"), - // RequiredMembers: []*string{ - // to.Ptr("account1")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelinkzone1.service.azure.com")}, - // }, - // }, - // { - // Name: to.Ptr("plr2"), - // Type: to.Ptr("Microsoft.Purview/accounts/privateLinkResources"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateLinkResources/plr2"), - // Properties: &armpurview.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("account2"), - // RequiredMembers: []*string{ - // to.Ptr("account2")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelinkzone2.service.azure.com")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/purview/resource-manager/Microsoft.Purview/stable/2021-07-01/examples/PrivateLinkResources_GetByGroupId.json -func ExamplePrivateLinkResourcesClient_GetByGroupID() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armpurview.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().GetByGroupID(ctx, "SampleResourceGroup", "account1", "group1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResource = armpurview.PrivateLinkResource{ - // Name: to.Ptr("plr1"), - // Type: to.Ptr("Microsoft.Purview/accounts/privateLinkResources"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/SampleResourceGroup/providers/Microsoft.Purview/accounts/account1/privateLinkResources/plr1"), - // Properties: &armpurview.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("group1"), - // RequiredMembers: []*string{ - // to.Ptr("group1")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelinkzone1.service.azure.com")}, - // }, - // } -} diff --git a/sdk/resourcemanager/purview/armpurview/response_types.go b/sdk/resourcemanager/purview/armpurview/responses.go similarity index 64% rename from sdk/resourcemanager/purview/armpurview/response_types.go rename to sdk/resourcemanager/purview/armpurview/responses.go index 33e9b09092c9..aae582241fe3 100644 --- a/sdk/resourcemanager/purview/armpurview/response_types.go +++ b/sdk/resourcemanager/purview/armpurview/responses.go @@ -38,19 +38,19 @@ type AccountsClientGetResponse struct { // AccountsClientListByResourceGroupResponse contains the response from method AccountsClient.NewListByResourceGroupPager. type AccountsClientListByResourceGroupResponse struct { - // Paged list of account resources + // Paged list of Account resources AccountList } // AccountsClientListBySubscriptionResponse contains the response from method AccountsClient.NewListBySubscriptionPager. type AccountsClientListBySubscriptionResponse struct { - // Paged list of account resources + // Paged list of Account resources AccountList } // AccountsClientListKeysResponse contains the response from method AccountsClient.ListKeys. type AccountsClientListKeysResponse struct { - // The Account access keys. + // The Purview Account access keys. AccessKeys } @@ -77,6 +77,53 @@ type DefaultAccountsClientSetResponse struct { DefaultAccountPayload } +// FeaturesClientAccountGetResponse contains the response from method FeaturesClient.AccountGet. +type FeaturesClientAccountGetResponse struct { + // List of features with enabled status + BatchFeatureStatus +} + +// FeaturesClientSubscriptionGetResponse contains the response from method FeaturesClient.SubscriptionGet. +type FeaturesClientSubscriptionGetResponse struct { + // List of features with enabled status + BatchFeatureStatus +} + +// IngestionPrivateEndpointConnectionsClientListResponse contains the response from method IngestionPrivateEndpointConnectionsClient.NewListPager. +type IngestionPrivateEndpointConnectionsClientListResponse struct { + // Paged list of private endpoint connections + PrivateEndpointConnectionList +} + +// IngestionPrivateEndpointConnectionsClientUpdateStatusResponse contains the response from method IngestionPrivateEndpointConnectionsClient.UpdateStatus. +type IngestionPrivateEndpointConnectionsClientUpdateStatusResponse struct { + // A private endpoint connection status update response class. + PrivateEndpointConnectionStatusUpdateResponse +} + +// KafkaConfigurationsClientCreateOrUpdateResponse contains the response from method KafkaConfigurationsClient.CreateOrUpdate. +type KafkaConfigurationsClientCreateOrUpdateResponse struct { + // The configuration of the event streaming service resource attached to the Purview account for kafka notifications. + KafkaConfiguration +} + +// KafkaConfigurationsClientDeleteResponse contains the response from method KafkaConfigurationsClient.Delete. +type KafkaConfigurationsClientDeleteResponse struct { + // placeholder for future response values +} + +// KafkaConfigurationsClientGetResponse contains the response from method KafkaConfigurationsClient.Get. +type KafkaConfigurationsClientGetResponse struct { + // The configuration of the event streaming service resource attached to the Purview account for kafka notifications. + KafkaConfiguration +} + +// KafkaConfigurationsClientListByAccountResponse contains the response from method KafkaConfigurationsClient.NewListByAccountPager. +type KafkaConfigurationsClientListByAccountResponse struct { + // Paged list of kafka configuration resources + KafkaConfigurationList +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { // Paged list of operation resources @@ -117,3 +164,9 @@ type PrivateLinkResourcesClientListByAccountResponse struct { // Paged list of private link resources PrivateLinkResourceList } + +// UsagesClientGetResponse contains the response from method UsagesClient.Get. +type UsagesClientGetResponse struct { + // List of usage information + UsageList +} diff --git a/sdk/resourcemanager/purview/armpurview/time_rfc3339.go b/sdk/resourcemanager/purview/armpurview/time_rfc3339.go index cef4c8b49a2e..b3a94876b6b7 100644 --- a/sdk/resourcemanager/purview/armpurview/time_rfc3339.go +++ b/sdk/resourcemanager/purview/armpurview/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/purview/armpurview/usages_client.go b/sdk/resourcemanager/purview/armpurview/usages_client.go new file mode 100644 index 000000000000..52b9f2f1b1c1 --- /dev/null +++ b/sdk/resourcemanager/purview/armpurview/usages_client.go @@ -0,0 +1,106 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armpurview + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// UsagesClient contains the methods for the Usages group. +// Don't use this type directly, use NewUsagesClient() instead. +type UsagesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewUsagesClient creates a new instance of UsagesClient with the specified values. +// - subscriptionID - The subscription identifier +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsagesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &UsagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get the usage quota configuration +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-04-01-preview +// - location - The region. +// - options - UsagesClientGetOptions contains the optional parameters for the UsagesClient.Get method. +func (client *UsagesClient) Get(ctx context.Context, location string, options *UsagesClientGetOptions) (UsagesClientGetResponse, error) { + var err error + const operationName = "UsagesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, options) + if err != nil { + return UsagesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UsagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UsagesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *UsagesClient) getCreateRequest(ctx context.Context, location string, options *UsagesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Purview/locations/{location}/usages" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2024-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *UsagesClient) getHandleResponse(resp *http.Response) (UsagesClientGetResponse, error) { + result := UsagesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UsageList); err != nil { + return UsagesClientGetResponse{}, err + } + return result, nil +}