diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md b/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md index 14759c10e004..c6308dbca37f 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md @@ -1,5 +1,90 @@ # Release History +## 0.7.0 (2023-04-18) +### Features Added + +- New value `ArcSQLServerLicenseTypeLicenseOnly`, `ArcSQLServerLicenseTypePAYG`, `ArcSQLServerLicenseTypeServerCAL` added to enum type `ArcSQLServerLicenseType` +- New value `EditionTypeBusinessIntelligence` added to enum type `EditionType` +- New value `HostTypeAWSKubernetesService`, `HostTypeAWSVMWareVirtualMachine`, `HostTypeAzureKubernetesService`, `HostTypeAzureVMWareVirtualMachine`, `HostTypeAzureVirtualMachine`, `HostTypeContainer`, `HostTypeGCPKubernetesService`, `HostTypeGCPVMWareVirtualMachine` added to enum type `HostType` +- New enum type `DatabaseState` with values `DatabaseStateCopying`, `DatabaseStateEmergency`, `DatabaseStateOffline`, `DatabaseStateOfflineSecondary`, `DatabaseStateOnline`, `DatabaseStateRecovering`, `DatabaseStateRecoveryPending`, `DatabaseStateRestoring`, `DatabaseStateSuspect` +- New enum type `FailoverGroupPartnerSyncMode` with values `FailoverGroupPartnerSyncModeAsync`, `FailoverGroupPartnerSyncModeSync` +- New enum type `InstanceFailoverGroupRole` with values `InstanceFailoverGroupRoleForcePrimaryAllowDataLoss`, `InstanceFailoverGroupRoleForceSecondary`, `InstanceFailoverGroupRolePrimary`, `InstanceFailoverGroupRoleSecondary` +- New enum type `ProvisioningState` with values `ProvisioningStateAccepted`, `ProvisioningStateCanceled`, `ProvisioningStateFailed`, `ProvisioningStateSucceeded` +- New enum type `RecoveryMode` with values `RecoveryModeBulkLogged`, `RecoveryModeFull`, `RecoveryModeSimple` +- New function `*ClientFactory.NewFailoverGroupsClient() *FailoverGroupsClient` +- New function `*ClientFactory.NewSQLAvailabilityGroupDatabasesClient() *SQLAvailabilityGroupDatabasesClient` +- New function `*ClientFactory.NewSQLAvailabilityGroupReplicasClient() *SQLAvailabilityGroupReplicasClient` +- New function `*ClientFactory.NewSQLAvailabilityGroupsClient() *SQLAvailabilityGroupsClient` +- New function `*ClientFactory.NewSQLServerAvailabilityGroupsClient() *SQLServerAvailabilityGroupsClient` +- New function `*ClientFactory.NewSQLServerDatabasesClient() *SQLServerDatabasesClient` +- New function `NewFailoverGroupsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*FailoverGroupsClient, error)` +- New function `*FailoverGroupsClient.BeginCreate(context.Context, string, string, string, FailoverGroupResource, *FailoverGroupsClientBeginCreateOptions) (*runtime.Poller[FailoverGroupsClientCreateResponse], error)` +- New function `*FailoverGroupsClient.BeginDelete(context.Context, string, string, string, *FailoverGroupsClientBeginDeleteOptions) (*runtime.Poller[FailoverGroupsClientDeleteResponse], error)` +- New function `*FailoverGroupsClient.Get(context.Context, string, string, string, *FailoverGroupsClientGetOptions) (FailoverGroupsClientGetResponse, error)` +- New function `*FailoverGroupsClient.NewListPager(string, string, *FailoverGroupsClientListOptions) *runtime.Pager[FailoverGroupsClientListResponse]` +- New function `NewSQLAvailabilityGroupDatabasesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SQLAvailabilityGroupDatabasesClient, error)` +- New function `*SQLAvailabilityGroupDatabasesClient.Create(context.Context, string, string, string, SQLAvailabilityGroupDatabaseResource, *SQLAvailabilityGroupDatabasesClientCreateOptions) (SQLAvailabilityGroupDatabasesClientCreateResponse, error)` +- New function `*SQLAvailabilityGroupDatabasesClient.Delete(context.Context, string, string, string, *SQLAvailabilityGroupDatabasesClientDeleteOptions) (SQLAvailabilityGroupDatabasesClientDeleteResponse, error)` +- New function `*SQLAvailabilityGroupDatabasesClient.Get(context.Context, string, string, string, *SQLAvailabilityGroupDatabasesClientGetOptions) (SQLAvailabilityGroupDatabasesClientGetResponse, error)` +- New function `*SQLAvailabilityGroupDatabasesClient.NewListPager(string, string, *SQLAvailabilityGroupDatabasesClientListOptions) *runtime.Pager[SQLAvailabilityGroupDatabasesClientListResponse]` +- New function `*SQLAvailabilityGroupDatabasesClient.Update(context.Context, string, string, string, SQLAvailabilityGroupDatabaseUpdate, *SQLAvailabilityGroupDatabasesClientUpdateOptions) (SQLAvailabilityGroupDatabasesClientUpdateResponse, error)` +- New function `NewSQLAvailabilityGroupReplicasClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SQLAvailabilityGroupReplicasClient, error)` +- New function `*SQLAvailabilityGroupReplicasClient.Create(context.Context, string, string, string, SQLAvailabilityGroupReplicaResource, *SQLAvailabilityGroupReplicasClientCreateOptions) (SQLAvailabilityGroupReplicasClientCreateResponse, error)` +- New function `*SQLAvailabilityGroupReplicasClient.Delete(context.Context, string, string, string, *SQLAvailabilityGroupReplicasClientDeleteOptions) (SQLAvailabilityGroupReplicasClientDeleteResponse, error)` +- New function `*SQLAvailabilityGroupReplicasClient.Get(context.Context, string, string, string, *SQLAvailabilityGroupReplicasClientGetOptions) (SQLAvailabilityGroupReplicasClientGetResponse, error)` +- New function `*SQLAvailabilityGroupReplicasClient.NewListPager(string, string, *SQLAvailabilityGroupReplicasClientListOptions) *runtime.Pager[SQLAvailabilityGroupReplicasClientListResponse]` +- New function `*SQLAvailabilityGroupReplicasClient.Update(context.Context, string, string, string, SQLAvailabilityGroupReplicaUpdate, *SQLAvailabilityGroupReplicasClientUpdateOptions) (SQLAvailabilityGroupReplicasClientUpdateResponse, error)` +- New function `NewSQLAvailabilityGroupsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SQLAvailabilityGroupsClient, error)` +- New function `*SQLAvailabilityGroupsClient.BeginCreate(context.Context, string, string, SQLAvailabilityGroup, *SQLAvailabilityGroupsClientBeginCreateOptions) (*runtime.Poller[SQLAvailabilityGroupsClientCreateResponse], error)` +- New function `*SQLAvailabilityGroupsClient.BeginDelete(context.Context, string, string, *SQLAvailabilityGroupsClientBeginDeleteOptions) (*runtime.Poller[SQLAvailabilityGroupsClientDeleteResponse], error)` +- New function `*SQLAvailabilityGroupsClient.Get(context.Context, string, string, *SQLAvailabilityGroupsClientGetOptions) (SQLAvailabilityGroupsClientGetResponse, error)` +- New function `*SQLAvailabilityGroupsClient.NewListByResourceGroupPager(string, *SQLAvailabilityGroupsClientListByResourceGroupOptions) *runtime.Pager[SQLAvailabilityGroupsClientListByResourceGroupResponse]` +- New function `*SQLAvailabilityGroupsClient.NewListPager(*SQLAvailabilityGroupsClientListOptions) *runtime.Pager[SQLAvailabilityGroupsClientListResponse]` +- New function `*SQLAvailabilityGroupsClient.Update(context.Context, string, string, SQLAvailabilityGroupUpdate, *SQLAvailabilityGroupsClientUpdateOptions) (SQLAvailabilityGroupsClientUpdateResponse, error)` +- New function `NewSQLServerAvailabilityGroupsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SQLServerAvailabilityGroupsClient, error)` +- New function `*SQLServerAvailabilityGroupsClient.Create(context.Context, string, string, string, SQLServerAvailabilityGroupResource, *SQLServerAvailabilityGroupsClientCreateOptions) (SQLServerAvailabilityGroupsClientCreateResponse, error)` +- New function `*SQLServerAvailabilityGroupsClient.Delete(context.Context, string, string, string, *SQLServerAvailabilityGroupsClientDeleteOptions) (SQLServerAvailabilityGroupsClientDeleteResponse, error)` +- New function `*SQLServerAvailabilityGroupsClient.Get(context.Context, string, string, string, *SQLServerAvailabilityGroupsClientGetOptions) (SQLServerAvailabilityGroupsClientGetResponse, error)` +- New function `*SQLServerAvailabilityGroupsClient.NewListPager(string, string, *SQLServerAvailabilityGroupsClientListOptions) *runtime.Pager[SQLServerAvailabilityGroupsClientListResponse]` +- New function `*SQLServerAvailabilityGroupsClient.Update(context.Context, string, string, string, SQLServerAvailabilityGroupUpdate, *SQLServerAvailabilityGroupsClientUpdateOptions) (SQLServerAvailabilityGroupsClientUpdateResponse, error)` +- New function `NewSQLServerDatabasesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SQLServerDatabasesClient, error)` +- New function `*SQLServerDatabasesClient.Create(context.Context, string, string, string, SQLServerDatabaseResource, *SQLServerDatabasesClientCreateOptions) (SQLServerDatabasesClientCreateResponse, error)` +- New function `*SQLServerDatabasesClient.Delete(context.Context, string, string, string, *SQLServerDatabasesClientDeleteOptions) (SQLServerDatabasesClientDeleteResponse, error)` +- New function `*SQLServerDatabasesClient.Get(context.Context, string, string, string, *SQLServerDatabasesClientGetOptions) (SQLServerDatabasesClientGetResponse, error)` +- New function `*SQLServerDatabasesClient.NewListPager(string, string, *SQLServerDatabasesClientListOptions) *runtime.Pager[SQLServerDatabasesClientListResponse]` +- New function `*SQLServerDatabasesClient.Update(context.Context, string, string, string, SQLServerDatabaseUpdate, *SQLServerDatabasesClientUpdateOptions) (SQLServerDatabasesClientUpdateResponse, error)` +- New struct `ArcSQLAvailabilityGroupDatabasesListResult` +- New struct `ArcSQLAvailabilityGroupReplicaListResult` +- New struct `ArcSQLServerAvailabilityGroupListResult` +- New struct `ArcSQLServerDatabaseListResult` +- New struct `AvailabilityGroupConfigure` +- New struct `AvailabilityGroupState` +- New struct `FailoverGroupListResult` +- New struct `FailoverGroupProperties` +- New struct `FailoverGroupResource` +- New struct `FailoverGroupSpec` +- New struct `SQLAvailabilityGroup` +- New struct `SQLAvailabilityGroupDatabaseReplicaResourceProperties` +- New struct `SQLAvailabilityGroupDatabaseResource` +- New struct `SQLAvailabilityGroupDatabaseUpdate` +- New struct `SQLAvailabilityGroupListResult` +- New struct `SQLAvailabilityGroupMultiDatabaseReplicaResourceProperties` +- New struct `SQLAvailabilityGroupProperties` +- New struct `SQLAvailabilityGroupReplicaResource` +- New struct `SQLAvailabilityGroupReplicaResourceProperties` +- New struct `SQLAvailabilityGroupReplicaUpdate` +- New struct `SQLAvailabilityGroupUpdate` +- New struct `SQLServerAvailabilityGroupResource` +- New struct `SQLServerAvailabilityGroupResourceProperties` +- New struct `SQLServerAvailabilityGroupUpdate` +- New struct `SQLServerDatabaseResource` +- New struct `SQLServerDatabaseResourceProperties` +- New struct `SQLServerDatabaseResourcePropertiesBackupInformation` +- New struct `SQLServerDatabaseResourcePropertiesDatabaseOptions` +- New struct `SQLServerDatabaseUpdate` +- New field `Cores` in struct `SQLServerInstanceProperties` + + ## 0.6.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/activedirectoryconnectors_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/activedirectoryconnectors_client.go index 7b83fbd237d2..0d8dfa8e5e31 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/activedirectoryconnectors_client.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/activedirectoryconnectors_client.go @@ -47,7 +47,7 @@ func NewActiveDirectoryConnectorsClient(subscriptionID string, credential azcore // BeginCreate - Creates or replaces an Active Directory connector resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - dataControllerName - The name of the data controller // - activeDirectoryConnectorName - The name of the Active Directory connector instance @@ -71,7 +71,7 @@ func (client *ActiveDirectoryConnectorsClient) BeginCreate(ctx context.Context, // Create - Creates or replaces an Active Directory connector resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview func (client *ActiveDirectoryConnectorsClient) create(ctx context.Context, resourceGroupName string, dataControllerName string, activeDirectoryConnectorName string, activeDirectoryConnectorResource ActiveDirectoryConnectorResource, options *ActiveDirectoryConnectorsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, dataControllerName, activeDirectoryConnectorName, activeDirectoryConnectorResource, options) if err != nil { @@ -111,7 +111,7 @@ func (client *ActiveDirectoryConnectorsClient) createCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, activeDirectoryConnectorResource) @@ -120,7 +120,7 @@ func (client *ActiveDirectoryConnectorsClient) createCreateRequest(ctx context.C // BeginDelete - Deletes an Active Directory connector resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - dataControllerName - The name of the data controller // - activeDirectoryConnectorName - The name of the Active Directory connector instance @@ -141,7 +141,7 @@ func (client *ActiveDirectoryConnectorsClient) BeginDelete(ctx context.Context, // Delete - Deletes an Active Directory connector resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview func (client *ActiveDirectoryConnectorsClient) deleteOperation(ctx context.Context, resourceGroupName string, dataControllerName string, activeDirectoryConnectorName string, options *ActiveDirectoryConnectorsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, dataControllerName, activeDirectoryConnectorName, options) if err != nil { @@ -181,7 +181,7 @@ func (client *ActiveDirectoryConnectorsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -190,7 +190,7 @@ func (client *ActiveDirectoryConnectorsClient) deleteCreateRequest(ctx context.C // Get - Retrieves an Active Directory connector resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - dataControllerName - The name of the data controller // - activeDirectoryConnectorName - The name of the Active Directory connector instance @@ -235,7 +235,7 @@ func (client *ActiveDirectoryConnectorsClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,7 +252,7 @@ func (client *ActiveDirectoryConnectorsClient) getHandleResponse(resp *http.Resp // NewListPager - List the active directory connectors associated with the given data controller. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - dataControllerName - The name of the data controller // - options - ActiveDirectoryConnectorsClientListOptions contains the optional parameters for the ActiveDirectoryConnectorsClient.NewListPager @@ -305,7 +305,7 @@ func (client *ActiveDirectoryConnectorsClient) listCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/activedirectoryconnectors_client_example_test.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/activedirectoryconnectors_client_example_test.go deleted file mode 100644 index 28ba901ecbc5..000000000000 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/activedirectoryconnectors_client_example_test.go +++ /dev/null @@ -1,308 +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 armazurearcdata_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/azurearcdata/armazurearcdata" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListByDataControllerActiveDirectoryConnector.json -func ExampleActiveDirectoryConnectorsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActiveDirectoryConnectorsClient().NewListPager("testrg", "testdataController", 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.ActiveDirectoryConnectorListResult = armazurearcdata.ActiveDirectoryConnectorListResult{ - // Value: []*armazurearcdata.ActiveDirectoryConnectorResource{ - // { - // Name: to.Ptr("testADConnector1"), - // Type: to.Ptr("Microsoft.AzureArcData/dataControllers/activeDirectoryConnectors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/dataControllers/testdataController/activeDirectoryConnectors/testADConnector1"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Properties: &armazurearcdata.ActiveDirectoryConnectorProperties{ - // Spec: &armazurearcdata.ActiveDirectoryConnectorSpec{ - // ActiveDirectory: &armazurearcdata.ActiveDirectoryConnectorDomainDetails{ - // DomainControllers: &armazurearcdata.ActiveDirectoryDomainControllers{ - // PrimaryDomainController: &armazurearcdata.ActiveDirectoryDomainController{ - // Hostname: to.Ptr("dc1.contoso.local"), - // }, - // SecondaryDomainControllers: []*armazurearcdata.ActiveDirectoryDomainController{ - // { - // Hostname: to.Ptr("dc2.contoso.local"), - // }, - // { - // Hostname: to.Ptr("dc3.contoso.local"), - // }}, - // }, - // NetbiosDomainName: to.Ptr("CONTOSO"), - // Realm: to.Ptr("CONTOSO.LOCAL"), - // ServiceAccountProvisioning: to.Ptr(armazurearcdata.AccountProvisioningModeManual), - // }, - // DNS: &armazurearcdata.ActiveDirectoryConnectorDNSDetails{ - // DomainName: to.Ptr("contoso.local"), - // NameserverIPAddresses: []*string{ - // to.Ptr("11.11.111.111"), - // to.Ptr("22.22.222.222")}, - // PreferK8SDNSForPtrLookups: to.Ptr(false), - // Replicas: to.Ptr[int64](1), - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("testADConnector2"), - // Type: to.Ptr("Microsoft.AzureArcData/dataControllers/activeDirectoryConnectors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/dataControllers/testdataController/activeDirectoryConnectors/testADConnector2"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Properties: &armazurearcdata.ActiveDirectoryConnectorProperties{ - // Spec: &armazurearcdata.ActiveDirectoryConnectorSpec{ - // ActiveDirectory: &armazurearcdata.ActiveDirectoryConnectorDomainDetails{ - // DomainControllers: &armazurearcdata.ActiveDirectoryDomainControllers{ - // PrimaryDomainController: &armazurearcdata.ActiveDirectoryDomainController{ - // Hostname: to.Ptr("dc4.contoso.local"), - // }, - // SecondaryDomainControllers: []*armazurearcdata.ActiveDirectoryDomainController{ - // { - // Hostname: to.Ptr("dc5.contoso.local"), - // }, - // { - // Hostname: to.Ptr("dc6.contoso.local"), - // }}, - // }, - // NetbiosDomainName: to.Ptr("CONTOSO"), - // Realm: to.Ptr("CONTOSO.LOCAL"), - // ServiceAccountProvisioning: to.Ptr(armazurearcdata.AccountProvisioningModeManual), - // }, - // DNS: &armazurearcdata.ActiveDirectoryConnectorDNSDetails{ - // DomainName: to.Ptr("contoso.local"), - // NameserverIPAddresses: []*string{ - // to.Ptr("11.11.111.111"), - // to.Ptr("22.22.222.222")}, - // PreferK8SDNSForPtrLookups: to.Ptr(false), - // Replicas: to.Ptr[int64](1), - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/CreateOrUpdateActiveDirectoryConnector.json -func ExampleActiveDirectoryConnectorsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewActiveDirectoryConnectorsClient().BeginCreate(ctx, "testrg", "testdataController", "testADConnector", armazurearcdata.ActiveDirectoryConnectorResource{ - Properties: &armazurearcdata.ActiveDirectoryConnectorProperties{ - Spec: &armazurearcdata.ActiveDirectoryConnectorSpec{ - ActiveDirectory: &armazurearcdata.ActiveDirectoryConnectorDomainDetails{ - DomainControllers: &armazurearcdata.ActiveDirectoryDomainControllers{ - PrimaryDomainController: &armazurearcdata.ActiveDirectoryDomainController{ - Hostname: to.Ptr("dc1.contoso.local"), - }, - SecondaryDomainControllers: []*armazurearcdata.ActiveDirectoryDomainController{ - { - Hostname: to.Ptr("dc2.contoso.local"), - }, - { - Hostname: to.Ptr("dc3.contoso.local"), - }}, - }, - Realm: to.Ptr("CONTOSO.LOCAL"), - ServiceAccountProvisioning: to.Ptr(armazurearcdata.AccountProvisioningModeManual), - }, - DNS: &armazurearcdata.ActiveDirectoryConnectorDNSDetails{ - NameserverIPAddresses: []*string{ - to.Ptr("11.11.111.111"), - to.Ptr("22.22.222.222")}, - PreferK8SDNSForPtrLookups: to.Ptr(false), - Replicas: to.Ptr[int64](1), - }, - }, - }, - }, 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.ActiveDirectoryConnectorResource = armazurearcdata.ActiveDirectoryConnectorResource{ - // Name: to.Ptr("testADConnector"), - // Type: to.Ptr("Microsoft.AzureArcData/dataControllers/activeDirectoryConnectors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/dataControllers/testdataController/activeDirectoryConnectors/testADConnector"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Properties: &armazurearcdata.ActiveDirectoryConnectorProperties{ - // Spec: &armazurearcdata.ActiveDirectoryConnectorSpec{ - // ActiveDirectory: &armazurearcdata.ActiveDirectoryConnectorDomainDetails{ - // DomainControllers: &armazurearcdata.ActiveDirectoryDomainControllers{ - // PrimaryDomainController: &armazurearcdata.ActiveDirectoryDomainController{ - // Hostname: to.Ptr("dc1.contoso.local"), - // }, - // SecondaryDomainControllers: []*armazurearcdata.ActiveDirectoryDomainController{ - // { - // Hostname: to.Ptr("dc2.contoso.local"), - // }, - // { - // Hostname: to.Ptr("dc3.contoso.local"), - // }}, - // }, - // NetbiosDomainName: to.Ptr("CONTOSO"), - // Realm: to.Ptr("CONTOSO.LOCAL"), - // ServiceAccountProvisioning: to.Ptr(armazurearcdata.AccountProvisioningModeManual), - // }, - // DNS: &armazurearcdata.ActiveDirectoryConnectorDNSDetails{ - // DomainName: to.Ptr("contoso.local"), - // NameserverIPAddresses: []*string{ - // to.Ptr("11.11.111.111"), - // to.Ptr("22.22.222.222")}, - // PreferK8SDNSForPtrLookups: to.Ptr(false), - // Replicas: to.Ptr[int64](1), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/DeleteActiveDirectoryConnector.json -func ExampleActiveDirectoryConnectorsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewActiveDirectoryConnectorsClient().BeginDelete(ctx, "testrg", "testdataController", "testADConnector", 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/GetActiveDirectoryConnector.json -func ExampleActiveDirectoryConnectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActiveDirectoryConnectorsClient().Get(ctx, "testrg", "testdataController", "testADConnector", 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.ActiveDirectoryConnectorResource = armazurearcdata.ActiveDirectoryConnectorResource{ - // Name: to.Ptr("testADConnector"), - // Type: to.Ptr("Microsoft.AzureArcData/dataControllers/activeDirectoryConnectors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/dataControllers/testdataController/activeDirectoryConnectors/testADConnector"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Properties: &armazurearcdata.ActiveDirectoryConnectorProperties{ - // Spec: &armazurearcdata.ActiveDirectoryConnectorSpec{ - // ActiveDirectory: &armazurearcdata.ActiveDirectoryConnectorDomainDetails{ - // DomainControllers: &armazurearcdata.ActiveDirectoryDomainControllers{ - // PrimaryDomainController: &armazurearcdata.ActiveDirectoryDomainController{ - // Hostname: to.Ptr("dc1.contoso.local"), - // }, - // SecondaryDomainControllers: []*armazurearcdata.ActiveDirectoryDomainController{ - // { - // Hostname: to.Ptr("dc2.contoso.local"), - // }, - // { - // Hostname: to.Ptr("dc3.contoso.local"), - // }}, - // }, - // NetbiosDomainName: to.Ptr("CONTOSO"), - // Realm: to.Ptr("CONTOSO.LOCAL"), - // ServiceAccountProvisioning: to.Ptr(armazurearcdata.AccountProvisioningModeManual), - // }, - // DNS: &armazurearcdata.ActiveDirectoryConnectorDNSDetails{ - // DomainName: to.Ptr("contoso.local"), - // NameserverIPAddresses: []*string{ - // to.Ptr("11.11.111.111"), - // to.Ptr("22.22.222.222")}, - // PreferK8SDNSForPtrLookups: to.Ptr(false), - // Replicas: to.Ptr[int64](1), - // }, - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/autorest.md b/sdk/resourcemanager/azurearcdata/armazurearcdata/autorest.md index 942f05bbeb33..24493e11d04a 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/autorest.md +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurearcdata/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurearcdata/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.6.1 +module-version: 0.7.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/client_factory.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/client_factory.go index a5150a784803..21d6e718f578 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/client_factory.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/client_factory.go @@ -48,11 +48,21 @@ func (c *ClientFactory) NewSQLManagedInstancesClient() *SQLManagedInstancesClien return subClient } +func (c *ClientFactory) NewFailoverGroupsClient() *FailoverGroupsClient { + subClient, _ := NewFailoverGroupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewSQLServerInstancesClient() *SQLServerInstancesClient { subClient, _ := NewSQLServerInstancesClient(c.subscriptionID, c.credential, c.options) return subClient } +func (c *ClientFactory) NewSQLAvailabilityGroupsClient() *SQLAvailabilityGroupsClient { + subClient, _ := NewSQLAvailabilityGroupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewDataControllersClient() *DataControllersClient { subClient, _ := NewDataControllersClient(c.subscriptionID, c.credential, c.options) return subClient @@ -67,3 +77,23 @@ func (c *ClientFactory) NewPostgresInstancesClient() *PostgresInstancesClient { subClient, _ := NewPostgresInstancesClient(c.subscriptionID, c.credential, c.options) return subClient } + +func (c *ClientFactory) NewSQLServerDatabasesClient() *SQLServerDatabasesClient { + subClient, _ := NewSQLServerDatabasesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSQLServerAvailabilityGroupsClient() *SQLServerAvailabilityGroupsClient { + subClient, _ := NewSQLServerAvailabilityGroupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSQLAvailabilityGroupReplicasClient() *SQLAvailabilityGroupReplicasClient { + subClient, _ := NewSQLAvailabilityGroupReplicasClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSQLAvailabilityGroupDatabasesClient() *SQLAvailabilityGroupDatabasesClient { + subClient, _ := NewSQLAvailabilityGroupDatabasesClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/constants.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/constants.go index 51086ece3212..2403b85b8401 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/constants.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/constants.go @@ -11,7 +11,7 @@ package armazurearcdata const ( moduleName = "armazurearcdata" - moduleVersion = "v0.6.1" + moduleVersion = "v0.7.0" ) // AccountProvisioningMode - The service account provisioning mode for this Active Directory connector. @@ -52,10 +52,13 @@ func PossibleArcSQLManagedInstanceLicenseTypeValues() []ArcSQLManagedInstanceLic type ArcSQLServerLicenseType string const ( - ArcSQLServerLicenseTypeFree ArcSQLServerLicenseType = "Free" - ArcSQLServerLicenseTypeHADR ArcSQLServerLicenseType = "HADR" - ArcSQLServerLicenseTypePaid ArcSQLServerLicenseType = "Paid" - ArcSQLServerLicenseTypeUndefined ArcSQLServerLicenseType = "Undefined" + ArcSQLServerLicenseTypeFree ArcSQLServerLicenseType = "Free" + ArcSQLServerLicenseTypeHADR ArcSQLServerLicenseType = "HADR" + ArcSQLServerLicenseTypeLicenseOnly ArcSQLServerLicenseType = "LicenseOnly" + ArcSQLServerLicenseTypePAYG ArcSQLServerLicenseType = "PAYG" + ArcSQLServerLicenseTypePaid ArcSQLServerLicenseType = "Paid" + ArcSQLServerLicenseTypeServerCAL ArcSQLServerLicenseType = "ServerCAL" + ArcSQLServerLicenseTypeUndefined ArcSQLServerLicenseType = "Undefined" ) // PossibleArcSQLServerLicenseTypeValues returns the possible values for the ArcSQLServerLicenseType const type. @@ -63,7 +66,10 @@ func PossibleArcSQLServerLicenseTypeValues() []ArcSQLServerLicenseType { return []ArcSQLServerLicenseType{ ArcSQLServerLicenseTypeFree, ArcSQLServerLicenseTypeHADR, + ArcSQLServerLicenseTypeLicenseOnly, + ArcSQLServerLicenseTypePAYG, ArcSQLServerLicenseTypePaid, + ArcSQLServerLicenseTypeServerCAL, ArcSQLServerLicenseTypeUndefined, } } @@ -108,6 +114,36 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// DatabaseState - State of the database. +type DatabaseState string + +const ( + DatabaseStateCopying DatabaseState = "Copying" + DatabaseStateEmergency DatabaseState = "Emergency" + DatabaseStateOffline DatabaseState = "Offline" + DatabaseStateOfflineSecondary DatabaseState = "OfflineSecondary" + DatabaseStateOnline DatabaseState = "Online" + DatabaseStateRecovering DatabaseState = "Recovering" + DatabaseStateRecoveryPending DatabaseState = "RecoveryPending" + DatabaseStateRestoring DatabaseState = "Restoring" + DatabaseStateSuspect DatabaseState = "Suspect" +) + +// PossibleDatabaseStateValues returns the possible values for the DatabaseState const type. +func PossibleDatabaseStateValues() []DatabaseState { + return []DatabaseState{ + DatabaseStateCopying, + DatabaseStateEmergency, + DatabaseStateOffline, + DatabaseStateOfflineSecondary, + DatabaseStateOnline, + DatabaseStateRecovering, + DatabaseStateRecoveryPending, + DatabaseStateRestoring, + DatabaseStateSuspect, + } +} + // DefenderStatus - Status of Azure Defender. type DefenderStatus string @@ -130,17 +166,19 @@ func PossibleDefenderStatusValues() []DefenderStatus { type EditionType string const ( - EditionTypeDeveloper EditionType = "Developer" - EditionTypeEnterprise EditionType = "Enterprise" - EditionTypeEvaluation EditionType = "Evaluation" - EditionTypeExpress EditionType = "Express" - EditionTypeStandard EditionType = "Standard" - EditionTypeWeb EditionType = "Web" + EditionTypeBusinessIntelligence EditionType = "Business Intelligence" + EditionTypeDeveloper EditionType = "Developer" + EditionTypeEnterprise EditionType = "Enterprise" + EditionTypeEvaluation EditionType = "Evaluation" + EditionTypeExpress EditionType = "Express" + EditionTypeStandard EditionType = "Standard" + EditionTypeWeb EditionType = "Web" ) // PossibleEditionTypeValues returns the possible values for the EditionType const type. func PossibleEditionTypeValues() []EditionType { return []EditionType{ + EditionTypeBusinessIntelligence, EditionTypeDeveloper, EditionTypeEnterprise, EditionTypeEvaluation, @@ -164,21 +202,53 @@ func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { } } +// FailoverGroupPartnerSyncMode - The partner sync mode of the SQL managed instance. +type FailoverGroupPartnerSyncMode string + +const ( + FailoverGroupPartnerSyncModeAsync FailoverGroupPartnerSyncMode = "async" + FailoverGroupPartnerSyncModeSync FailoverGroupPartnerSyncMode = "sync" +) + +// PossibleFailoverGroupPartnerSyncModeValues returns the possible values for the FailoverGroupPartnerSyncMode const type. +func PossibleFailoverGroupPartnerSyncModeValues() []FailoverGroupPartnerSyncMode { + return []FailoverGroupPartnerSyncMode{ + FailoverGroupPartnerSyncModeAsync, + FailoverGroupPartnerSyncModeSync, + } +} + // HostType - Type of host for Azure Arc SQL Server type HostType string const ( - HostTypeAWSVirtualMachine HostType = "AWS Virtual Machine" - HostTypeGCPVirtualMachine HostType = "GCP Virtual Machine" - HostTypeOther HostType = "Other" - HostTypePhysicalServer HostType = "Physical Server" - HostTypeVirtualMachine HostType = "Virtual Machine" + HostTypeAWSKubernetesService HostType = "AWS Kubernetes Service" + HostTypeAWSVMWareVirtualMachine HostType = "AWS VMWare Virtual Machine" + HostTypeAWSVirtualMachine HostType = "AWS Virtual Machine" + HostTypeAzureKubernetesService HostType = "Azure Kubernetes Service" + HostTypeAzureVMWareVirtualMachine HostType = "Azure VMWare Virtual Machine" + HostTypeAzureVirtualMachine HostType = "Azure Virtual Machine" + HostTypeContainer HostType = "Container" + HostTypeGCPKubernetesService HostType = "GCP Kubernetes Service" + HostTypeGCPVMWareVirtualMachine HostType = "GCP VMWare Virtual Machine" + HostTypeGCPVirtualMachine HostType = "GCP Virtual Machine" + HostTypeOther HostType = "Other" + HostTypePhysicalServer HostType = "Physical Server" + HostTypeVirtualMachine HostType = "Virtual Machine" ) // PossibleHostTypeValues returns the possible values for the HostType const type. func PossibleHostTypeValues() []HostType { return []HostType{ + HostTypeAWSKubernetesService, + HostTypeAWSVMWareVirtualMachine, HostTypeAWSVirtualMachine, + HostTypeAzureKubernetesService, + HostTypeAzureVMWareVirtualMachine, + HostTypeAzureVirtualMachine, + HostTypeContainer, + HostTypeGCPKubernetesService, + HostTypeGCPVMWareVirtualMachine, HostTypeGCPVirtualMachine, HostTypeOther, HostTypePhysicalServer, @@ -210,6 +280,26 @@ func PossibleInfrastructureValues() []Infrastructure { } } +// InstanceFailoverGroupRole - The role of the SQL managed instance in this failover group. +type InstanceFailoverGroupRole string + +const ( + InstanceFailoverGroupRoleForcePrimaryAllowDataLoss InstanceFailoverGroupRole = "force-primary-allow-data-loss" + InstanceFailoverGroupRoleForceSecondary InstanceFailoverGroupRole = "force-secondary" + InstanceFailoverGroupRolePrimary InstanceFailoverGroupRole = "primary" + InstanceFailoverGroupRoleSecondary InstanceFailoverGroupRole = "secondary" +) + +// PossibleInstanceFailoverGroupRoleValues returns the possible values for the InstanceFailoverGroupRole const type. +func PossibleInstanceFailoverGroupRoleValues() []InstanceFailoverGroupRole { + return []InstanceFailoverGroupRole{ + InstanceFailoverGroupRoleForcePrimaryAllowDataLoss, + InstanceFailoverGroupRoleForceSecondary, + InstanceFailoverGroupRolePrimary, + InstanceFailoverGroupRoleSecondary, + } +} + // OperationOrigin - The intended executor of the operation. type OperationOrigin string @@ -226,6 +316,44 @@ func PossibleOperationOriginValues() []OperationOrigin { } } +// ProvisioningState - The provisioning state of the failover group resource. +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + } +} + +// RecoveryMode - Status of the database. +type RecoveryMode string + +const ( + RecoveryModeBulkLogged RecoveryMode = "Bulk-logged" + RecoveryModeFull RecoveryMode = "Full" + RecoveryModeSimple RecoveryMode = "Simple" +) + +// PossibleRecoveryModeValues returns the possible values for the RecoveryMode const type. +func PossibleRecoveryModeValues() []RecoveryMode { + return []RecoveryMode{ + RecoveryModeBulkLogged, + RecoveryModeFull, + RecoveryModeSimple, + } +} + // SQLManagedInstanceSKUTier - The pricing tier for the instance. type SQLManagedInstanceSKUTier string diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/datacontrollers_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/datacontrollers_client.go index 3eabc6fdd570..b29aac64c36a 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/datacontrollers_client.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/datacontrollers_client.go @@ -47,7 +47,7 @@ func NewDataControllersClient(subscriptionID string, credential azcore.TokenCred // BeginDeleteDataController - Deletes a dataController resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - dataControllerName - The name of the data controller // - options - DataControllersClientBeginDeleteDataControllerOptions contains the optional parameters for the DataControllersClient.BeginDeleteDataController @@ -67,7 +67,7 @@ func (client *DataControllersClient) BeginDeleteDataController(ctx context.Conte // DeleteDataController - Deletes a dataController resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview func (client *DataControllersClient) deleteDataController(ctx context.Context, resourceGroupName string, dataControllerName string, options *DataControllersClientBeginDeleteDataControllerOptions) (*http.Response, error) { req, err := client.deleteDataControllerCreateRequest(ctx, resourceGroupName, dataControllerName, options) if err != nil { @@ -103,7 +103,7 @@ func (client *DataControllersClient) deleteDataControllerCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -112,7 +112,7 @@ func (client *DataControllersClient) deleteDataControllerCreateRequest(ctx conte // GetDataController - Retrieves a dataController resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - dataControllerName - The name of the data controller // - options - DataControllersClientGetDataControllerOptions contains the optional parameters for the DataControllersClient.GetDataController @@ -152,7 +152,7 @@ func (client *DataControllersClient) getDataControllerCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -169,7 +169,7 @@ func (client *DataControllersClient) getDataControllerHandleResponse(resp *http. // NewListInGroupPager - List dataController resources in the resource group // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - options - DataControllersClientListInGroupOptions contains the optional parameters for the DataControllersClient.NewListInGroupPager // method. @@ -217,7 +217,7 @@ func (client *DataControllersClient) listInGroupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -234,7 +234,7 @@ func (client *DataControllersClient) listInGroupHandleResponse(resp *http.Respon // NewListInSubscriptionPager - List dataController resources in the subscription // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - options - DataControllersClientListInSubscriptionOptions contains the optional parameters for the DataControllersClient.NewListInSubscriptionPager // method. func (client *DataControllersClient) NewListInSubscriptionPager(options *DataControllersClientListInSubscriptionOptions) *runtime.Pager[DataControllersClientListInSubscriptionResponse] { @@ -277,7 +277,7 @@ func (client *DataControllersClient) listInSubscriptionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -295,7 +295,7 @@ func (client *DataControllersClient) listInSubscriptionHandleResponse(resp *http // BeginPatchDataController - Updates a dataController resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - dataControllerName - The name of the data controller // - dataControllerResource - The update data controller resource @@ -318,7 +318,7 @@ func (client *DataControllersClient) BeginPatchDataController(ctx context.Contex // PatchDataController - Updates a dataController resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview func (client *DataControllersClient) patchDataController(ctx context.Context, resourceGroupName string, dataControllerName string, dataControllerResource DataControllerUpdate, options *DataControllersClientBeginPatchDataControllerOptions) (*http.Response, error) { req, err := client.patchDataControllerCreateRequest(ctx, resourceGroupName, dataControllerName, dataControllerResource, options) if err != nil { @@ -354,7 +354,7 @@ func (client *DataControllersClient) patchDataControllerCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, dataControllerResource) @@ -363,7 +363,7 @@ func (client *DataControllersClient) patchDataControllerCreateRequest(ctx contex // BeginPutDataController - Creates or replaces a dataController resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - dataControllerName - The name of the data controller // - dataControllerResource - desc @@ -386,7 +386,7 @@ func (client *DataControllersClient) BeginPutDataController(ctx context.Context, // PutDataController - Creates or replaces a dataController resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview func (client *DataControllersClient) putDataController(ctx context.Context, resourceGroupName string, dataControllerName string, dataControllerResource DataControllerResource, options *DataControllersClientBeginPutDataControllerOptions) (*http.Response, error) { req, err := client.putDataControllerCreateRequest(ctx, resourceGroupName, dataControllerName, dataControllerResource, options) if err != nil { @@ -422,7 +422,7 @@ func (client *DataControllersClient) putDataControllerCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, dataControllerResource) diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/datacontrollers_client_example_test.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/datacontrollers_client_example_test.go deleted file mode 100644 index d95f91b31838..000000000000 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/datacontrollers_client_example_test.go +++ /dev/null @@ -1,579 +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 armazurearcdata_test - -import ( - "context" - "log" - - "time" - - "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/azurearcdata/armazurearcdata" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListSubscriptionDataController.json -func ExampleDataControllersClient_NewListInSubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataControllersClient().NewListInSubscriptionPager(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.PageOfDataControllerResource = armazurearcdata.PageOfDataControllerResource{ - // Value: []*armazurearcdata.DataControllerResource{ - // { - // Name: to.Ptr("testdataController1"), - // Type: to.Ptr("Microsoft.AzureArcData/dataControllers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/dataControllers/testdataController1"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.DataControllerProperties{ - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - // ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - // Infrastructure: to.Ptr(armazurearcdata.InfrastructureOnpremises), - // LogAnalyticsWorkspaceConfig: &armazurearcdata.LogAnalyticsWorkspaceConfig{ - // WorkspaceID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // LogsDashboardCredential: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // MetricsDashboardCredential: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // OnPremiseProperty: &armazurearcdata.OnPremiseProperty{ - // ID: to.Ptr("12345678-1234-1234-ab12-1a2b3c4d5e6f"), - // PublicSigningKey: to.Ptr("publicOnPremSigningKey"), - // SigningCertificateThumbprint: to.Ptr("Unique thumbprint returned to customer to verify the certificate they uploaded"), - // }, - // UploadServicePrincipal: &armazurearcdata.UploadServicePrincipal{ - // Authority: to.Ptr("https://login.microsoftonline.com/"), - // ClientID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // TenantID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // UploadWatermark: &armazurearcdata.UploadWatermark{ - // Logs: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // Metrics: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // Usages: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // }, - // }, - // { - // Name: to.Ptr("testdataController2"), - // Type: to.Ptr("Microsoft.AzureArcData/dataControllers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/dataControllers/testdataController2"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.DataControllerProperties{ - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - // ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - // LogAnalyticsWorkspaceConfig: &armazurearcdata.LogAnalyticsWorkspaceConfig{ - // WorkspaceID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // LogsDashboardCredential: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // MetricsDashboardCredential: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // OnPremiseProperty: &armazurearcdata.OnPremiseProperty{ - // ID: to.Ptr("12345678-1234-1234-ab12-1a2b3c4d5e6f"), - // PublicSigningKey: to.Ptr("publicOnPremSigningKey"), - // SigningCertificateThumbprint: to.Ptr("Unique thumbprint returned to customer to verify the certificate they uploaded"), - // }, - // UploadServicePrincipal: &armazurearcdata.UploadServicePrincipal{ - // Authority: to.Ptr("https://login.microsoftonline.com/"), - // ClientID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // TenantID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // UploadWatermark: &armazurearcdata.UploadWatermark{ - // Logs: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // Metrics: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // Usages: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListByResourceGroupDataController.json -func ExampleDataControllersClient_NewListInGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataControllersClient().NewListInGroupPager("testrg", 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.PageOfDataControllerResource = armazurearcdata.PageOfDataControllerResource{ - // Value: []*armazurearcdata.DataControllerResource{ - // { - // Name: to.Ptr("testdataController1"), - // Type: to.Ptr("Microsoft.AzureArcData/dataControllers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/dataControllers/testdataController1"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.DataControllerProperties{ - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - // ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - // Infrastructure: to.Ptr(armazurearcdata.InfrastructureOnpremises), - // LogAnalyticsWorkspaceConfig: &armazurearcdata.LogAnalyticsWorkspaceConfig{ - // WorkspaceID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // LogsDashboardCredential: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // MetricsDashboardCredential: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // OnPremiseProperty: &armazurearcdata.OnPremiseProperty{ - // ID: to.Ptr("12345678-1234-1234-ab12-1a2b3c4d5e6f"), - // PublicSigningKey: to.Ptr("publicOnPremSigningKey"), - // SigningCertificateThumbprint: to.Ptr("Unique thumbprint returned to customer to verify the certificate they uploaded"), - // }, - // UploadServicePrincipal: &armazurearcdata.UploadServicePrincipal{ - // Authority: to.Ptr("https://login.microsoftonline.com/"), - // ClientID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // TenantID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // UploadWatermark: &armazurearcdata.UploadWatermark{ - // Logs: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // Metrics: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // Usages: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // }, - // }, - // { - // Name: to.Ptr("testdataController2"), - // Type: to.Ptr("Microsoft.AzureArcData/dataControllers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/dataControllers/testdataController2"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.DataControllerProperties{ - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - // ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - // Infrastructure: to.Ptr(armazurearcdata.InfrastructureOnpremises), - // LogAnalyticsWorkspaceConfig: &armazurearcdata.LogAnalyticsWorkspaceConfig{ - // WorkspaceID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // OnPremiseProperty: &armazurearcdata.OnPremiseProperty{ - // ID: to.Ptr("12345678-1234-1234-ab12-1a2b3c4d5e6f"), - // PublicSigningKey: to.Ptr("publicOnPremSigningKey"), - // SigningCertificateThumbprint: to.Ptr("Unique thumbprint returned to customer to verify the certificate they uploaded"), - // }, - // UploadServicePrincipal: &armazurearcdata.UploadServicePrincipal{ - // Authority: to.Ptr("https://login.microsoftonline.com/"), - // ClientID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // TenantID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // UploadWatermark: &armazurearcdata.UploadWatermark{ - // Logs: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // Metrics: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // Usages: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/CreateOrUpdateDataController.json -func ExampleDataControllersClient_BeginPutDataController() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataControllersClient().BeginPutDataController(ctx, "testrg", "testdataController", armazurearcdata.DataControllerResource{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - ExtendedLocation: &armazurearcdata.ExtendedLocation{ - Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurearcdata.DataControllerProperties{ - BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - Password: to.Ptr("********"), - Username: to.Ptr("username"), - }, - ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - Infrastructure: to.Ptr(armazurearcdata.InfrastructureOnpremises), - LogAnalyticsWorkspaceConfig: &armazurearcdata.LogAnalyticsWorkspaceConfig{ - PrimaryKey: to.Ptr("********"), - WorkspaceID: to.Ptr("00000000-1111-2222-3333-444444444444"), - }, - LogsDashboardCredential: &armazurearcdata.BasicLoginInformation{ - Password: to.Ptr("********"), - Username: to.Ptr("username"), - }, - MetricsDashboardCredential: &armazurearcdata.BasicLoginInformation{ - Password: to.Ptr("********"), - Username: to.Ptr("username"), - }, - OnPremiseProperty: &armazurearcdata.OnPremiseProperty{ - ID: to.Ptr("12345678-1234-1234-ab12-1a2b3c4d5e6f"), - PublicSigningKey: to.Ptr("publicOnPremSigningKey"), - }, - UploadServicePrincipal: &armazurearcdata.UploadServicePrincipal{ - Authority: to.Ptr("https://login.microsoftonline.com/"), - ClientID: to.Ptr("00000000-1111-2222-3333-444444444444"), - ClientSecret: to.Ptr("********"), - TenantID: to.Ptr("00000000-1111-2222-3333-444444444444"), - }, - UploadWatermark: &armazurearcdata.UploadWatermark{ - Logs: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t }()), - Metrics: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t }()), - Usages: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t }()), - }, - }, - }, 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.DataControllerResource = armazurearcdata.DataControllerResource{ - // Name: to.Ptr("testdataController"), - // Type: to.Ptr("Microsoft.AzureArcData/dataControllers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/dataControllers/testdataController"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.DataControllerProperties{ - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - // ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - // Infrastructure: to.Ptr(armazurearcdata.InfrastructureOnpremises), - // LogAnalyticsWorkspaceConfig: &armazurearcdata.LogAnalyticsWorkspaceConfig{ - // WorkspaceID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // LogsDashboardCredential: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // MetricsDashboardCredential: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // OnPremiseProperty: &armazurearcdata.OnPremiseProperty{ - // ID: to.Ptr("12345678-1234-1234-ab12-1a2b3c4d5e6f"), - // PublicSigningKey: to.Ptr("publicOnPremSigningKey"), - // SigningCertificateThumbprint: to.Ptr("Unique thumbprint returned to customer to verify the certificate being uploaded"), - // }, - // UploadServicePrincipal: &armazurearcdata.UploadServicePrincipal{ - // Authority: to.Ptr("https://login.microsoftonline.com/"), - // ClientID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // TenantID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // UploadWatermark: &armazurearcdata.UploadWatermark{ - // Logs: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // Metrics: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // Usages: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/DeleteDataController.json -func ExampleDataControllersClient_BeginDeleteDataController() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataControllersClient().BeginDeleteDataController(ctx, "testrg", "testdataController", 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/GetDataController.json -func ExampleDataControllersClient_GetDataController() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataControllersClient().GetDataController(ctx, "testrg", "testdataController", 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.DataControllerResource = armazurearcdata.DataControllerResource{ - // Name: to.Ptr("testdataController"), - // Type: to.Ptr("Microsoft.AzureArcData/dataControllers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/dataControllers/testdataController"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.DataControllerProperties{ - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - // ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - // Infrastructure: to.Ptr(armazurearcdata.InfrastructureOnpremises), - // LogAnalyticsWorkspaceConfig: &armazurearcdata.LogAnalyticsWorkspaceConfig{ - // WorkspaceID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // LogsDashboardCredential: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // MetricsDashboardCredential: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // OnPremiseProperty: &armazurearcdata.OnPremiseProperty{ - // ID: to.Ptr("12345678-1234-1234-ab12-1a2b3c4d5e6f"), - // PublicSigningKey: to.Ptr("publicOnPremSigningKey"), - // SigningCertificateThumbprint: to.Ptr("Unique thumbprint returned to customer to verify the certificate they uploaded"), - // }, - // UploadServicePrincipal: &armazurearcdata.UploadServicePrincipal{ - // Authority: to.Ptr("https://login.microsoftonline.com/"), - // ClientID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // TenantID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // UploadWatermark: &armazurearcdata.UploadWatermark{ - // Logs: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // Metrics: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // Usages: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/UpdateDataController.json -func ExampleDataControllersClient_BeginPatchDataController() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataControllersClient().BeginPatchDataController(ctx, "testrg", "testdataController1", armazurearcdata.DataControllerUpdate{ - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - }, 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.DataControllerResource = armazurearcdata.DataControllerResource{ - // Name: to.Ptr("testdataController1"), - // Type: to.Ptr("Microsoft.AzureArcData/dataControllers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/dataControllers/testdataController1"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.DataControllerProperties{ - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - // ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - // Infrastructure: to.Ptr(armazurearcdata.InfrastructureOnpremises), - // LogAnalyticsWorkspaceConfig: &armazurearcdata.LogAnalyticsWorkspaceConfig{ - // WorkspaceID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // LogsDashboardCredential: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // MetricsDashboardCredential: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // OnPremiseProperty: &armazurearcdata.OnPremiseProperty{ - // ID: to.Ptr("12345678-1234-1234-ab12-1a2b3c4d5e6f"), - // PublicSigningKey: to.Ptr("publicOnPremSigningKey"), - // SigningCertificateThumbprint: to.Ptr("Unique thumbprint returned to customer to verify the certificate they uploaded"), - // }, - // UploadServicePrincipal: &armazurearcdata.UploadServicePrincipal{ - // Authority: to.Ptr("https://login.microsoftonline.com/"), - // ClientID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // TenantID: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // UploadWatermark: &armazurearcdata.UploadWatermark{ - // Logs: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // Metrics: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // Usages: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/failovergroups_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/failovergroups_client.go new file mode 100644 index 000000000000..5af686d3a8aa --- /dev/null +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/failovergroups_client.go @@ -0,0 +1,319 @@ +//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 armazurearcdata + +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" +) + +// FailoverGroupsClient contains the methods for the FailoverGroups group. +// Don't use this type directly, use NewFailoverGroupsClient() instead. +type FailoverGroupsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFailoverGroupsClient creates a new instance of FailoverGroupsClient with the specified values. +// - subscriptionID - The ID of the Azure subscription +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFailoverGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FailoverGroupsClient, error) { + cl, err := arm.NewClient(moduleName+".FailoverGroupsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FailoverGroupsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates or replaces a failover group resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlManagedInstanceName - Name of SQL Managed Instance +// - failoverGroupName - The name of the Failover Group +// - failoverGroupResource - desc +// - options - FailoverGroupsClientBeginCreateOptions contains the optional parameters for the FailoverGroupsClient.BeginCreate +// method. +func (client *FailoverGroupsClient) BeginCreate(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, failoverGroupName string, failoverGroupResource FailoverGroupResource, options *FailoverGroupsClientBeginCreateOptions) (*runtime.Poller[FailoverGroupsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, sqlManagedInstanceName, failoverGroupName, failoverGroupResource, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FailoverGroupsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[FailoverGroupsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Create - Creates or replaces a failover group resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +func (client *FailoverGroupsClient) create(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, failoverGroupName string, failoverGroupResource FailoverGroupResource, options *FailoverGroupsClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, sqlManagedInstanceName, failoverGroupName, failoverGroupResource, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *FailoverGroupsClient) createCreateRequest(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, failoverGroupName string, failoverGroupResource FailoverGroupResource, options *FailoverGroupsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}" + 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 sqlManagedInstanceName == "" { + return nil, errors.New("parameter sqlManagedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlManagedInstanceName}", url.PathEscape(sqlManagedInstanceName)) + if failoverGroupName == "" { + return nil, errors.New("parameter failoverGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{failoverGroupName}", url.PathEscape(failoverGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, failoverGroupResource) +} + +// BeginDelete - Deletes a failover group resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlManagedInstanceName - Name of SQL Managed Instance +// - failoverGroupName - The name of the Failover Group +// - options - FailoverGroupsClientBeginDeleteOptions contains the optional parameters for the FailoverGroupsClient.BeginDelete +// method. +func (client *FailoverGroupsClient) BeginDelete(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, failoverGroupName string, options *FailoverGroupsClientBeginDeleteOptions) (*runtime.Poller[FailoverGroupsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, sqlManagedInstanceName, failoverGroupName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[FailoverGroupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + } else { + return runtime.NewPollerFromResumeToken[FailoverGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a failover group resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +func (client *FailoverGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, failoverGroupName string, options *FailoverGroupsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlManagedInstanceName, failoverGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FailoverGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, failoverGroupName string, options *FailoverGroupsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}" + 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 sqlManagedInstanceName == "" { + return nil, errors.New("parameter sqlManagedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlManagedInstanceName}", url.PathEscape(sqlManagedInstanceName)) + if failoverGroupName == "" { + return nil, errors.New("parameter failoverGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{failoverGroupName}", url.PathEscape(failoverGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves a failover group resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlManagedInstanceName - Name of SQL Managed Instance +// - failoverGroupName - The name of the Failover Group +// - options - FailoverGroupsClientGetOptions contains the optional parameters for the FailoverGroupsClient.Get method. +func (client *FailoverGroupsClient) Get(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, failoverGroupName string, options *FailoverGroupsClientGetOptions) (FailoverGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, sqlManagedInstanceName, failoverGroupName, options) + if err != nil { + return FailoverGroupsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FailoverGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FailoverGroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FailoverGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, failoverGroupName string, options *FailoverGroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}" + 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 sqlManagedInstanceName == "" { + return nil, errors.New("parameter sqlManagedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlManagedInstanceName}", url.PathEscape(sqlManagedInstanceName)) + if failoverGroupName == "" { + return nil, errors.New("parameter failoverGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{failoverGroupName}", url.PathEscape(failoverGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FailoverGroupsClient) getHandleResponse(resp *http.Response) (FailoverGroupsClientGetResponse, error) { + result := FailoverGroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FailoverGroupResource); err != nil { + return FailoverGroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List the failover groups associated with the given sql managed instance. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlManagedInstanceName - Name of SQL Managed Instance +// - options - FailoverGroupsClientListOptions contains the optional parameters for the FailoverGroupsClient.NewListPager method. +func (client *FailoverGroupsClient) NewListPager(resourceGroupName string, sqlManagedInstanceName string, options *FailoverGroupsClientListOptions) *runtime.Pager[FailoverGroupsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FailoverGroupsClientListResponse]{ + More: func(page FailoverGroupsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FailoverGroupsClientListResponse) (FailoverGroupsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, sqlManagedInstanceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FailoverGroupsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FailoverGroupsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FailoverGroupsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *FailoverGroupsClient) listCreateRequest(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, options *FailoverGroupsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups" + 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 sqlManagedInstanceName == "" { + return nil, errors.New("parameter sqlManagedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlManagedInstanceName}", url.PathEscape(sqlManagedInstanceName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FailoverGroupsClient) listHandleResponse(resp *http.Response) (FailoverGroupsClientListResponse, error) { + result := FailoverGroupsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FailoverGroupListResult); err != nil { + return FailoverGroupsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/go.mod b/sdk/resourcemanager/azurearcdata/armazurearcdata/go.mod index 82ade3e577f9..c0f5ddda4180 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/go.mod +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurearcdata/armazu go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/go.sum b/sdk/resourcemanager/azurearcdata/armazurearcdata/go.sum index 8ba445a8c4da..b6bd7eaad1ba 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/go.sum +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/go.sum @@ -1,31 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.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-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/models.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/models.go index 41df59d16387..cd8378460da9 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/models.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/models.go @@ -28,12 +28,12 @@ type ActiveDirectoryConnectorDNSDetails struct { // ActiveDirectoryConnectorDomainDetails - Active Directory domain details type ActiveDirectoryConnectorDomainDetails struct { - // REQUIRED; null - DomainControllers *ActiveDirectoryDomainControllers - // REQUIRED; Name (uppercase) of the Active Directory domain that this AD connector will be associated with. Realm *string + // null + DomainControllers *ActiveDirectoryDomainControllers + // NETBIOS name of the Active Directory domain. NetbiosDomainName *string @@ -158,6 +158,106 @@ type ActiveDirectoryInformation struct { KeytabInformation *KeytabInformation } +// ArcSQLAvailabilityGroupDatabasesListResult - A list of Arc Sql Availability Group Databases. +type ArcSQLAvailabilityGroupDatabasesListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of Arc Sql Availability Group Database. + Value []*SQLAvailabilityGroupDatabaseResource +} + +// ArcSQLAvailabilityGroupReplicaListResult - A list of Arc Sql Availability Group Replica. +type ArcSQLAvailabilityGroupReplicaListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of Arc Sql Availability Group Replica. + Value []*SQLAvailabilityGroupReplicaResource +} + +// ArcSQLServerAvailabilityGroupListResult - A list of Arc Sql Server Availability Group. +type ArcSQLServerAvailabilityGroupListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of Arc Sql Server Availability Group. + Value []*SQLServerAvailabilityGroupResource +} + +// ArcSQLServerDatabaseListResult - A list of Arc Sql Server database. +type ArcSQLServerDatabaseListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of Arc Sql Server database. + Value []*SQLServerDatabaseResource +} + +// AvailabilityGroupConfigure - The specifications of the availability group replica configuration +type AvailabilityGroupConfigure struct { + // Availability Synchronization mode description of availability group replica. + AvailabilityModeDesc *string + + // Represents the user-specified priority for performing backups on this replica relative to the other replicas in the same + // availability group. + BackupPriority *int32 + + // Date that the replica was created. + CreateDate *time.Time + + // Mirroring endpoint URL of availability group replica + EndpointURL *string + + // failover mode description of the availability group replica. + FailoverModeDesc *string + + // Date that the replica was modified. + ModifyDate *time.Time + + // Allowed the connections for primary role of the availability group replica. + PrimaryRoleAllowConnectionsDesc *string + + // Connectivity endpoint (URL) of the read only availability replica. + ReadOnlyRoutingURL *string + + // Connectivity endpoint (URL) of the read write availability replica. + ReadWriteRoutingURL *string + + // Allowed the connections for secondary role of availability group replica. + SecondaryRoleAllowConnectionsDesc *string + + // Describes seeding mode. + SeedingModeDesc *string + + // The time-out period of availability group session replica, in seconds. + SessionTimeout *int32 +} + +// AvailabilityGroupState - The specifications of the availability group state +type AvailabilityGroupState struct { + // Role description of the availability group replica. + AvailabilityGroupReplicaRole *string + + // Connected state description of the availability group replica. + ConnectedStateDesc *string + + // Last connect error description of the availability group replica. + LastConnectErrorDescription *string + + // Last connect error time stamp of the availability group replica. + LastConnectErrorTimestamp *time.Time + + // Operation state description of the availability group replica + OperationalStateDesc *string + + // Recovery health description of the availability group replica. + RecoveryHealthDesc *string + + // Synchronization health description of the availability group replica. + SynchronizationHealthDesc *string +} + // BasicLoginInformation - Username and password for basic login authentication. type BasicLoginInformation struct { // Login password. @@ -334,6 +434,101 @@ type ExtendedLocation struct { Type *ExtendedLocationTypes } +// FailoverGroupListResult - A list of failover groups. +type FailoverGroupListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of failover group results. + Value []*FailoverGroupResource +} + +// FailoverGroupProperties - The properties of a failover group resource. +type FailoverGroupProperties struct { + // REQUIRED; The resource ID of the partner SQL managed instance. + PartnerManagedInstanceID *string + + // REQUIRED; The specifications of the failover group resource. + Spec *FailoverGroupSpec + + // OPTIONAL; Contains additional key/value pairs not defined in the schema. + AdditionalProperties map[string]any + + // The status of the failover group custom resource. + Status any + + // READ-ONLY; The provisioning state of the failover group resource. + ProvisioningState *ProvisioningState +} + +// FailoverGroupResource - A failover group resource. +type FailoverGroupResource struct { + // REQUIRED; null + Properties *FailoverGroupProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// FailoverGroupSpec - The specifications of the failover group resource. +type FailoverGroupSpec struct { + // REQUIRED; The role of the SQL managed instance in this failover group. + Role *InstanceFailoverGroupRole + + // OPTIONAL; Contains additional key/value pairs not defined in the schema. + AdditionalProperties map[string]any + + // The name of the partner SQL managed instance. + PartnerMI *string + + // The mirroring endpoint public certificate for the partner SQL managed instance. Only PEM format is supported. + PartnerMirroringCert *string + + // The mirroring endpoint URL of the partner SQL managed instance. + PartnerMirroringURL *string + + // The partner sync mode of the SQL managed instance. + PartnerSyncMode *FailoverGroupPartnerSyncMode + + // The shared name of the failover group for this SQL managed instance. Both SQL managed instance and its partner have to + // use the same shared name. + SharedName *string + + // The name of the SQL managed instance with this failover group role. + SourceMI *string +} + +// FailoverGroupsClientBeginCreateOptions contains the optional parameters for the FailoverGroupsClient.BeginCreate method. +type FailoverGroupsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FailoverGroupsClientBeginDeleteOptions contains the optional parameters for the FailoverGroupsClient.BeginDelete method. +type FailoverGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FailoverGroupsClientGetOptions contains the optional parameters for the FailoverGroupsClient.Get method. +type FailoverGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// FailoverGroupsClientListOptions contains the optional parameters for the FailoverGroupsClient.NewListPager method. +type FailoverGroupsClientListOptions struct { + // placeholder for future optional parameters +} + // K8SResourceRequirements - The kubernetes resource limits and requests used to restrict or reserve resource usage. type K8SResourceRequirements struct { // OPTIONAL; Contains additional key/value pairs not defined in the schema. @@ -610,6 +805,310 @@ type Resource struct { Type *string } +// SQLAvailabilityGroup - A SqlAvailabilityGroup. +type SQLAvailabilityGroup struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // null + Properties *SQLAvailabilityGroupProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SQLAvailabilityGroupDatabaseReplicaResourceProperties - The properties of Arc Sql availability group database replica resource +type SQLAvailabilityGroupDatabaseReplicaResourceProperties struct { + // Description of the database state of the availability replica. + DatabaseStateDesc *string + + // Whether this replica is transaction committer. + IsCommitParticipant *bool + + // Whether the availability database is local. + IsLocal *bool + + // Returns 1 if the replica is primary, or 0 if it is a secondary replica. + IsPrimaryReplica *bool + + // Whether this data movement is suspended. + IsSuspended *bool + + // the database replica name. + ReplicaName *string + + // Description of the database suspended state reason. + SuspendReasonDesc *string + + // Description of the health of database. + SynchronizationHealthDesc *string + + // Description of the data-movement state. + SynchronizationStateDesc *string + + // READ-ONLY; The provisioning state of the Arc-enabled SQL Server availability group resource. + ProvisioningState *string +} + +// SQLAvailabilityGroupDatabaseResource - Arc Sql Server Availability Group Database +type SQLAvailabilityGroupDatabaseResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // REQUIRED; Properties of Arc Sql Availability Group Multiple Database Replica + Properties *SQLAvailabilityGroupMultiDatabaseReplicaResourceProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SQLAvailabilityGroupDatabaseUpdate - An update to Availability Group Database Replica resource. +type SQLAvailabilityGroupDatabaseUpdate struct { + // The Availability Group Replica's properties + Properties *SQLAvailabilityGroupMultiDatabaseReplicaResourceProperties + + // Resource tags. + Tags map[string]*string +} + +// SQLAvailabilityGroupDatabasesClientCreateOptions contains the optional parameters for the SQLAvailabilityGroupDatabasesClient.Create +// method. +type SQLAvailabilityGroupDatabasesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// SQLAvailabilityGroupDatabasesClientDeleteOptions contains the optional parameters for the SQLAvailabilityGroupDatabasesClient.Delete +// method. +type SQLAvailabilityGroupDatabasesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SQLAvailabilityGroupDatabasesClientGetOptions contains the optional parameters for the SQLAvailabilityGroupDatabasesClient.Get +// method. +type SQLAvailabilityGroupDatabasesClientGetOptions struct { + // placeholder for future optional parameters +} + +// SQLAvailabilityGroupDatabasesClientListOptions contains the optional parameters for the SQLAvailabilityGroupDatabasesClient.NewListPager +// method. +type SQLAvailabilityGroupDatabasesClientListOptions struct { + // placeholder for future optional parameters +} + +// SQLAvailabilityGroupDatabasesClientUpdateOptions contains the optional parameters for the SQLAvailabilityGroupDatabasesClient.Update +// method. +type SQLAvailabilityGroupDatabasesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// SQLAvailabilityGroupListResult - A list of SqlAvailabilityGroup. +type SQLAvailabilityGroupListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*SQLAvailabilityGroup +} + +// SQLAvailabilityGroupMultiDatabaseReplicaResourceProperties - The properties of Arc Sql availability group multiple database +// replica resource +type SQLAvailabilityGroupMultiDatabaseReplicaResourceProperties struct { + // ID GUID of the database for availability group. + GroupDatabaseID *string + + // Array of Arc Sql Availability Group Database Replicas. + Value []*SQLAvailabilityGroupDatabaseReplicaResourceProperties + + // READ-ONLY; The provisioning state of the Arc-enabled SQL Server availability group resource. + ProvisioningState *string +} + +// SQLAvailabilityGroupProperties - Properties of SqlAvailabilityGroup. +type SQLAvailabilityGroupProperties struct { + // REQUIRED; Id GUID of the availability group. + AvailabilityGroupID *string + + // REQUIRED; The name of the availability group. + AvailabilityGroupName *string + + // SQL Server basic availability group. + BasicFeatures *bool + + // SQL Server availability group cluster type description + ClusterTypeDesc *string + + // Timestamp for when the data was collected from the client machine. + CollectionTimestamp *time.Time + + // SQL Server availability group failover for database health conditions. + DbFailover *bool + + // SQL Server availability group DTC support enabled. + DtcSupport *bool + + // The name of the instance name which availability group primary is on. + InstanceName *string + + // SQL Server availability group contained system databases. + IsContained *bool + + // SQL Server distributed availability group. + IsDistributed *bool + + // Availability group required the number of synchronized secondary to commit. + RequiredSynchronizedSecondariesCommit *int32 + + // SQL Server availability group current version. + Version *int32 +} + +// SQLAvailabilityGroupReplicaResource - Arc Sql Server Availability Group +type SQLAvailabilityGroupReplicaResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // REQUIRED; Properties of Arc Sql Availability Group Replica + Properties *SQLAvailabilityGroupReplicaResourceProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SQLAvailabilityGroupReplicaResourceProperties - The properties of Arc Sql availability group replica resource +type SQLAvailabilityGroupReplicaResourceProperties struct { + // null + Configure *AvailabilityGroupConfigure + + // ID GUID of the availability group. + ReplicaID *string + + // the replica name. + ReplicaName *string + + // null + State *AvailabilityGroupState + + // READ-ONLY; The provisioning state of the Arc-enabled SQL Server availability group resource. + ProvisioningState *string +} + +// SQLAvailabilityGroupReplicaUpdate - An update to Availability Group Replica resource. +type SQLAvailabilityGroupReplicaUpdate struct { + // The Availability Group Replica's properties + Properties *SQLAvailabilityGroupReplicaResourceProperties + + // Resource tags. + Tags map[string]*string +} + +// SQLAvailabilityGroupReplicasClientCreateOptions contains the optional parameters for the SQLAvailabilityGroupReplicasClient.Create +// method. +type SQLAvailabilityGroupReplicasClientCreateOptions struct { + // placeholder for future optional parameters +} + +// SQLAvailabilityGroupReplicasClientDeleteOptions contains the optional parameters for the SQLAvailabilityGroupReplicasClient.Delete +// method. +type SQLAvailabilityGroupReplicasClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SQLAvailabilityGroupReplicasClientGetOptions contains the optional parameters for the SQLAvailabilityGroupReplicasClient.Get +// method. +type SQLAvailabilityGroupReplicasClientGetOptions struct { + // placeholder for future optional parameters +} + +// SQLAvailabilityGroupReplicasClientListOptions contains the optional parameters for the SQLAvailabilityGroupReplicasClient.NewListPager +// method. +type SQLAvailabilityGroupReplicasClientListOptions struct { + // placeholder for future optional parameters +} + +// SQLAvailabilityGroupReplicasClientUpdateOptions contains the optional parameters for the SQLAvailabilityGroupReplicasClient.Update +// method. +type SQLAvailabilityGroupReplicasClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// SQLAvailabilityGroupUpdate - An update to a SQL Availability Group. +type SQLAvailabilityGroupUpdate struct { + // Resource tags. + Tags map[string]*string +} + +// SQLAvailabilityGroupsClientBeginCreateOptions contains the optional parameters for the SQLAvailabilityGroupsClient.BeginCreate +// method. +type SQLAvailabilityGroupsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLAvailabilityGroupsClientBeginDeleteOptions contains the optional parameters for the SQLAvailabilityGroupsClient.BeginDelete +// method. +type SQLAvailabilityGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLAvailabilityGroupsClientGetOptions contains the optional parameters for the SQLAvailabilityGroupsClient.Get method. +type SQLAvailabilityGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SQLAvailabilityGroupsClientListByResourceGroupOptions contains the optional parameters for the SQLAvailabilityGroupsClient.NewListByResourceGroupPager +// method. +type SQLAvailabilityGroupsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SQLAvailabilityGroupsClientListOptions contains the optional parameters for the SQLAvailabilityGroupsClient.NewListPager +// method. +type SQLAvailabilityGroupsClientListOptions struct { + // placeholder for future optional parameters +} + +// SQLAvailabilityGroupsClientUpdateOptions contains the optional parameters for the SQLAvailabilityGroupsClient.Update method. +type SQLAvailabilityGroupsClientUpdateOptions struct { + // placeholder for future optional parameters +} + // SQLManagedInstance - A SqlManagedInstance. type SQLManagedInstance struct { // REQUIRED; The geo-location where the resource lives @@ -774,6 +1273,200 @@ type SQLManagedInstancesClientUpdateOptions struct { // placeholder for future optional parameters } +// SQLServerAvailabilityGroupResource - Arc Sql Server Availability Group +type SQLServerAvailabilityGroupResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // REQUIRED; Properties of Arc Sql Server availability group + Properties *SQLServerAvailabilityGroupResourceProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SQLServerAvailabilityGroupResourceProperties - The properties of Arc Sql Server availability group resource +type SQLServerAvailabilityGroupResourceProperties struct { + // REQUIRED; ID GUID of the availability group. + AvailabilityGroupID *string + + // the availability group name. + AvailabilityGroupName *string + + // null + Configure *AvailabilityGroupConfigure + + // null + State *AvailabilityGroupState + + // READ-ONLY; The provisioning state of the Arc-enabled SQL Server availability group resource. + ProvisioningState *string +} + +// SQLServerAvailabilityGroupUpdate - An update to availability group resource. +type SQLServerAvailabilityGroupUpdate struct { + // The Server Availability Group's properties + Properties *SQLServerAvailabilityGroupResourceProperties + + // Resource tags. + Tags map[string]*string +} + +// SQLServerAvailabilityGroupsClientCreateOptions contains the optional parameters for the SQLServerAvailabilityGroupsClient.Create +// method. +type SQLServerAvailabilityGroupsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// SQLServerAvailabilityGroupsClientDeleteOptions contains the optional parameters for the SQLServerAvailabilityGroupsClient.Delete +// method. +type SQLServerAvailabilityGroupsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SQLServerAvailabilityGroupsClientGetOptions contains the optional parameters for the SQLServerAvailabilityGroupsClient.Get +// method. +type SQLServerAvailabilityGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SQLServerAvailabilityGroupsClientListOptions contains the optional parameters for the SQLServerAvailabilityGroupsClient.NewListPager +// method. +type SQLServerAvailabilityGroupsClientListOptions struct { + // placeholder for future optional parameters +} + +// SQLServerAvailabilityGroupsClientUpdateOptions contains the optional parameters for the SQLServerAvailabilityGroupsClient.Update +// method. +type SQLServerAvailabilityGroupsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// SQLServerDatabaseResource - Arc Sql Server database +type SQLServerDatabaseResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // REQUIRED; Properties of Arc Sql Server database + Properties *SQLServerDatabaseResourceProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SQLServerDatabaseResourceProperties - The properties of Arc Sql Server database resource +type SQLServerDatabaseResourceProperties struct { + BackupInformation *SQLServerDatabaseResourcePropertiesBackupInformation + + // Collation of the database. + CollationName *string + + // Compatibility level of the database + CompatibilityLevel *int32 + + // Creation date of the database. + DatabaseCreationDate *time.Time + + // List of features that are enabled for the database + DatabaseOptions *SQLServerDatabaseResourcePropertiesDatabaseOptions + + // Whether the database is read only or not. + IsReadOnly *bool + + // Status of the database. + RecoveryMode *RecoveryMode + + // Size of the database. + SizeMB *float32 + + // Space left of the database. + SpaceAvailableMB *float32 + + // State of the database. + State *DatabaseState + + // READ-ONLY; The provisioning state of the Arc-enabled SQL Server database resource. + ProvisioningState *string +} + +type SQLServerDatabaseResourcePropertiesBackupInformation struct { + // Date time of last full backup. + LastFullBackup *time.Time + + // Date time of last log backup. + LastLogBackup *time.Time +} + +// SQLServerDatabaseResourcePropertiesDatabaseOptions - List of features that are enabled for the database +type SQLServerDatabaseResourcePropertiesDatabaseOptions struct { + IsAutoCloseOn *bool + IsAutoCreateStatsOn *bool + IsAutoShrinkOn *bool + IsAutoUpdateStatsOn *bool + IsEncrypted *bool + IsMemoryOptimizationEnabled *bool + IsRemoteDataArchiveEnabled *bool + IsTrustworthyOn *bool +} + +// SQLServerDatabaseUpdate - An update to database resource. +type SQLServerDatabaseUpdate struct { + // The data controller's properties + Properties *SQLServerDatabaseResourceProperties + + // Resource tags. + Tags map[string]*string +} + +// SQLServerDatabasesClientCreateOptions contains the optional parameters for the SQLServerDatabasesClient.Create method. +type SQLServerDatabasesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// SQLServerDatabasesClientDeleteOptions contains the optional parameters for the SQLServerDatabasesClient.Delete method. +type SQLServerDatabasesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SQLServerDatabasesClientGetOptions contains the optional parameters for the SQLServerDatabasesClient.Get method. +type SQLServerDatabasesClientGetOptions struct { + // placeholder for future optional parameters +} + +// SQLServerDatabasesClientListOptions contains the optional parameters for the SQLServerDatabasesClient.NewListPager method. +type SQLServerDatabasesClientListOptions struct { + // placeholder for future optional parameters +} + +// SQLServerDatabasesClientUpdateOptions contains the optional parameters for the SQLServerDatabasesClient.Update method. +type SQLServerDatabasesClientUpdateOptions struct { + // placeholder for future optional parameters +} + // SQLServerInstance - A SqlServerInstance. type SQLServerInstance struct { // REQUIRED; The geo-location where the resource lives @@ -824,6 +1517,9 @@ type SQLServerInstanceProperties struct { // SQL Server collation. Collation *string + // The number of total cores of the Operating System Environment (OSE) hosting the SQL Server instance. + Cores *string + // SQL Server current version. CurrentVersion *string diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/models_serde.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/models_serde.go index cef3cade467e..540bac6d22ad 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/models_serde.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/models_serde.go @@ -377,6 +377,252 @@ func (a *ActiveDirectoryInformation) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ArcSQLAvailabilityGroupDatabasesListResult. +func (a ArcSQLAvailabilityGroupDatabasesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSQLAvailabilityGroupDatabasesListResult. +func (a *ArcSQLAvailabilityGroupDatabasesListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 ArcSQLAvailabilityGroupReplicaListResult. +func (a ArcSQLAvailabilityGroupReplicaListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSQLAvailabilityGroupReplicaListResult. +func (a *ArcSQLAvailabilityGroupReplicaListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 ArcSQLServerAvailabilityGroupListResult. +func (a ArcSQLServerAvailabilityGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSQLServerAvailabilityGroupListResult. +func (a *ArcSQLServerAvailabilityGroupListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 ArcSQLServerDatabaseListResult. +func (a ArcSQLServerDatabaseListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSQLServerDatabaseListResult. +func (a *ArcSQLServerDatabaseListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 AvailabilityGroupConfigure. +func (a AvailabilityGroupConfigure) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityModeDesc", a.AvailabilityModeDesc) + populate(objectMap, "backupPriority", a.BackupPriority) + populateTimeRFC3339(objectMap, "createDate", a.CreateDate) + populate(objectMap, "endpointUrl", a.EndpointURL) + populate(objectMap, "failoverModeDesc", a.FailoverModeDesc) + populateTimeRFC3339(objectMap, "modifyDate", a.ModifyDate) + populate(objectMap, "primaryRoleAllowConnectionsDesc", a.PrimaryRoleAllowConnectionsDesc) + populate(objectMap, "readOnlyRoutingUrl", a.ReadOnlyRoutingURL) + populate(objectMap, "readWriteRoutingUrl", a.ReadWriteRoutingURL) + populate(objectMap, "secondaryRoleAllowConnectionsDesc", a.SecondaryRoleAllowConnectionsDesc) + populate(objectMap, "seedingModeDesc", a.SeedingModeDesc) + populate(objectMap, "sessionTimeout", a.SessionTimeout) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityGroupConfigure. +func (a *AvailabilityGroupConfigure) 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 "availabilityModeDesc": + err = unpopulate(val, "AvailabilityModeDesc", &a.AvailabilityModeDesc) + delete(rawMsg, key) + case "backupPriority": + err = unpopulate(val, "BackupPriority", &a.BackupPriority) + delete(rawMsg, key) + case "createDate": + err = unpopulateTimeRFC3339(val, "CreateDate", &a.CreateDate) + delete(rawMsg, key) + case "endpointUrl": + err = unpopulate(val, "EndpointURL", &a.EndpointURL) + delete(rawMsg, key) + case "failoverModeDesc": + err = unpopulate(val, "FailoverModeDesc", &a.FailoverModeDesc) + delete(rawMsg, key) + case "modifyDate": + err = unpopulateTimeRFC3339(val, "ModifyDate", &a.ModifyDate) + delete(rawMsg, key) + case "primaryRoleAllowConnectionsDesc": + err = unpopulate(val, "PrimaryRoleAllowConnectionsDesc", &a.PrimaryRoleAllowConnectionsDesc) + delete(rawMsg, key) + case "readOnlyRoutingUrl": + err = unpopulate(val, "ReadOnlyRoutingURL", &a.ReadOnlyRoutingURL) + delete(rawMsg, key) + case "readWriteRoutingUrl": + err = unpopulate(val, "ReadWriteRoutingURL", &a.ReadWriteRoutingURL) + delete(rawMsg, key) + case "secondaryRoleAllowConnectionsDesc": + err = unpopulate(val, "SecondaryRoleAllowConnectionsDesc", &a.SecondaryRoleAllowConnectionsDesc) + delete(rawMsg, key) + case "seedingModeDesc": + err = unpopulate(val, "SeedingModeDesc", &a.SeedingModeDesc) + delete(rawMsg, key) + case "sessionTimeout": + err = unpopulate(val, "SessionTimeout", &a.SessionTimeout) + 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 AvailabilityGroupState. +func (a AvailabilityGroupState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityGroupReplicaRole", a.AvailabilityGroupReplicaRole) + populate(objectMap, "connectedStateDesc", a.ConnectedStateDesc) + populate(objectMap, "lastConnectErrorDescription", a.LastConnectErrorDescription) + populateTimeRFC3339(objectMap, "lastConnectErrorTimestamp", a.LastConnectErrorTimestamp) + populate(objectMap, "operationalStateDesc", a.OperationalStateDesc) + populate(objectMap, "recoveryHealthDesc", a.RecoveryHealthDesc) + populate(objectMap, "synchronizationHealthDesc", a.SynchronizationHealthDesc) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityGroupState. +func (a *AvailabilityGroupState) 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 "availabilityGroupReplicaRole": + err = unpopulate(val, "AvailabilityGroupReplicaRole", &a.AvailabilityGroupReplicaRole) + delete(rawMsg, key) + case "connectedStateDesc": + err = unpopulate(val, "ConnectedStateDesc", &a.ConnectedStateDesc) + delete(rawMsg, key) + case "lastConnectErrorDescription": + err = unpopulate(val, "LastConnectErrorDescription", &a.LastConnectErrorDescription) + delete(rawMsg, key) + case "lastConnectErrorTimestamp": + err = unpopulateTimeRFC3339(val, "LastConnectErrorTimestamp", &a.LastConnectErrorTimestamp) + delete(rawMsg, key) + case "operationalStateDesc": + err = unpopulate(val, "OperationalStateDesc", &a.OperationalStateDesc) + delete(rawMsg, key) + case "recoveryHealthDesc": + err = unpopulate(val, "RecoveryHealthDesc", &a.RecoveryHealthDesc) + delete(rawMsg, key) + case "synchronizationHealthDesc": + err = unpopulate(val, "SynchronizationHealthDesc", &a.SynchronizationHealthDesc) + 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 BasicLoginInformation. func (b BasicLoginInformation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -709,154 +955,348 @@ func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type K8SResourceRequirements. -func (k K8SResourceRequirements) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FailoverGroupListResult. +func (f FailoverGroupListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "limits", k.Limits) - populate(objectMap, "requests", k.Requests) - if k.AdditionalProperties != nil { - for key, val := range k.AdditionalProperties { - objectMap[key] = val - } - } + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type K8SResourceRequirements. -func (k *K8SResourceRequirements) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverGroupListResult. +func (f *FailoverGroupListResult) 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) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } for key, val := range rawMsg { var err error switch key { - case "limits": - err = unpopulate(val, "Limits", &k.Limits) - delete(rawMsg, key) - case "requests": - err = unpopulate(val, "Requests", &k.Requests) + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) delete(rawMsg, key) - default: - if k.AdditionalProperties == nil { - k.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - k.AdditionalProperties[key] = aux - } + case "value": + err = unpopulate(val, "Value", &f.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type K8SScheduling. -func (k K8SScheduling) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FailoverGroupProperties. +func (f FailoverGroupProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "default", k.Default) - if k.AdditionalProperties != nil { - for key, val := range k.AdditionalProperties { + populate(objectMap, "partnerManagedInstanceId", f.PartnerManagedInstanceID) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "spec", f.Spec) + populateAny(objectMap, "status", f.Status) + if f.AdditionalProperties != nil { + for key, val := range f.AdditionalProperties { objectMap[key] = val } } return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type K8SScheduling. -func (k *K8SScheduling) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverGroupProperties. +func (f *FailoverGroupProperties) 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) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } for key, val := range rawMsg { var err error switch key { - case "default": - err = unpopulate(val, "Default", &k.Default) + case "partnerManagedInstanceId": + err = unpopulate(val, "PartnerManagedInstanceID", &f.PartnerManagedInstanceID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "spec": + err = unpopulate(val, "Spec", &f.Spec) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &f.Status) delete(rawMsg, key) default: - if k.AdditionalProperties == nil { - k.AdditionalProperties = map[string]any{} + if f.AdditionalProperties == nil { + f.AdditionalProperties = map[string]any{} } if val != nil { var aux any err = json.Unmarshal(val, &aux) - k.AdditionalProperties[key] = aux + f.AdditionalProperties[key] = aux } delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type K8SSchedulingOptions. -func (k K8SSchedulingOptions) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FailoverGroupResource. +func (f FailoverGroupResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "resources", k.Resources) - if k.AdditionalProperties != nil { - for key, val := range k.AdditionalProperties { - objectMap[key] = val - } - } + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type K8SSchedulingOptions. -func (k *K8SSchedulingOptions) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverGroupResource. +func (f *FailoverGroupResource) 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) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } for key, val := range rawMsg { var err error switch key { - case "resources": - err = unpopulate(val, "Resources", &k.Resources) + case "id": + err = unpopulate(val, "ID", &f.ID) delete(rawMsg, key) - default: - if k.AdditionalProperties == nil { - k.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - k.AdditionalProperties[key] = aux - } + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type KeytabInformation. -func (k KeytabInformation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FailoverGroupSpec. +func (f FailoverGroupSpec) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "keytab", k.Keytab) + populate(objectMap, "partnerMI", f.PartnerMI) + populate(objectMap, "partnerMirroringCert", f.PartnerMirroringCert) + populate(objectMap, "partnerMirroringURL", f.PartnerMirroringURL) + populate(objectMap, "partnerSyncMode", f.PartnerSyncMode) + populate(objectMap, "role", f.Role) + populate(objectMap, "sharedName", f.SharedName) + populate(objectMap, "sourceMI", f.SourceMI) + if f.AdditionalProperties != nil { + for key, val := range f.AdditionalProperties { + objectMap[key] = val + } + } return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type KeytabInformation. -func (k *KeytabInformation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverGroupSpec. +func (f *FailoverGroupSpec) 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) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } for key, val := range rawMsg { var err error switch key { - case "keytab": - err = unpopulate(val, "Keytab", &k.Keytab) + case "partnerMI": + err = unpopulate(val, "PartnerMI", &f.PartnerMI) + delete(rawMsg, key) + case "partnerMirroringCert": + err = unpopulate(val, "PartnerMirroringCert", &f.PartnerMirroringCert) + delete(rawMsg, key) + case "partnerMirroringURL": + err = unpopulate(val, "PartnerMirroringURL", &f.PartnerMirroringURL) + delete(rawMsg, key) + case "partnerSyncMode": + err = unpopulate(val, "PartnerSyncMode", &f.PartnerSyncMode) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &f.Role) + delete(rawMsg, key) + case "sharedName": + err = unpopulate(val, "SharedName", &f.SharedName) + delete(rawMsg, key) + case "sourceMI": + err = unpopulate(val, "SourceMI", &f.SourceMI) + delete(rawMsg, key) + default: + if f.AdditionalProperties == nil { + f.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + f.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type K8SResourceRequirements. +func (k K8SResourceRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "limits", k.Limits) + populate(objectMap, "requests", k.Requests) + if k.AdditionalProperties != nil { + for key, val := range k.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type K8SResourceRequirements. +func (k *K8SResourceRequirements) 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 "limits": + err = unpopulate(val, "Limits", &k.Limits) + delete(rawMsg, key) + case "requests": + err = unpopulate(val, "Requests", &k.Requests) + delete(rawMsg, key) + default: + if k.AdditionalProperties == nil { + k.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + k.AdditionalProperties[key] = aux + } + 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 K8SScheduling. +func (k K8SScheduling) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "default", k.Default) + if k.AdditionalProperties != nil { + for key, val := range k.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type K8SScheduling. +func (k *K8SScheduling) 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 "default": + err = unpopulate(val, "Default", &k.Default) + delete(rawMsg, key) + default: + if k.AdditionalProperties == nil { + k.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + k.AdditionalProperties[key] = aux + } + 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 K8SSchedulingOptions. +func (k K8SSchedulingOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resources", k.Resources) + if k.AdditionalProperties != nil { + for key, val := range k.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type K8SSchedulingOptions. +func (k *K8SSchedulingOptions) 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 "resources": + err = unpopulate(val, "Resources", &k.Resources) + delete(rawMsg, key) + default: + if k.AdditionalProperties == nil { + k.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + k.AdditionalProperties[key] = aux + } + 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 KeytabInformation. +func (k KeytabInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keytab", k.Keytab) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeytabInformation. +func (k *KeytabInformation) 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 "keytab": + err = unpopulate(val, "Keytab", &k.Keytab) delete(rawMsg, key) } if err != nil { @@ -1369,23 +1809,21 @@ func (r *Resource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstance. -func (s SQLManagedInstance) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityGroup. +func (s SQLAvailabilityGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "extendedLocation", s.ExtendedLocation) populate(objectMap, "id", s.ID) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) - populate(objectMap, "sku", s.SKU) populate(objectMap, "systemData", s.SystemData) populate(objectMap, "tags", s.Tags) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstance. -func (s *SQLManagedInstance) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityGroup. +func (s *SQLAvailabilityGroup) 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", s, err) @@ -1393,9 +1831,6 @@ func (s *SQLManagedInstance) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "extendedLocation": - err = unpopulate(val, "ExtendedLocation", &s.ExtendedLocation) - delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) @@ -1408,9 +1843,6 @@ func (s *SQLManagedInstance) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &s.SKU) - delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &s.SystemData) delete(rawMsg, key) @@ -1428,20 +1860,24 @@ func (s *SQLManagedInstance) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstanceK8SRaw. -func (s SQLManagedInstanceK8SRaw) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityGroupDatabaseReplicaResourceProperties. +func (s SQLAvailabilityGroupDatabaseReplicaResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "spec", s.Spec) - if s.AdditionalProperties != nil { - for key, val := range s.AdditionalProperties { - objectMap[key] = val - } - } + populate(objectMap, "databaseStateDesc", s.DatabaseStateDesc) + populate(objectMap, "isCommitParticipant", s.IsCommitParticipant) + populate(objectMap, "isLocal", s.IsLocal) + populate(objectMap, "isPrimaryReplica", s.IsPrimaryReplica) + populate(objectMap, "isSuspended", s.IsSuspended) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "replicaName", s.ReplicaName) + populate(objectMap, "suspendReasonDesc", s.SuspendReasonDesc) + populate(objectMap, "synchronizationHealthDesc", s.SynchronizationHealthDesc) + populate(objectMap, "synchronizationStateDesc", s.SynchronizationStateDesc) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceK8SRaw. -func (s *SQLManagedInstanceK8SRaw) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityGroupDatabaseReplicaResourceProperties. +func (s *SQLAvailabilityGroupDatabaseReplicaResourceProperties) 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", s, err) @@ -1449,18 +1885,35 @@ func (s *SQLManagedInstanceK8SRaw) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "spec": - err = unpopulate(val, "Spec", &s.Spec) + case "databaseStateDesc": + err = unpopulate(val, "DatabaseStateDesc", &s.DatabaseStateDesc) delete(rawMsg, key) - default: - if s.AdditionalProperties == nil { - s.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - s.AdditionalProperties[key] = aux - } + case "isCommitParticipant": + err = unpopulate(val, "IsCommitParticipant", &s.IsCommitParticipant) + delete(rawMsg, key) + case "isLocal": + err = unpopulate(val, "IsLocal", &s.IsLocal) + delete(rawMsg, key) + case "isPrimaryReplica": + err = unpopulate(val, "IsPrimaryReplica", &s.IsPrimaryReplica) + delete(rawMsg, key) + case "isSuspended": + err = unpopulate(val, "IsSuspended", &s.IsSuspended) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "replicaName": + err = unpopulate(val, "ReplicaName", &s.ReplicaName) + delete(rawMsg, key) + case "suspendReasonDesc": + err = unpopulate(val, "SuspendReasonDesc", &s.SuspendReasonDesc) + delete(rawMsg, key) + case "synchronizationHealthDesc": + err = unpopulate(val, "SynchronizationHealthDesc", &s.SynchronizationHealthDesc) + delete(rawMsg, key) + case "synchronizationStateDesc": + err = unpopulate(val, "SynchronizationStateDesc", &s.SynchronizationStateDesc) delete(rawMsg, key) } if err != nil { @@ -1470,21 +1923,21 @@ func (s *SQLManagedInstanceK8SRaw) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstanceK8SSpec. -func (s SQLManagedInstanceK8SSpec) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityGroupDatabaseResource. +func (s SQLAvailabilityGroupDatabaseResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "replicas", s.Replicas) - populate(objectMap, "scheduling", s.Scheduling) - if s.AdditionalProperties != nil { - for key, val := range s.AdditionalProperties { - objectMap[key] = val - } - } + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceK8SSpec. -func (s *SQLManagedInstanceK8SSpec) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityGroupDatabaseResource. +func (s *SQLAvailabilityGroupDatabaseResource) 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", s, err) @@ -1492,40 +1945,660 @@ func (s *SQLManagedInstanceK8SSpec) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "replicas": - err = unpopulate(val, "Replicas", &s.Replicas) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "scheduling": - err = unpopulate(val, "Scheduling", &s.Scheduling) + case "location": + err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) - default: - if s.AdditionalProperties == nil { - s.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - s.AdditionalProperties[key] = aux - } + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityGroupDatabaseUpdate. +func (s SQLAvailabilityGroupDatabaseUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityGroupDatabaseUpdate. +func (s *SQLAvailabilityGroupDatabaseUpdate) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityGroupListResult. +func (s SQLAvailabilityGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityGroupListResult. +func (s *SQLAvailabilityGroupListResult) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityGroupMultiDatabaseReplicaResourceProperties. +func (s SQLAvailabilityGroupMultiDatabaseReplicaResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupDatabaseId", s.GroupDatabaseID) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityGroupMultiDatabaseReplicaResourceProperties. +func (s *SQLAvailabilityGroupMultiDatabaseReplicaResourceProperties) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupDatabaseId": + err = unpopulate(val, "GroupDatabaseID", &s.GroupDatabaseID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityGroupProperties. +func (s SQLAvailabilityGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityGroupId", s.AvailabilityGroupID) + populate(objectMap, "availabilityGroupName", s.AvailabilityGroupName) + populate(objectMap, "basicFeatures", s.BasicFeatures) + populate(objectMap, "clusterTypeDesc", s.ClusterTypeDesc) + populateTimeRFC3339(objectMap, "collectionTimestamp", s.CollectionTimestamp) + populate(objectMap, "dbFailover", s.DbFailover) + populate(objectMap, "dtcSupport", s.DtcSupport) + populate(objectMap, "instanceName", s.InstanceName) + populate(objectMap, "isContained", s.IsContained) + populate(objectMap, "isDistributed", s.IsDistributed) + populate(objectMap, "requiredSynchronizedSecondariesCommit", s.RequiredSynchronizedSecondariesCommit) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityGroupProperties. +func (s *SQLAvailabilityGroupProperties) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilityGroupId": + err = unpopulate(val, "AvailabilityGroupID", &s.AvailabilityGroupID) + delete(rawMsg, key) + case "availabilityGroupName": + err = unpopulate(val, "AvailabilityGroupName", &s.AvailabilityGroupName) + delete(rawMsg, key) + case "basicFeatures": + err = unpopulate(val, "BasicFeatures", &s.BasicFeatures) + delete(rawMsg, key) + case "clusterTypeDesc": + err = unpopulate(val, "ClusterTypeDesc", &s.ClusterTypeDesc) + delete(rawMsg, key) + case "collectionTimestamp": + err = unpopulateTimeRFC3339(val, "CollectionTimestamp", &s.CollectionTimestamp) + delete(rawMsg, key) + case "dbFailover": + err = unpopulate(val, "DbFailover", &s.DbFailover) + delete(rawMsg, key) + case "dtcSupport": + err = unpopulate(val, "DtcSupport", &s.DtcSupport) + delete(rawMsg, key) + case "instanceName": + err = unpopulate(val, "InstanceName", &s.InstanceName) + delete(rawMsg, key) + case "isContained": + err = unpopulate(val, "IsContained", &s.IsContained) + delete(rawMsg, key) + case "isDistributed": + err = unpopulate(val, "IsDistributed", &s.IsDistributed) + delete(rawMsg, key) + case "requiredSynchronizedSecondariesCommit": + err = unpopulate(val, "RequiredSynchronizedSecondariesCommit", &s.RequiredSynchronizedSecondariesCommit) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityGroupReplicaResource. +func (s SQLAvailabilityGroupReplicaResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityGroupReplicaResource. +func (s *SQLAvailabilityGroupReplicaResource) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityGroupReplicaResourceProperties. +func (s SQLAvailabilityGroupReplicaResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "configure", s.Configure) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "replicaId", s.ReplicaID) + populate(objectMap, "replicaName", s.ReplicaName) + populate(objectMap, "state", s.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityGroupReplicaResourceProperties. +func (s *SQLAvailabilityGroupReplicaResourceProperties) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configure": + err = unpopulate(val, "Configure", &s.Configure) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "replicaId": + err = unpopulate(val, "ReplicaID", &s.ReplicaID) + delete(rawMsg, key) + case "replicaName": + err = unpopulate(val, "ReplicaName", &s.ReplicaName) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &s.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityGroupReplicaUpdate. +func (s SQLAvailabilityGroupReplicaUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityGroupReplicaUpdate. +func (s *SQLAvailabilityGroupReplicaUpdate) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLAvailabilityGroupUpdate. +func (s SQLAvailabilityGroupUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLAvailabilityGroupUpdate. +func (s *SQLAvailabilityGroupUpdate) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstance. +func (s SQLManagedInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", s.ExtendedLocation) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "sku", s.SKU) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstance. +func (s *SQLManagedInstance) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &s.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &s.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstanceK8SRaw. +func (s SQLManagedInstanceK8SRaw) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "spec", s.Spec) + if s.AdditionalProperties != nil { + for key, val := range s.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceK8SRaw. +func (s *SQLManagedInstanceK8SRaw) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "spec": + err = unpopulate(val, "Spec", &s.Spec) + delete(rawMsg, key) + default: + if s.AdditionalProperties == nil { + s.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + s.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstanceK8SSpec. +func (s SQLManagedInstanceK8SSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "replicas", s.Replicas) + populate(objectMap, "scheduling", s.Scheduling) + if s.AdditionalProperties != nil { + for key, val := range s.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceK8SSpec. +func (s *SQLManagedInstanceK8SSpec) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "replicas": + err = unpopulate(val, "Replicas", &s.Replicas) + delete(rawMsg, key) + case "scheduling": + err = unpopulate(val, "Scheduling", &s.Scheduling) + delete(rawMsg, key) + default: + if s.AdditionalProperties == nil { + s.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + s.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstanceListResult. +func (s SQLManagedInstanceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceListResult. +func (s *SQLManagedInstanceListResult) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstanceProperties. +func (s SQLManagedInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "activeDirectoryInformation", s.ActiveDirectoryInformation) + populate(objectMap, "admin", s.Admin) + populate(objectMap, "basicLoginInformation", s.BasicLoginInformation) + populate(objectMap, "clusterId", s.ClusterID) + populate(objectMap, "dataControllerId", s.DataControllerID) + populate(objectMap, "endTime", s.EndTime) + populate(objectMap, "extensionId", s.ExtensionID) + populate(objectMap, "k8sRaw", s.K8SRaw) + populateTimeRFC3339(objectMap, "lastUploadedDate", s.LastUploadedDate) + populate(objectMap, "licenseType", s.LicenseType) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "startTime", s.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceProperties. +func (s *SQLManagedInstanceProperties) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activeDirectoryInformation": + err = unpopulate(val, "ActiveDirectoryInformation", &s.ActiveDirectoryInformation) + delete(rawMsg, key) + case "admin": + err = unpopulate(val, "Admin", &s.Admin) + delete(rawMsg, key) + case "basicLoginInformation": + err = unpopulate(val, "BasicLoginInformation", &s.BasicLoginInformation) + delete(rawMsg, key) + case "clusterId": + err = unpopulate(val, "ClusterID", &s.ClusterID) + delete(rawMsg, key) + case "dataControllerId": + err = unpopulate(val, "DataControllerID", &s.DataControllerID) + delete(rawMsg, key) + case "endTime": + err = unpopulate(val, "EndTime", &s.EndTime) + delete(rawMsg, key) + case "extensionId": + err = unpopulate(val, "ExtensionID", &s.ExtensionID) + delete(rawMsg, key) + case "k8sRaw": + err = unpopulate(val, "K8SRaw", &s.K8SRaw) + delete(rawMsg, key) + case "lastUploadedDate": + err = unpopulateTimeRFC3339(val, "LastUploadedDate", &s.LastUploadedDate) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, "LicenseType", &s.LicenseType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &s.StartTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstanceSKU. +func (s SQLManagedInstanceSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "dev", s.Dev) + populate(objectMap, "family", s.Family) + objectMap["name"] = "vCore" + populate(objectMap, "size", s.Size) + populate(objectMap, "tier", s.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceSKU. +func (s *SQLManagedInstanceSKU) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &s.Capacity) + delete(rawMsg, key) + case "dev": + err = unpopulate(val, "Dev", &s.Dev) + delete(rawMsg, key) + case "family": + err = unpopulate(val, "Family", &s.Family) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &s.Size) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &s.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstanceListResult. -func (s SQLManagedInstanceListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstanceUpdate. +func (s SQLManagedInstanceUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + populate(objectMap, "tags", s.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceListResult. -func (s *SQLManagedInstanceListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceUpdate. +func (s *SQLManagedInstanceUpdate) 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", s, err) @@ -1533,11 +2606,8 @@ func (s *SQLManagedInstanceListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) } if err != nil { @@ -1547,26 +2617,21 @@ func (s *SQLManagedInstanceListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstanceProperties. -func (s SQLManagedInstanceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLServerAvailabilityGroupResource. +func (s SQLServerAvailabilityGroupResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "activeDirectoryInformation", s.ActiveDirectoryInformation) - populate(objectMap, "admin", s.Admin) - populate(objectMap, "basicLoginInformation", s.BasicLoginInformation) - populate(objectMap, "clusterId", s.ClusterID) - populate(objectMap, "dataControllerId", s.DataControllerID) - populate(objectMap, "endTime", s.EndTime) - populate(objectMap, "extensionId", s.ExtensionID) - populate(objectMap, "k8sRaw", s.K8SRaw) - populateTimeRFC3339(objectMap, "lastUploadedDate", s.LastUploadedDate) - populate(objectMap, "licenseType", s.LicenseType) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "startTime", s.StartTime) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceProperties. -func (s *SQLManagedInstanceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerAvailabilityGroupResource. +func (s *SQLServerAvailabilityGroupResource) 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", s, err) @@ -1574,41 +2639,69 @@ func (s *SQLManagedInstanceProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "activeDirectoryInformation": - err = unpopulate(val, "ActiveDirectoryInformation", &s.ActiveDirectoryInformation) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "admin": - err = unpopulate(val, "Admin", &s.Admin) + case "location": + err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) - case "basicLoginInformation": - err = unpopulate(val, "BasicLoginInformation", &s.BasicLoginInformation) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "clusterId": - err = unpopulate(val, "ClusterID", &s.ClusterID) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "dataControllerId": - err = unpopulate(val, "DataControllerID", &s.DataControllerID) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) delete(rawMsg, key) - case "endTime": - err = unpopulate(val, "EndTime", &s.EndTime) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) - case "extensionId": - err = unpopulate(val, "ExtensionID", &s.ExtensionID) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) - case "k8sRaw": - err = unpopulate(val, "K8SRaw", &s.K8SRaw) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLServerAvailabilityGroupResourceProperties. +func (s SQLServerAvailabilityGroupResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityGroupId", s.AvailabilityGroupID) + populate(objectMap, "availabilityGroupName", s.AvailabilityGroupName) + populate(objectMap, "configure", s.Configure) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "state", s.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerAvailabilityGroupResourceProperties. +func (s *SQLServerAvailabilityGroupResourceProperties) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilityGroupId": + err = unpopulate(val, "AvailabilityGroupID", &s.AvailabilityGroupID) delete(rawMsg, key) - case "lastUploadedDate": - err = unpopulateTimeRFC3339(val, "LastUploadedDate", &s.LastUploadedDate) + case "availabilityGroupName": + err = unpopulate(val, "AvailabilityGroupName", &s.AvailabilityGroupName) delete(rawMsg, key) - case "licenseType": - err = unpopulate(val, "LicenseType", &s.LicenseType) + case "configure": + err = unpopulate(val, "Configure", &s.Configure) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) delete(rawMsg, key) - case "startTime": - err = unpopulate(val, "StartTime", &s.StartTime) + case "state": + err = unpopulate(val, "State", &s.State) delete(rawMsg, key) } if err != nil { @@ -1618,20 +2711,16 @@ func (s *SQLManagedInstanceProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstanceSKU. -func (s SQLManagedInstanceSKU) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLServerAvailabilityGroupUpdate. +func (s SQLServerAvailabilityGroupUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "capacity", s.Capacity) - populate(objectMap, "dev", s.Dev) - populate(objectMap, "family", s.Family) - objectMap["name"] = "vCore" - populate(objectMap, "size", s.Size) - populate(objectMap, "tier", s.Tier) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceSKU. -func (s *SQLManagedInstanceSKU) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerAvailabilityGroupUpdate. +func (s *SQLServerAvailabilityGroupUpdate) 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", s, err) @@ -1639,23 +2728,62 @@ func (s *SQLManagedInstanceSKU) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "capacity": - err = unpopulate(val, "Capacity", &s.Capacity) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "dev": - err = unpopulate(val, "Dev", &s.Dev) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) - case "family": - err = unpopulate(val, "Family", &s.Family) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLServerDatabaseResource. +func (s SQLServerDatabaseResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerDatabaseResource. +func (s *SQLServerDatabaseResource) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "size": - err = unpopulate(val, "Size", &s.Size) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "tier": - err = unpopulate(val, "Tier", &s.Tier) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { @@ -1665,15 +2793,169 @@ func (s *SQLManagedInstanceSKU) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstanceUpdate. -func (s SQLManagedInstanceUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLServerDatabaseResourceProperties. +func (s SQLServerDatabaseResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupInformation", s.BackupInformation) + populate(objectMap, "collationName", s.CollationName) + populate(objectMap, "compatibilityLevel", s.CompatibilityLevel) + populateTimeRFC3339(objectMap, "databaseCreationDate", s.DatabaseCreationDate) + populate(objectMap, "databaseOptions", s.DatabaseOptions) + populate(objectMap, "isReadOnly", s.IsReadOnly) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "recoveryMode", s.RecoveryMode) + populate(objectMap, "sizeMB", s.SizeMB) + populate(objectMap, "spaceAvailableMB", s.SpaceAvailableMB) + populate(objectMap, "state", s.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerDatabaseResourceProperties. +func (s *SQLServerDatabaseResourceProperties) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupInformation": + err = unpopulate(val, "BackupInformation", &s.BackupInformation) + delete(rawMsg, key) + case "collationName": + err = unpopulate(val, "CollationName", &s.CollationName) + delete(rawMsg, key) + case "compatibilityLevel": + err = unpopulate(val, "CompatibilityLevel", &s.CompatibilityLevel) + delete(rawMsg, key) + case "databaseCreationDate": + err = unpopulateTimeRFC3339(val, "DatabaseCreationDate", &s.DatabaseCreationDate) + delete(rawMsg, key) + case "databaseOptions": + err = unpopulate(val, "DatabaseOptions", &s.DatabaseOptions) + delete(rawMsg, key) + case "isReadOnly": + err = unpopulate(val, "IsReadOnly", &s.IsReadOnly) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "recoveryMode": + err = unpopulate(val, "RecoveryMode", &s.RecoveryMode) + delete(rawMsg, key) + case "sizeMB": + err = unpopulate(val, "SizeMB", &s.SizeMB) + delete(rawMsg, key) + case "spaceAvailableMB": + err = unpopulate(val, "SpaceAvailableMB", &s.SpaceAvailableMB) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &s.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLServerDatabaseResourcePropertiesBackupInformation. +func (s SQLServerDatabaseResourcePropertiesBackupInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "lastFullBackup", s.LastFullBackup) + populateTimeRFC3339(objectMap, "lastLogBackup", s.LastLogBackup) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerDatabaseResourcePropertiesBackupInformation. +func (s *SQLServerDatabaseResourcePropertiesBackupInformation) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lastFullBackup": + err = unpopulateTimeRFC3339(val, "LastFullBackup", &s.LastFullBackup) + delete(rawMsg, key) + case "lastLogBackup": + err = unpopulateTimeRFC3339(val, "LastLogBackup", &s.LastLogBackup) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLServerDatabaseResourcePropertiesDatabaseOptions. +func (s SQLServerDatabaseResourcePropertiesDatabaseOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isAutoCloseOn", s.IsAutoCloseOn) + populate(objectMap, "isAutoCreateStatsOn", s.IsAutoCreateStatsOn) + populate(objectMap, "isAutoShrinkOn", s.IsAutoShrinkOn) + populate(objectMap, "isAutoUpdateStatsOn", s.IsAutoUpdateStatsOn) + populate(objectMap, "isEncrypted", s.IsEncrypted) + populate(objectMap, "isMemoryOptimizationEnabled", s.IsMemoryOptimizationEnabled) + populate(objectMap, "isRemoteDataArchiveEnabled", s.IsRemoteDataArchiveEnabled) + populate(objectMap, "isTrustworthyOn", s.IsTrustworthyOn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerDatabaseResourcePropertiesDatabaseOptions. +func (s *SQLServerDatabaseResourcePropertiesDatabaseOptions) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isAutoCloseOn": + err = unpopulate(val, "IsAutoCloseOn", &s.IsAutoCloseOn) + delete(rawMsg, key) + case "isAutoCreateStatsOn": + err = unpopulate(val, "IsAutoCreateStatsOn", &s.IsAutoCreateStatsOn) + delete(rawMsg, key) + case "isAutoShrinkOn": + err = unpopulate(val, "IsAutoShrinkOn", &s.IsAutoShrinkOn) + delete(rawMsg, key) + case "isAutoUpdateStatsOn": + err = unpopulate(val, "IsAutoUpdateStatsOn", &s.IsAutoUpdateStatsOn) + delete(rawMsg, key) + case "isEncrypted": + err = unpopulate(val, "IsEncrypted", &s.IsEncrypted) + delete(rawMsg, key) + case "isMemoryOptimizationEnabled": + err = unpopulate(val, "IsMemoryOptimizationEnabled", &s.IsMemoryOptimizationEnabled) + delete(rawMsg, key) + case "isRemoteDataArchiveEnabled": + err = unpopulate(val, "IsRemoteDataArchiveEnabled", &s.IsRemoteDataArchiveEnabled) + delete(rawMsg, key) + case "isTrustworthyOn": + err = unpopulate(val, "IsTrustworthyOn", &s.IsTrustworthyOn) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLServerDatabaseUpdate. +func (s SQLServerDatabaseUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) populate(objectMap, "tags", s.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceUpdate. -func (s *SQLManagedInstanceUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerDatabaseUpdate. +func (s *SQLServerDatabaseUpdate) 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", s, err) @@ -1681,6 +2963,9 @@ func (s *SQLManagedInstanceUpdate) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) @@ -1781,6 +3066,7 @@ func (s SQLServerInstanceProperties) MarshalJSON() ([]byte, error) { populateTimeRFC3339(objectMap, "azureDefenderStatusLastUpdated", s.AzureDefenderStatusLastUpdated) populate(objectMap, "collation", s.Collation) populate(objectMap, "containerResourceId", s.ContainerResourceID) + populate(objectMap, "cores", s.Cores) populate(objectMap, "createTime", s.CreateTime) populate(objectMap, "currentVersion", s.CurrentVersion) populate(objectMap, "edition", s.Edition) @@ -1819,6 +3105,9 @@ func (s *SQLServerInstanceProperties) UnmarshalJSON(data []byte) error { case "containerResourceId": err = unpopulate(val, "ContainerResourceID", &s.ContainerResourceID) delete(rawMsg, key) + case "cores": + err = unpopulate(val, "Cores", &s.Cores) + delete(rawMsg, key) case "createTime": err = unpopulate(val, "CreateTime", &s.CreateTime) delete(rawMsg, key) diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/operations_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/operations_client.go index 9725b00fd18d..358032897406 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/operations_client.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/operations_client.go @@ -40,7 +40,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available Azure Data Services on Azure Arc API operations. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-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]{ @@ -78,7 +78,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/operations_client_example_test.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/operations_client_example_test.go deleted file mode 100644 index 2f9d2e6d0733..000000000000 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/operations_client_example_test.go +++ /dev/null @@ -1,346 +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 armazurearcdata_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurearcdata/armazurearcdata" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListOperation.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 := armazurearcdata.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.OperationListResult = armazurearcdata.OperationListResult{ - // Value: []*armazurearcdata.Operation{ - // { - // Name: to.Ptr("Microsoft.AzureArcData/Locations/OperationStatuses/read"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("read OperationStatuses"), - // Operation: to.Ptr("read_OperationStatuses"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("Locations/OperationStatuses"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/Locations/OperationStatuses/write"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("write OperationStatuses"), - // Operation: to.Ptr("write_OperationStatuses"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("Locations/OperationStatuses"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/dataControllers/read"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("read dataControllers"), - // Operation: to.Ptr("DataControllers_ListInSubscription"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("dataControllers"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/dataControllers/read"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("read dataControllers"), - // Operation: to.Ptr("DataControllers_ListInGroup"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("dataControllers"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/dataControllers/read"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Retrieves a dataController resource"), - // Operation: to.Ptr("DataControllers_GetDataController"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("dataControllers"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/dataControllers/write"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Creates or replaces a dataController resource"), - // Operation: to.Ptr("DataControllers_PutDataController"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("dataControllers"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/dataControllers/delete"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Deletes a dataController resource"), - // Operation: to.Ptr("DataControllers_DeleteDataController"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("dataControllers"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/dataControllers/write"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Updates a dataController resource"), - // Operation: to.Ptr("DataControllers_PatchDataController"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("dataControllers"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/sqlManagedInstances/read"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("read sqlManagedInstances"), - // Operation: to.Ptr("SqlManagedInstances_List"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("sqlManagedInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/sqlManagedInstances/read"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Gets all sqlManagedInstances in a resource group."), - // Operation: to.Ptr("SqlManagedInstances_ListByResourceGroup"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("sqlManagedInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/sqlManagedInstances/read"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Retrieves a SQL Managed Instance resource"), - // Operation: to.Ptr("SqlManagedInstances_Get"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("sqlManagedInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/sqlManagedInstances/write"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Creates or replaces a SQL Managed Instance resource"), - // Operation: to.Ptr("SqlManagedInstances_Create"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("sqlManagedInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/sqlManagedInstances/delete"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Deletes a SQL Managed Instance resource"), - // Operation: to.Ptr("SqlManagedInstances_Delete"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("sqlManagedInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/sqlManagedInstances/write"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Updates a SQL Managed Instance resource"), - // Operation: to.Ptr("SqlManagedInstances_Update"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("sqlManagedInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/sqlServerInstances/read"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("read sqlServerInstances"), - // Operation: to.Ptr("SqlServerInstances_List"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("sqlServerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/sqlServerInstances/read"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Gets all sqlServerInstances in a resource group."), - // Operation: to.Ptr("SqlServerInstances_ListByResourceGroup"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("sqlServerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/sqlServerInstances/read"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Retrieves a SQL Server Instance resource"), - // Operation: to.Ptr("SqlServerInstances_Get"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("sqlServerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/sqlServerInstances/write"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Creates or replaces a SQL Server Instance resource"), - // Operation: to.Ptr("SqlServerInstances_Create"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("sqlServerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/sqlServerInstances/delete"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Deletes a SQL Server Instance resource"), - // Operation: to.Ptr("SqlServerInstances_Delete"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("sqlServerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/sqlServerInstances/write"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Updates a SQL Server Instance resource"), - // Operation: to.Ptr("SqlServerInstances_Update"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("sqlServerInstances"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/dataControllers/activeDirectoryConnectors/read"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("read activeDirectoryConnectors"), - // Operation: to.Ptr("ActiveDirectoryConnectors_List"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("dataControllers/activeDirectoryConnectors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/dataControllers/activeDirectoryConnectors/read"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Retrieves an active directory connector resource"), - // Operation: to.Ptr("ActiveDirectoryConnectors_Get"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("dataControllers/activeDirectoryConnectors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/dataControllers/activeDirectoryConnectors/write"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Creates or replaces an active directory connector resource."), - // Operation: to.Ptr("ActiveDirectoryConnectors_Create"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("dataControllers/activeDirectoryConnectors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/dataControllers/activeDirectoryConnectors/delete"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Deletes an active directory connector resource"), - // Operation: to.Ptr("ActiveDirectoryConnectors_Delete"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("dataControllers/activeDirectoryConnectors"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/postgresInstances/read"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Retrieves details of Postgres Instances."), - // Operation: to.Ptr("Get Postgres Instance details."), - // Provider: to.Ptr("Azure Arc Data Resource Provider."), - // Resource: to.Ptr("Microsoft.AzureArcData"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/postgresInstances/write"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Create a new or change properties of existing Postgres Instances."), - // Operation: to.Ptr("Create new or update existing Postgres Instances."), - // Provider: to.Ptr("Azure Arc Data Resource Provider."), - // Resource: to.Ptr("Microsoft.AzureArcData"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/postgresInstances/delete"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Delete exisiting Postgres Instances."), - // Operation: to.Ptr("Delete exisiting Postgres Instances."), - // Provider: to.Ptr("Azure Arc Data Resource Provider."), - // Resource: to.Ptr("Microsoft.AzureArcData"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/register/action"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Register the subscription for Microsoft.AzureArcData"), - // Operation: to.Ptr("Register the Microsoft.AzureArcData"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("Microsoft.AzureArcData"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/unregister/action"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("Unregister the subscription for Microsoft.AzureArcData"), - // Operation: to.Ptr("Unregister the Microsoft.AzureArcData"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("Microsoft.AzureArcData"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureArcData/Operations/read"), - // Display: &armazurearcdata.OperationDisplay{ - // Description: to.Ptr("read Operations"), - // Operation: to.Ptr("read_Operations"), - // Provider: to.Ptr("Microsoft.AzureArcData"), - // Resource: to.Ptr("Operations"), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/postgresinstances_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/postgresinstances_client.go index 88787ef78459..a04602939b51 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/postgresinstances_client.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/postgresinstances_client.go @@ -47,7 +47,7 @@ func NewPostgresInstancesClient(subscriptionID string, credential azcore.TokenCr // BeginCreate - Creates or replaces a postgres Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - postgresInstanceName - Name of Postgres Instance // - resource - The postgres instance @@ -70,7 +70,7 @@ func (client *PostgresInstancesClient) BeginCreate(ctx context.Context, resource // Create - Creates or replaces a postgres Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview func (client *PostgresInstancesClient) create(ctx context.Context, resourceGroupName string, postgresInstanceName string, resource PostgresInstance, options *PostgresInstancesClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, postgresInstanceName, resource, options) if err != nil { @@ -106,7 +106,7 @@ func (client *PostgresInstancesClient) createCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, resource) @@ -115,7 +115,7 @@ func (client *PostgresInstancesClient) createCreateRequest(ctx context.Context, // BeginDelete - Deletes a postgres Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - postgresInstanceName - Name of Postgres Instance // - options - PostgresInstancesClientBeginDeleteOptions contains the optional parameters for the PostgresInstancesClient.BeginDelete @@ -135,7 +135,7 @@ func (client *PostgresInstancesClient) BeginDelete(ctx context.Context, resource // Delete - Deletes a postgres Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview func (client *PostgresInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, postgresInstanceName string, options *PostgresInstancesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, postgresInstanceName, options) if err != nil { @@ -171,7 +171,7 @@ func (client *PostgresInstancesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +180,7 @@ func (client *PostgresInstancesClient) deleteCreateRequest(ctx context.Context, // Get - Retrieves a postgres Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - postgresInstanceName - Name of Postgres Instance // - options - PostgresInstancesClientGetOptions contains the optional parameters for the PostgresInstancesClient.Get method. @@ -219,7 +219,7 @@ func (client *PostgresInstancesClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -236,7 +236,7 @@ func (client *PostgresInstancesClient) getHandleResponse(resp *http.Response) (P // NewListPager - List postgres Instance resources in the subscription // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - options - PostgresInstancesClientListOptions contains the optional parameters for the PostgresInstancesClient.NewListPager // method. func (client *PostgresInstancesClient) NewListPager(options *PostgresInstancesClientListOptions) *runtime.Pager[PostgresInstancesClientListResponse] { @@ -279,7 +279,7 @@ func (client *PostgresInstancesClient) listCreateRequest(ctx context.Context, op return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -296,7 +296,7 @@ func (client *PostgresInstancesClient) listHandleResponse(resp *http.Response) ( // NewListByResourceGroupPager - Get a postgres Instances list by Resource group name. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - options - PostgresInstancesClientListByResourceGroupOptions contains the optional parameters for the PostgresInstancesClient.NewListByResourceGroupPager // method. @@ -344,7 +344,7 @@ func (client *PostgresInstancesClient) listByResourceGroupCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -362,7 +362,7 @@ func (client *PostgresInstancesClient) listByResourceGroupHandleResponse(resp *h // Update - Updates a postgres Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - postgresInstanceName - Name of Postgres Instance // - parameters - The Postgres Instance. @@ -403,7 +403,7 @@ func (client *PostgresInstancesClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/postgresinstances_client_example_test.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/postgresinstances_client_example_test.go deleted file mode 100644 index 7c90fa86e4d1..000000000000 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/postgresinstances_client_example_test.go +++ /dev/null @@ -1,472 +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 armazurearcdata_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/azurearcdata/armazurearcdata" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListSubscriptionPostgresInstance.json -func ExamplePostgresInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPostgresInstancesClient().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.PostgresInstanceListResult = armazurearcdata.PostgresInstanceListResult{ - // Value: []*armazurearcdata.PostgresInstance{ - // { - // Name: to.Ptr("testpostgresInstances1"), - // Type: to.Ptr("Microsoft.AzureArcData/PostgresInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/PostgresInstances/testpostgresInstances1"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.PostgresInstanceProperties{ - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // }, - // SKU: &armazurearcdata.PostgresInstanceSKU{ - // Name: to.Ptr("default"), - // Dev: to.Ptr(true), - // Tier: to.Ptr("Hyperscale"), - // }, - // }, - // { - // Name: to.Ptr("testpostgresInstances2"), - // Type: to.Ptr("Microsoft.AzureArcData/PostgresInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/PostgresInstances/testpostgresInstances2"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.PostgresInstanceProperties{ - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // }, - // SKU: &armazurearcdata.PostgresInstanceSKU{ - // Name: to.Ptr("default"), - // Dev: to.Ptr(true), - // Tier: to.Ptr("Hyperscale"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListByResourceGroupPostgresInstance.json -func ExamplePostgresInstancesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPostgresInstancesClient().NewListByResourceGroupPager("testrg", 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.PostgresInstanceListResult = armazurearcdata.PostgresInstanceListResult{ - // Value: []*armazurearcdata.PostgresInstance{ - // { - // Name: to.Ptr("testpostgresInstances1"), - // Type: to.Ptr("Microsoft.AzureArcData/PostgresInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/PostgresInstances/testpostgresInstances1"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.PostgresInstanceProperties{ - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // }, - // SKU: &armazurearcdata.PostgresInstanceSKU{ - // Name: to.Ptr("default"), - // Dev: to.Ptr(true), - // Tier: to.Ptr("Hyperscale"), - // }, - // }, - // { - // Name: to.Ptr("testpostgresInstances2"), - // Type: to.Ptr("Microsoft.AzureArcData/PostgresInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/PostgresInstances/testpostgresInstances2"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.PostgresInstanceProperties{ - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // }, - // SKU: &armazurearcdata.PostgresInstanceSKU{ - // Name: to.Ptr("default"), - // Dev: to.Ptr(true), - // Tier: to.Ptr("Hyperscale"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/GetPostgresInstance.json -func ExamplePostgresInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPostgresInstancesClient().Get(ctx, "testrg", "testpostgresInstances", 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.PostgresInstance = armazurearcdata.PostgresInstance{ - // Name: to.Ptr("testpostgresInstances"), - // Type: to.Ptr("Microsoft.AzureArcData/PostgresInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/PostgresInstances/testpostgresInstances"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.PostgresInstanceProperties{ - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // }, - // SKU: &armazurearcdata.PostgresInstanceSKU{ - // Name: to.Ptr("default"), - // Dev: to.Ptr(true), - // Tier: to.Ptr("Hyperscale"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/CreateOrUpdatePostgresInstance.json -func ExamplePostgresInstancesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPostgresInstancesClient().BeginCreate(ctx, "testrg", "testpostgresInstance", armazurearcdata.PostgresInstance{ - Location: to.Ptr("eastus"), - ExtendedLocation: &armazurearcdata.ExtendedLocation{ - Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurearcdata.PostgresInstanceProperties{ - Admin: to.Ptr("admin"), - BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - Password: to.Ptr("********"), - Username: to.Ptr("username"), - }, - DataControllerID: to.Ptr("dataControllerId"), - K8SRaw: map[string]any{ - "apiVersion": "apiVersion", - "kind": "postgresql-12", - "metadata": map[string]any{ - "name": "pg1", - "creationTimestamp": "2020-08-25T14:55:10Z", - "generation": float64(1), - "namespace": "test", - "resourceVersion": "527780", - "selfLink": "/apis/arcdata.microsoft.com/v1alpha1/namespaces/test/postgresql-12s/pg1", - "uid": "1111aaaa-ffff-ffff-ffff-99999aaaaaaa", - }, - "spec": map[string]any{ - "backups": map[string]any{ - "deltaMinutes": float64(3), - "fullMinutes": float64(10), - "tiers": []any{ - map[string]any{ - "retention": map[string]any{ - "maximums": []any{ - "6", - "512MB", - }, - "minimums": []any{ - "3", - }, - }, - "storage": map[string]any{ - "volumeSize": "1Gi", - }, - }, - }, - }, - "engine": map[string]any{ - "extensions": []any{ - map[string]any{ - "name": "citus", - }, - }, - }, - "scale": map[string]any{ - "shards": float64(3), - }, - "scheduling": map[string]any{ - "default": map[string]any{ - "resources": map[string]any{ - "requests": map[string]any{ - "memory": "256Mi", - }, - }, - }, - }, - "service": map[string]any{ - "type": "NodePort", - }, - "storage": map[string]any{ - "data": map[string]any{ - "className": "local-storage", - "size": "5Gi", - }, - "logs": map[string]any{ - "className": "local-storage", - "size": "5Gi", - }, - }, - }, - "status": map[string]any{ - "externalEndpoint": nil, - "readyPods": "4/4", - "state": "Ready", - }, - }, - }, - SKU: &armazurearcdata.PostgresInstanceSKU{ - Name: to.Ptr("default"), - Dev: to.Ptr(true), - Tier: to.Ptr("Hyperscale"), - }, - }, 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.PostgresInstance = armazurearcdata.PostgresInstance{ - // Name: to.Ptr("testpostgresInstance"), - // Type: to.Ptr("Microsoft.AzureArcData/PostgresInstance"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/PostgresInstance/testpostgresInstance"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.PostgresInstanceProperties{ - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // }, - // SKU: &armazurearcdata.PostgresInstanceSKU{ - // Name: to.Ptr("default"), - // Dev: to.Ptr(true), - // Tier: to.Ptr("Hyperscale"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/DeletePostgresInstance.json -func ExamplePostgresInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPostgresInstancesClient().BeginDelete(ctx, "testrg", "testpostgresInstance", 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/UpdatePostgresInstance.json -func ExamplePostgresInstancesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPostgresInstancesClient().Update(ctx, "testrg", "testpostgresInstance", armazurearcdata.PostgresInstanceUpdate{ - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - }, 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.PostgresInstance = armazurearcdata.PostgresInstance{ - // Name: to.Ptr("testpostgresInstance"), - // Type: to.Ptr("Microsoft.AzureArcData/PostgresInstance"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/PostgresInstance/testpostgresInstance"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.PostgresInstanceProperties{ - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // }, - // SKU: &armazurearcdata.PostgresInstanceSKU{ - // Name: to.Ptr("default"), - // Dev: to.Ptr(true), - // Tier: to.Ptr("Hyperscale"), - // }, - // } -} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/response_types.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/response_types.go index 19ac8256688e..0a82b695615e 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/response_types.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/response_types.go @@ -59,6 +59,26 @@ type DataControllersClientPutDataControllerResponse struct { DataControllerResource } +// FailoverGroupsClientCreateResponse contains the response from method FailoverGroupsClient.BeginCreate. +type FailoverGroupsClientCreateResponse struct { + FailoverGroupResource +} + +// FailoverGroupsClientDeleteResponse contains the response from method FailoverGroupsClient.BeginDelete. +type FailoverGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// FailoverGroupsClientGetResponse contains the response from method FailoverGroupsClient.Get. +type FailoverGroupsClientGetResponse struct { + FailoverGroupResource +} + +// FailoverGroupsClientListResponse contains the response from method FailoverGroupsClient.NewListPager. +type FailoverGroupsClientListResponse struct { + FailoverGroupListResult +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationListResult @@ -94,6 +114,86 @@ type PostgresInstancesClientUpdateResponse struct { PostgresInstance } +// SQLAvailabilityGroupDatabasesClientCreateResponse contains the response from method SQLAvailabilityGroupDatabasesClient.Create. +type SQLAvailabilityGroupDatabasesClientCreateResponse struct { + SQLAvailabilityGroupDatabaseResource +} + +// SQLAvailabilityGroupDatabasesClientDeleteResponse contains the response from method SQLAvailabilityGroupDatabasesClient.Delete. +type SQLAvailabilityGroupDatabasesClientDeleteResponse struct { + // placeholder for future response values +} + +// SQLAvailabilityGroupDatabasesClientGetResponse contains the response from method SQLAvailabilityGroupDatabasesClient.Get. +type SQLAvailabilityGroupDatabasesClientGetResponse struct { + SQLAvailabilityGroupDatabaseResource +} + +// SQLAvailabilityGroupDatabasesClientListResponse contains the response from method SQLAvailabilityGroupDatabasesClient.NewListPager. +type SQLAvailabilityGroupDatabasesClientListResponse struct { + ArcSQLAvailabilityGroupDatabasesListResult +} + +// SQLAvailabilityGroupDatabasesClientUpdateResponse contains the response from method SQLAvailabilityGroupDatabasesClient.Update. +type SQLAvailabilityGroupDatabasesClientUpdateResponse struct { + SQLAvailabilityGroupDatabaseResource +} + +// SQLAvailabilityGroupReplicasClientCreateResponse contains the response from method SQLAvailabilityGroupReplicasClient.Create. +type SQLAvailabilityGroupReplicasClientCreateResponse struct { + SQLAvailabilityGroupReplicaResource +} + +// SQLAvailabilityGroupReplicasClientDeleteResponse contains the response from method SQLAvailabilityGroupReplicasClient.Delete. +type SQLAvailabilityGroupReplicasClientDeleteResponse struct { + // placeholder for future response values +} + +// SQLAvailabilityGroupReplicasClientGetResponse contains the response from method SQLAvailabilityGroupReplicasClient.Get. +type SQLAvailabilityGroupReplicasClientGetResponse struct { + SQLAvailabilityGroupReplicaResource +} + +// SQLAvailabilityGroupReplicasClientListResponse contains the response from method SQLAvailabilityGroupReplicasClient.NewListPager. +type SQLAvailabilityGroupReplicasClientListResponse struct { + ArcSQLAvailabilityGroupReplicaListResult +} + +// SQLAvailabilityGroupReplicasClientUpdateResponse contains the response from method SQLAvailabilityGroupReplicasClient.Update. +type SQLAvailabilityGroupReplicasClientUpdateResponse struct { + SQLAvailabilityGroupReplicaResource +} + +// SQLAvailabilityGroupsClientCreateResponse contains the response from method SQLAvailabilityGroupsClient.BeginCreate. +type SQLAvailabilityGroupsClientCreateResponse struct { + SQLAvailabilityGroup +} + +// SQLAvailabilityGroupsClientDeleteResponse contains the response from method SQLAvailabilityGroupsClient.BeginDelete. +type SQLAvailabilityGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// SQLAvailabilityGroupsClientGetResponse contains the response from method SQLAvailabilityGroupsClient.Get. +type SQLAvailabilityGroupsClientGetResponse struct { + SQLAvailabilityGroup +} + +// SQLAvailabilityGroupsClientListByResourceGroupResponse contains the response from method SQLAvailabilityGroupsClient.NewListByResourceGroupPager. +type SQLAvailabilityGroupsClientListByResourceGroupResponse struct { + SQLAvailabilityGroupListResult +} + +// SQLAvailabilityGroupsClientListResponse contains the response from method SQLAvailabilityGroupsClient.NewListPager. +type SQLAvailabilityGroupsClientListResponse struct { + SQLAvailabilityGroupListResult +} + +// SQLAvailabilityGroupsClientUpdateResponse contains the response from method SQLAvailabilityGroupsClient.Update. +type SQLAvailabilityGroupsClientUpdateResponse struct { + SQLAvailabilityGroup +} + // SQLManagedInstancesClientCreateResponse contains the response from method SQLManagedInstancesClient.BeginCreate. type SQLManagedInstancesClientCreateResponse struct { SQLManagedInstance @@ -124,6 +224,56 @@ type SQLManagedInstancesClientUpdateResponse struct { SQLManagedInstance } +// SQLServerAvailabilityGroupsClientCreateResponse contains the response from method SQLServerAvailabilityGroupsClient.Create. +type SQLServerAvailabilityGroupsClientCreateResponse struct { + SQLServerAvailabilityGroupResource +} + +// SQLServerAvailabilityGroupsClientDeleteResponse contains the response from method SQLServerAvailabilityGroupsClient.Delete. +type SQLServerAvailabilityGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// SQLServerAvailabilityGroupsClientGetResponse contains the response from method SQLServerAvailabilityGroupsClient.Get. +type SQLServerAvailabilityGroupsClientGetResponse struct { + SQLServerAvailabilityGroupResource +} + +// SQLServerAvailabilityGroupsClientListResponse contains the response from method SQLServerAvailabilityGroupsClient.NewListPager. +type SQLServerAvailabilityGroupsClientListResponse struct { + ArcSQLServerAvailabilityGroupListResult +} + +// SQLServerAvailabilityGroupsClientUpdateResponse contains the response from method SQLServerAvailabilityGroupsClient.Update. +type SQLServerAvailabilityGroupsClientUpdateResponse struct { + SQLServerAvailabilityGroupResource +} + +// SQLServerDatabasesClientCreateResponse contains the response from method SQLServerDatabasesClient.Create. +type SQLServerDatabasesClientCreateResponse struct { + SQLServerDatabaseResource +} + +// SQLServerDatabasesClientDeleteResponse contains the response from method SQLServerDatabasesClient.Delete. +type SQLServerDatabasesClientDeleteResponse struct { + // placeholder for future response values +} + +// SQLServerDatabasesClientGetResponse contains the response from method SQLServerDatabasesClient.Get. +type SQLServerDatabasesClientGetResponse struct { + SQLServerDatabaseResource +} + +// SQLServerDatabasesClientListResponse contains the response from method SQLServerDatabasesClient.NewListPager. +type SQLServerDatabasesClientListResponse struct { + ArcSQLServerDatabaseListResult +} + +// SQLServerDatabasesClientUpdateResponse contains the response from method SQLServerDatabasesClient.Update. +type SQLServerDatabasesClientUpdateResponse struct { + SQLServerDatabaseResource +} + // SQLServerInstancesClientCreateResponse contains the response from method SQLServerInstancesClient.BeginCreate. type SQLServerInstancesClientCreateResponse struct { SQLServerInstance diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlavailabilitygroupdatabases_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlavailabilitygroupdatabases_client.go new file mode 100644 index 000000000000..b50375809669 --- /dev/null +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlavailabilitygroupdatabases_client.go @@ -0,0 +1,360 @@ +//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 armazurearcdata + +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" +) + +// SQLAvailabilityGroupDatabasesClient contains the methods for the SQLAvailabilityGroupDatabases group. +// Don't use this type directly, use NewSQLAvailabilityGroupDatabasesClient() instead. +type SQLAvailabilityGroupDatabasesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSQLAvailabilityGroupDatabasesClient creates a new instance of SQLAvailabilityGroupDatabasesClient with the specified values. +// - subscriptionID - The ID of the Azure subscription +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSQLAvailabilityGroupDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLAvailabilityGroupDatabasesClient, error) { + cl, err := arm.NewClient(moduleName+".SQLAvailabilityGroupDatabasesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SQLAvailabilityGroupDatabasesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Creates or update database in an Arc Sql Availability Group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlAvailabilityGroupDatabaseName - Name of SQL Availability Group Database +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - sqlAvailabilityGroupDatabaseResource - The request body for availability group databases resource. +// - options - SQLAvailabilityGroupDatabasesClientCreateOptions contains the optional parameters for the SQLAvailabilityGroupDatabasesClient.Create +// method. +func (client *SQLAvailabilityGroupDatabasesClient) Create(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupDatabaseName string, sqlAvailabilityGroupName string, sqlAvailabilityGroupDatabaseResource SQLAvailabilityGroupDatabaseResource, options *SQLAvailabilityGroupDatabasesClientCreateOptions) (SQLAvailabilityGroupDatabasesClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName, sqlAvailabilityGroupDatabaseResource, options) + if err != nil { + return SQLAvailabilityGroupDatabasesClientCreateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLAvailabilityGroupDatabasesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLAvailabilityGroupDatabasesClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *SQLAvailabilityGroupDatabasesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupDatabaseName string, sqlAvailabilityGroupName string, sqlAvailabilityGroupDatabaseResource SQLAvailabilityGroupDatabaseResource, options *SQLAvailabilityGroupDatabasesClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/databases/{sqlAvailabilityGroupDatabaseName}" + 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 sqlAvailabilityGroupDatabaseName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupDatabaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupDatabaseName}", url.PathEscape(sqlAvailabilityGroupDatabaseName)) + if sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, sqlAvailabilityGroupDatabaseResource) +} + +// createHandleResponse handles the Create response. +func (client *SQLAvailabilityGroupDatabasesClient) createHandleResponse(resp *http.Response) (SQLAvailabilityGroupDatabasesClientCreateResponse, error) { + result := SQLAvailabilityGroupDatabasesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLAvailabilityGroupDatabaseResource); err != nil { + return SQLAvailabilityGroupDatabasesClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Deletes an Arc Sql availability group database resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlAvailabilityGroupDatabaseName - Name of SQL Availability Group Database +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - options - SQLAvailabilityGroupDatabasesClientDeleteOptions contains the optional parameters for the SQLAvailabilityGroupDatabasesClient.Delete +// method. +func (client *SQLAvailabilityGroupDatabasesClient) Delete(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupDatabaseName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupDatabasesClientDeleteOptions) (SQLAvailabilityGroupDatabasesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName, options) + if err != nil { + return SQLAvailabilityGroupDatabasesClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLAvailabilityGroupDatabasesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return SQLAvailabilityGroupDatabasesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return SQLAvailabilityGroupDatabasesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SQLAvailabilityGroupDatabasesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupDatabaseName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupDatabasesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/databases/{sqlAvailabilityGroupDatabaseName}" + 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 sqlAvailabilityGroupDatabaseName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupDatabaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupDatabaseName}", url.PathEscape(sqlAvailabilityGroupDatabaseName)) + if sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves an Arc Sql availability group database resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlAvailabilityGroupDatabaseName - Name of SQL Availability Group Database +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - options - SQLAvailabilityGroupDatabasesClientGetOptions contains the optional parameters for the SQLAvailabilityGroupDatabasesClient.Get +// method. +func (client *SQLAvailabilityGroupDatabasesClient) Get(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupDatabaseName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupDatabasesClientGetOptions) (SQLAvailabilityGroupDatabasesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName, options) + if err != nil { + return SQLAvailabilityGroupDatabasesClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLAvailabilityGroupDatabasesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLAvailabilityGroupDatabasesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SQLAvailabilityGroupDatabasesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupDatabaseName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupDatabasesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/databases/{sqlAvailabilityGroupDatabaseName}" + 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 sqlAvailabilityGroupDatabaseName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupDatabaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupDatabaseName}", url.PathEscape(sqlAvailabilityGroupDatabaseName)) + if sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SQLAvailabilityGroupDatabasesClient) getHandleResponse(resp *http.Response) (SQLAvailabilityGroupDatabasesClientGetResponse, error) { + result := SQLAvailabilityGroupDatabasesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLAvailabilityGroupDatabaseResource); err != nil { + return SQLAvailabilityGroupDatabasesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List the Availability Group Databases associated with the given Arc Sql AG. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - options - SQLAvailabilityGroupDatabasesClientListOptions contains the optional parameters for the SQLAvailabilityGroupDatabasesClient.NewListPager +// method. +func (client *SQLAvailabilityGroupDatabasesClient) NewListPager(resourceGroupName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupDatabasesClientListOptions) *runtime.Pager[SQLAvailabilityGroupDatabasesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLAvailabilityGroupDatabasesClientListResponse]{ + More: func(page SQLAvailabilityGroupDatabasesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLAvailabilityGroupDatabasesClientListResponse) (SQLAvailabilityGroupDatabasesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, sqlAvailabilityGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SQLAvailabilityGroupDatabasesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLAvailabilityGroupDatabasesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLAvailabilityGroupDatabasesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SQLAvailabilityGroupDatabasesClient) listCreateRequest(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupDatabasesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/databases" + 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 sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SQLAvailabilityGroupDatabasesClient) listHandleResponse(resp *http.Response) (SQLAvailabilityGroupDatabasesClientListResponse, error) { + result := SQLAvailabilityGroupDatabasesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArcSQLAvailabilityGroupDatabasesListResult); err != nil { + return SQLAvailabilityGroupDatabasesClientListResponse{}, err + } + return result, nil +} + +// Update - Updates an existing Availability Group Database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlAvailabilityGroupDatabaseName - Name of SQL Availability Group Database +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - sqlAvailabilityGroupDatabaseUpdate - The update availability group database resource. +// - options - SQLAvailabilityGroupDatabasesClientUpdateOptions contains the optional parameters for the SQLAvailabilityGroupDatabasesClient.Update +// method. +func (client *SQLAvailabilityGroupDatabasesClient) Update(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupDatabaseName string, sqlAvailabilityGroupName string, sqlAvailabilityGroupDatabaseUpdate SQLAvailabilityGroupDatabaseUpdate, options *SQLAvailabilityGroupDatabasesClientUpdateOptions) (SQLAvailabilityGroupDatabasesClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, sqlAvailabilityGroupDatabaseName, sqlAvailabilityGroupName, sqlAvailabilityGroupDatabaseUpdate, options) + if err != nil { + return SQLAvailabilityGroupDatabasesClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLAvailabilityGroupDatabasesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLAvailabilityGroupDatabasesClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *SQLAvailabilityGroupDatabasesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupDatabaseName string, sqlAvailabilityGroupName string, sqlAvailabilityGroupDatabaseUpdate SQLAvailabilityGroupDatabaseUpdate, options *SQLAvailabilityGroupDatabasesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/databases/{sqlAvailabilityGroupDatabaseName}" + 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 sqlAvailabilityGroupDatabaseName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupDatabaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupDatabaseName}", url.PathEscape(sqlAvailabilityGroupDatabaseName)) + if sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, sqlAvailabilityGroupDatabaseUpdate) +} + +// updateHandleResponse handles the Update response. +func (client *SQLAvailabilityGroupDatabasesClient) updateHandleResponse(resp *http.Response) (SQLAvailabilityGroupDatabasesClientUpdateResponse, error) { + result := SQLAvailabilityGroupDatabasesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLAvailabilityGroupDatabaseResource); err != nil { + return SQLAvailabilityGroupDatabasesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlavailabilitygroupreplicas_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlavailabilitygroupreplicas_client.go new file mode 100644 index 000000000000..8d863439aa13 --- /dev/null +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlavailabilitygroupreplicas_client.go @@ -0,0 +1,360 @@ +//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 armazurearcdata + +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" +) + +// SQLAvailabilityGroupReplicasClient contains the methods for the SQLAvailabilityGroupReplicas group. +// Don't use this type directly, use NewSQLAvailabilityGroupReplicasClient() instead. +type SQLAvailabilityGroupReplicasClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSQLAvailabilityGroupReplicasClient creates a new instance of SQLAvailabilityGroupReplicasClient with the specified values. +// - subscriptionID - The ID of the Azure subscription +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSQLAvailabilityGroupReplicasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLAvailabilityGroupReplicasClient, error) { + cl, err := arm.NewClient(moduleName+".SQLAvailabilityGroupReplicasClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SQLAvailabilityGroupReplicasClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Creates or replaces an Arc Sql Availability Group Replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - sqlAvailabilityGroupReplicaResource - The request body for availability group replica resource. +// - options - SQLAvailabilityGroupReplicasClientCreateOptions contains the optional parameters for the SQLAvailabilityGroupReplicasClient.Create +// method. +func (client *SQLAvailabilityGroupReplicasClient) Create(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlAvailabilityGroupName string, sqlAvailabilityGroupReplicaResource SQLAvailabilityGroupReplicaResource, options *SQLAvailabilityGroupReplicasClientCreateOptions) (SQLAvailabilityGroupReplicasClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, sqlAvailabilityGroupReplicaResource, options) + if err != nil { + return SQLAvailabilityGroupReplicasClientCreateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLAvailabilityGroupReplicasClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLAvailabilityGroupReplicasClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *SQLAvailabilityGroupReplicasClient) createCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlAvailabilityGroupName string, sqlAvailabilityGroupReplicaResource SQLAvailabilityGroupReplicaResource, options *SQLAvailabilityGroupReplicasClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/sqlServerInstances/{sqlServerInstanceName}" + 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 sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + if sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, sqlAvailabilityGroupReplicaResource) +} + +// createHandleResponse handles the Create response. +func (client *SQLAvailabilityGroupReplicasClient) createHandleResponse(resp *http.Response) (SQLAvailabilityGroupReplicasClientCreateResponse, error) { + result := SQLAvailabilityGroupReplicasClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLAvailabilityGroupReplicaResource); err != nil { + return SQLAvailabilityGroupReplicasClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Deletes an Arc Sql availability group replica resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - options - SQLAvailabilityGroupReplicasClientDeleteOptions contains the optional parameters for the SQLAvailabilityGroupReplicasClient.Delete +// method. +func (client *SQLAvailabilityGroupReplicasClient) Delete(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupReplicasClientDeleteOptions) (SQLAvailabilityGroupReplicasClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, options) + if err != nil { + return SQLAvailabilityGroupReplicasClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLAvailabilityGroupReplicasClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return SQLAvailabilityGroupReplicasClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return SQLAvailabilityGroupReplicasClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SQLAvailabilityGroupReplicasClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupReplicasClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/sqlServerInstances/{sqlServerInstanceName}" + 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 sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + if sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves an Arc Sql availability group replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - options - SQLAvailabilityGroupReplicasClientGetOptions contains the optional parameters for the SQLAvailabilityGroupReplicasClient.Get +// method. +func (client *SQLAvailabilityGroupReplicasClient) Get(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupReplicasClientGetOptions) (SQLAvailabilityGroupReplicasClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, options) + if err != nil { + return SQLAvailabilityGroupReplicasClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLAvailabilityGroupReplicasClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLAvailabilityGroupReplicasClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SQLAvailabilityGroupReplicasClient) getCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupReplicasClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/sqlServerInstances/{sqlServerInstanceName}" + 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 sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + if sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SQLAvailabilityGroupReplicasClient) getHandleResponse(resp *http.Response) (SQLAvailabilityGroupReplicasClientGetResponse, error) { + result := SQLAvailabilityGroupReplicasClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLAvailabilityGroupReplicaResource); err != nil { + return SQLAvailabilityGroupReplicasClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List the Availability Group Replica associated with the given Arc Sql AG. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - options - SQLAvailabilityGroupReplicasClientListOptions contains the optional parameters for the SQLAvailabilityGroupReplicasClient.NewListPager +// method. +func (client *SQLAvailabilityGroupReplicasClient) NewListPager(resourceGroupName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupReplicasClientListOptions) *runtime.Pager[SQLAvailabilityGroupReplicasClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLAvailabilityGroupReplicasClientListResponse]{ + More: func(page SQLAvailabilityGroupReplicasClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLAvailabilityGroupReplicasClientListResponse) (SQLAvailabilityGroupReplicasClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, sqlAvailabilityGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SQLAvailabilityGroupReplicasClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLAvailabilityGroupReplicasClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLAvailabilityGroupReplicasClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SQLAvailabilityGroupReplicasClient) listCreateRequest(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupReplicasClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/sqlServerInstances" + 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 sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SQLAvailabilityGroupReplicasClient) listHandleResponse(resp *http.Response) (SQLAvailabilityGroupReplicasClientListResponse, error) { + result := SQLAvailabilityGroupReplicasClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArcSQLAvailabilityGroupReplicaListResult); err != nil { + return SQLAvailabilityGroupReplicasClientListResponse{}, err + } + return result, nil +} + +// Update - Updates an existing Availability Group Replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - sqlAvailabilityGroupReplicaUpdate - The requested availability group replica resource state. +// - options - SQLAvailabilityGroupReplicasClientUpdateOptions contains the optional parameters for the SQLAvailabilityGroupReplicasClient.Update +// method. +func (client *SQLAvailabilityGroupReplicasClient) Update(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlAvailabilityGroupName string, sqlAvailabilityGroupReplicaUpdate SQLAvailabilityGroupReplicaUpdate, options *SQLAvailabilityGroupReplicasClientUpdateOptions) (SQLAvailabilityGroupReplicasClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, sqlAvailabilityGroupReplicaUpdate, options) + if err != nil { + return SQLAvailabilityGroupReplicasClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLAvailabilityGroupReplicasClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLAvailabilityGroupReplicasClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *SQLAvailabilityGroupReplicasClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlAvailabilityGroupName string, sqlAvailabilityGroupReplicaUpdate SQLAvailabilityGroupReplicaUpdate, options *SQLAvailabilityGroupReplicasClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}/sqlServerInstances/{sqlServerInstanceName}" + 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 sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + if sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, sqlAvailabilityGroupReplicaUpdate) +} + +// updateHandleResponse handles the Update response. +func (client *SQLAvailabilityGroupReplicasClient) updateHandleResponse(resp *http.Response) (SQLAvailabilityGroupReplicasClientUpdateResponse, error) { + result := SQLAvailabilityGroupReplicasClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLAvailabilityGroupReplicaResource); err != nil { + return SQLAvailabilityGroupReplicasClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlavailabilitygroups_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlavailabilitygroups_client.go new file mode 100644 index 000000000000..cd32be59b9da --- /dev/null +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlavailabilitygroups_client.go @@ -0,0 +1,420 @@ +//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 armazurearcdata + +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" +) + +// SQLAvailabilityGroupsClient contains the methods for the SQLAvailabilityGroups group. +// Don't use this type directly, use NewSQLAvailabilityGroupsClient() instead. +type SQLAvailabilityGroupsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSQLAvailabilityGroupsClient creates a new instance of SQLAvailabilityGroupsClient with the specified values. +// - subscriptionID - The ID of the Azure subscription +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSQLAvailabilityGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLAvailabilityGroupsClient, error) { + cl, err := arm.NewClient(moduleName+".SQLAvailabilityGroupsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SQLAvailabilityGroupsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates or replaces a SQL Availability Group resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - sqlAvailabilityGroup - The SQL Availability Group to be created or updated. +// - options - SQLAvailabilityGroupsClientBeginCreateOptions contains the optional parameters for the SQLAvailabilityGroupsClient.BeginCreate +// method. +func (client *SQLAvailabilityGroupsClient) BeginCreate(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupName string, sqlAvailabilityGroup SQLAvailabilityGroup, options *SQLAvailabilityGroupsClientBeginCreateOptions) (*runtime.Poller[SQLAvailabilityGroupsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, sqlAvailabilityGroupName, sqlAvailabilityGroup, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLAvailabilityGroupsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[SQLAvailabilityGroupsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Create - Creates or replaces a SQL Availability Group resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +func (client *SQLAvailabilityGroupsClient) create(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupName string, sqlAvailabilityGroup SQLAvailabilityGroup, options *SQLAvailabilityGroupsClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, sqlAvailabilityGroupName, sqlAvailabilityGroup, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *SQLAvailabilityGroupsClient) createCreateRequest(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupName string, sqlAvailabilityGroup SQLAvailabilityGroup, options *SQLAvailabilityGroupsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}" + 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 sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, sqlAvailabilityGroup) +} + +// BeginDelete - Deletes a SQL Availability Group resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - options - SQLAvailabilityGroupsClientBeginDeleteOptions contains the optional parameters for the SQLAvailabilityGroupsClient.BeginDelete +// method. +func (client *SQLAvailabilityGroupsClient) BeginDelete(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupsClientBeginDeleteOptions) (*runtime.Poller[SQLAvailabilityGroupsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, sqlAvailabilityGroupName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[SQLAvailabilityGroupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + } else { + return runtime.NewPollerFromResumeToken[SQLAvailabilityGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a SQL Availability Group resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +func (client *SQLAvailabilityGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlAvailabilityGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SQLAvailabilityGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}" + 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 sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves a SQL Availability Group resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - options - SQLAvailabilityGroupsClientGetOptions contains the optional parameters for the SQLAvailabilityGroupsClient.Get +// method. +func (client *SQLAvailabilityGroupsClient) Get(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupsClientGetOptions) (SQLAvailabilityGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, sqlAvailabilityGroupName, options) + if err != nil { + return SQLAvailabilityGroupsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLAvailabilityGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLAvailabilityGroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SQLAvailabilityGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupName string, options *SQLAvailabilityGroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}" + 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 sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SQLAvailabilityGroupsClient) getHandleResponse(resp *http.Response) (SQLAvailabilityGroupsClientGetResponse, error) { + result := SQLAvailabilityGroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLAvailabilityGroup); err != nil { + return SQLAvailabilityGroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List sqlAvailabilityGroups resources in the subscription +// +// Generated from API version 2023-03-15-preview +// - options - SQLAvailabilityGroupsClientListOptions contains the optional parameters for the SQLAvailabilityGroupsClient.NewListPager +// method. +func (client *SQLAvailabilityGroupsClient) NewListPager(options *SQLAvailabilityGroupsClientListOptions) *runtime.Pager[SQLAvailabilityGroupsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLAvailabilityGroupsClientListResponse]{ + More: func(page SQLAvailabilityGroupsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLAvailabilityGroupsClientListResponse) (SQLAvailabilityGroupsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SQLAvailabilityGroupsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLAvailabilityGroupsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLAvailabilityGroupsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SQLAvailabilityGroupsClient) listCreateRequest(ctx context.Context, options *SQLAvailabilityGroupsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SQLAvailabilityGroupsClient) listHandleResponse(resp *http.Response) (SQLAvailabilityGroupsClientListResponse, error) { + result := SQLAvailabilityGroupsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLAvailabilityGroupListResult); err != nil { + return SQLAvailabilityGroupsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets all sqlAvailabilityGroups in a resource group. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - options - SQLAvailabilityGroupsClientListByResourceGroupOptions contains the optional parameters for the SQLAvailabilityGroupsClient.NewListByResourceGroupPager +// method. +func (client *SQLAvailabilityGroupsClient) NewListByResourceGroupPager(resourceGroupName string, options *SQLAvailabilityGroupsClientListByResourceGroupOptions) *runtime.Pager[SQLAvailabilityGroupsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLAvailabilityGroupsClientListByResourceGroupResponse]{ + More: func(page SQLAvailabilityGroupsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLAvailabilityGroupsClientListByResourceGroupResponse) (SQLAvailabilityGroupsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SQLAvailabilityGroupsClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLAvailabilityGroupsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLAvailabilityGroupsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SQLAvailabilityGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SQLAvailabilityGroupsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups" + 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)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *SQLAvailabilityGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (SQLAvailabilityGroupsClientListByResourceGroupResponse, error) { + result := SQLAvailabilityGroupsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLAvailabilityGroupListResult); err != nil { + return SQLAvailabilityGroupsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// Update - Updates a SQL Availability Group resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - parameters - The SQL Availability Group. +// - options - SQLAvailabilityGroupsClientUpdateOptions contains the optional parameters for the SQLAvailabilityGroupsClient.Update +// method. +func (client *SQLAvailabilityGroupsClient) Update(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupName string, parameters SQLAvailabilityGroupUpdate, options *SQLAvailabilityGroupsClientUpdateOptions) (SQLAvailabilityGroupsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, sqlAvailabilityGroupName, parameters, options) + if err != nil { + return SQLAvailabilityGroupsClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLAvailabilityGroupsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLAvailabilityGroupsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *SQLAvailabilityGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sqlAvailabilityGroupName string, parameters SQLAvailabilityGroupUpdate, options *SQLAvailabilityGroupsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlAvailabilityGroups/{sqlAvailabilityGroupName}" + 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 sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *SQLAvailabilityGroupsClient) updateHandleResponse(resp *http.Response) (SQLAvailabilityGroupsClientUpdateResponse, error) { + result := SQLAvailabilityGroupsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLAvailabilityGroup); err != nil { + return SQLAvailabilityGroupsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlmanagedinstances_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlmanagedinstances_client.go index e43c6aedb923..98fec098646a 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlmanagedinstances_client.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlmanagedinstances_client.go @@ -47,7 +47,7 @@ func NewSQLManagedInstancesClient(subscriptionID string, credential azcore.Token // BeginCreate - Creates or replaces a SQL Managed Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - sqlManagedInstanceName - Name of SQL Managed Instance // - sqlManagedInstance - The SQL Managed Instance to be created or updated. @@ -70,7 +70,7 @@ func (client *SQLManagedInstancesClient) BeginCreate(ctx context.Context, resour // Create - Creates or replaces a SQL Managed Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview func (client *SQLManagedInstancesClient) create(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, sqlManagedInstance SQLManagedInstance, options *SQLManagedInstancesClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, options) if err != nil { @@ -106,7 +106,7 @@ func (client *SQLManagedInstancesClient) createCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, sqlManagedInstance) @@ -115,7 +115,7 @@ func (client *SQLManagedInstancesClient) createCreateRequest(ctx context.Context // BeginDelete - Deletes a SQL Managed Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - sqlManagedInstanceName - Name of SQL Managed Instance // - options - SQLManagedInstancesClientBeginDeleteOptions contains the optional parameters for the SQLManagedInstancesClient.BeginDelete @@ -135,7 +135,7 @@ func (client *SQLManagedInstancesClient) BeginDelete(ctx context.Context, resour // Delete - Deletes a SQL Managed Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview func (client *SQLManagedInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, options *SQLManagedInstancesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlManagedInstanceName, options) if err != nil { @@ -171,7 +171,7 @@ func (client *SQLManagedInstancesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +180,7 @@ func (client *SQLManagedInstancesClient) deleteCreateRequest(ctx context.Context // Get - Retrieves a SQL Managed Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - sqlManagedInstanceName - Name of SQL Managed Instance // - options - SQLManagedInstancesClientGetOptions contains the optional parameters for the SQLManagedInstancesClient.Get method. @@ -219,7 +219,7 @@ func (client *SQLManagedInstancesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -236,7 +236,7 @@ func (client *SQLManagedInstancesClient) getHandleResponse(resp *http.Response) // NewListPager - List sqlManagedInstance resources in the subscription // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - options - SQLManagedInstancesClientListOptions contains the optional parameters for the SQLManagedInstancesClient.NewListPager // method. func (client *SQLManagedInstancesClient) NewListPager(options *SQLManagedInstancesClientListOptions) *runtime.Pager[SQLManagedInstancesClientListResponse] { @@ -279,7 +279,7 @@ func (client *SQLManagedInstancesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -296,7 +296,7 @@ func (client *SQLManagedInstancesClient) listHandleResponse(resp *http.Response) // NewListByResourceGroupPager - Gets all sqlManagedInstances in a resource group. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - options - SQLManagedInstancesClientListByResourceGroupOptions contains the optional parameters for the SQLManagedInstancesClient.NewListByResourceGroupPager // method. @@ -344,7 +344,7 @@ func (client *SQLManagedInstancesClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -362,7 +362,7 @@ func (client *SQLManagedInstancesClient) listByResourceGroupHandleResponse(resp // Update - Updates a SQL Managed Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - sqlManagedInstanceName - Name of SQL Managed Instance // - parameters - The SQL Managed Instance. @@ -403,7 +403,7 @@ func (client *SQLManagedInstancesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlmanagedinstances_client_example_test.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlmanagedinstances_client_example_test.go deleted file mode 100644 index a2c538182eeb..000000000000 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlmanagedinstances_client_example_test.go +++ /dev/null @@ -1,669 +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 armazurearcdata_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/azurearcdata/armazurearcdata" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListSubscriptionSqlManagedInstance.json -func ExampleSQLManagedInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSQLManagedInstancesClient().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.SQLManagedInstanceListResult = armazurearcdata.SQLManagedInstanceListResult{ - // Value: []*armazurearcdata.SQLManagedInstance{ - // { - // Name: to.Ptr("sqlManagedInstances1"), - // Type: to.Ptr("Microsoft.AzureArcData/sqlManagedInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/SqlManagedInstances/sqlManagedInstance1"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.SQLManagedInstanceProperties{ - // ActiveDirectoryInformation: &armazurearcdata.ActiveDirectoryInformation{ - // KeytabInformation: &armazurearcdata.KeytabInformation{ - // }, - // }, - // Admin: to.Ptr("Admin user"), - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - // EndTime: to.Ptr("Instance end time"), - // ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - // K8SRaw: &armazurearcdata.SQLManagedInstanceK8SRaw{ - // AdditionalProperties: map[string]any{ - // "additionalProperty": float64(1234), - // }, - // Spec: &armazurearcdata.SQLManagedInstanceK8SSpec{ - // Replicas: to.Ptr[int32](1), - // Scheduling: &armazurearcdata.K8SScheduling{ - // Default: &armazurearcdata.K8SSchedulingOptions{ - // Resources: &armazurearcdata.K8SResourceRequirements{ - // Limits: map[string]*string{ - // "additionalProperty": to.Ptr("additionalValue"), - // "cpu": to.Ptr("1"), - // "memory": to.Ptr("8Gi"), - // }, - // Requests: map[string]*string{ - // "additionalProperty": to.Ptr("additionalValue"), - // "cpu": to.Ptr("1"), - // "memory": to.Ptr("8Gi"), - // }, - // }, - // }, - // }, - // }, - // }, - // LicenseType: to.Ptr(armazurearcdata.ArcSQLManagedInstanceLicenseTypeLicenseIncluded), - // StartTime: to.Ptr("Instance start time"), - // }, - // SKU: &armazurearcdata.SQLManagedInstanceSKU{ - // Name: to.Ptr("vCore"), - // Dev: to.Ptr(true), - // Tier: to.Ptr(armazurearcdata.SQLManagedInstanceSKUTierGeneralPurpose), - // }, - // }, - // { - // Name: to.Ptr("sqlManagedInstances2"), - // Type: to.Ptr("Microsoft.AzureArcData/sqlManagedInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/SqlManagedInstances/sqlManagedInstance2"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.SQLManagedInstanceProperties{ - // ActiveDirectoryInformation: &armazurearcdata.ActiveDirectoryInformation{ - // KeytabInformation: &armazurearcdata.KeytabInformation{ - // }, - // }, - // Admin: to.Ptr("Admin user"), - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - // EndTime: to.Ptr("Instance end time"), - // ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - // K8SRaw: &armazurearcdata.SQLManagedInstanceK8SRaw{ - // AdditionalProperties: map[string]any{ - // "additionalProperty": float64(1234), - // }, - // Spec: &armazurearcdata.SQLManagedInstanceK8SSpec{ - // Replicas: to.Ptr[int32](1), - // Scheduling: &armazurearcdata.K8SScheduling{ - // Default: &armazurearcdata.K8SSchedulingOptions{ - // Resources: &armazurearcdata.K8SResourceRequirements{ - // Limits: map[string]*string{ - // "additionalProperty": to.Ptr("additionalValue"), - // "cpu": to.Ptr("1"), - // "memory": to.Ptr("8Gi"), - // }, - // Requests: map[string]*string{ - // "additionalProperty": to.Ptr("additionalValue"), - // "cpu": to.Ptr("1"), - // "memory": to.Ptr("8Gi"), - // }, - // }, - // }, - // }, - // }, - // }, - // LicenseType: to.Ptr(armazurearcdata.ArcSQLManagedInstanceLicenseTypeLicenseIncluded), - // StartTime: to.Ptr("Instance start time"), - // }, - // SKU: &armazurearcdata.SQLManagedInstanceSKU{ - // Name: to.Ptr("vCore"), - // Dev: to.Ptr(true), - // Tier: to.Ptr(armazurearcdata.SQLManagedInstanceSKUTierGeneralPurpose), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListByResourceGroupSqlManagedInstance.json -func ExampleSQLManagedInstancesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSQLManagedInstancesClient().NewListByResourceGroupPager("testrg", 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.SQLManagedInstanceListResult = armazurearcdata.SQLManagedInstanceListResult{ - // Value: []*armazurearcdata.SQLManagedInstance{ - // { - // Name: to.Ptr("sqlManagedInstances1"), - // Type: to.Ptr("Microsoft.AzureArcData/sqlManagedInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlManagedInstances/sqlManagedInstance1"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.SQLManagedInstanceProperties{ - // ActiveDirectoryInformation: &armazurearcdata.ActiveDirectoryInformation{ - // KeytabInformation: &armazurearcdata.KeytabInformation{ - // }, - // }, - // Admin: to.Ptr("Admin user"), - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // EndTime: to.Ptr("Instance end time"), - // K8SRaw: &armazurearcdata.SQLManagedInstanceK8SRaw{ - // AdditionalProperties: map[string]any{ - // "additionalProperty": float64(1234), - // }, - // Spec: &armazurearcdata.SQLManagedInstanceK8SSpec{ - // Replicas: to.Ptr[int32](1), - // Scheduling: &armazurearcdata.K8SScheduling{ - // Default: &armazurearcdata.K8SSchedulingOptions{ - // Resources: &armazurearcdata.K8SResourceRequirements{ - // Limits: map[string]*string{ - // "additionalProperty": to.Ptr("additionalValue"), - // "cpu": to.Ptr("1"), - // "memory": to.Ptr("8Gi"), - // }, - // Requests: map[string]*string{ - // "additionalProperty": to.Ptr("additionalValue"), - // "cpu": to.Ptr("1"), - // "memory": to.Ptr("8Gi"), - // }, - // }, - // }, - // }, - // }, - // }, - // LicenseType: to.Ptr(armazurearcdata.ArcSQLManagedInstanceLicenseTypeLicenseIncluded), - // StartTime: to.Ptr("Instance start time"), - // }, - // SKU: &armazurearcdata.SQLManagedInstanceSKU{ - // Name: to.Ptr("vCore"), - // Dev: to.Ptr(true), - // Tier: to.Ptr(armazurearcdata.SQLManagedInstanceSKUTierGeneralPurpose), - // }, - // }, - // { - // Name: to.Ptr("sqlManagedInstances2"), - // Type: to.Ptr("Microsoft.AzureArcData/sqlManagedInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlManagedInstances/sqlManagedInstance2"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.SQLManagedInstanceProperties{ - // ActiveDirectoryInformation: &armazurearcdata.ActiveDirectoryInformation{ - // KeytabInformation: &armazurearcdata.KeytabInformation{ - // }, - // }, - // Admin: to.Ptr("Admin user"), - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - // EndTime: to.Ptr("Instance end time"), - // ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - // K8SRaw: &armazurearcdata.SQLManagedInstanceK8SRaw{ - // AdditionalProperties: map[string]any{ - // "additionalProperty": float64(1234), - // }, - // Spec: &armazurearcdata.SQLManagedInstanceK8SSpec{ - // Replicas: to.Ptr[int32](1), - // Scheduling: &armazurearcdata.K8SScheduling{ - // Default: &armazurearcdata.K8SSchedulingOptions{ - // Resources: &armazurearcdata.K8SResourceRequirements{ - // Limits: map[string]*string{ - // "additionalProperty": to.Ptr("additionalValue"), - // "cpu": to.Ptr("1"), - // "memory": to.Ptr("8Gi"), - // }, - // Requests: map[string]*string{ - // "additionalProperty": to.Ptr("additionalValue"), - // "cpu": to.Ptr("1"), - // "memory": to.Ptr("8Gi"), - // }, - // }, - // }, - // }, - // }, - // }, - // LicenseType: to.Ptr(armazurearcdata.ArcSQLManagedInstanceLicenseTypeLicenseIncluded), - // StartTime: to.Ptr("Instance start time"), - // }, - // SKU: &armazurearcdata.SQLManagedInstanceSKU{ - // Name: to.Ptr("vCore"), - // Dev: to.Ptr(true), - // Tier: to.Ptr(armazurearcdata.SQLManagedInstanceSKUTierGeneralPurpose), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/GetSqlManagedInstance.json -func ExampleSQLManagedInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLManagedInstancesClient().Get(ctx, "testrg", "testsqlManagedInstance", 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.SQLManagedInstance = armazurearcdata.SQLManagedInstance{ - // Name: to.Ptr("testsqlManagedInstance"), - // Type: to.Ptr("Microsoft.AzureArcData/sqlManagedInstance"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlManagedInstances/testsqlManagedInstance"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.SQLManagedInstanceProperties{ - // ActiveDirectoryInformation: &armazurearcdata.ActiveDirectoryInformation{ - // KeytabInformation: &armazurearcdata.KeytabInformation{ - // }, - // }, - // Admin: to.Ptr("Admin user"), - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - // EndTime: to.Ptr("Instance end time"), - // ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - // K8SRaw: &armazurearcdata.SQLManagedInstanceK8SRaw{ - // AdditionalProperties: map[string]any{ - // "additionalProperty": float64(1234), - // }, - // Spec: &armazurearcdata.SQLManagedInstanceK8SSpec{ - // Replicas: to.Ptr[int32](1), - // Scheduling: &armazurearcdata.K8SScheduling{ - // Default: &armazurearcdata.K8SSchedulingOptions{ - // Resources: &armazurearcdata.K8SResourceRequirements{ - // Limits: map[string]*string{ - // "additionalProperty": to.Ptr("additionalValue"), - // "cpu": to.Ptr("1"), - // "memory": to.Ptr("8Gi"), - // }, - // Requests: map[string]*string{ - // "additionalProperty": to.Ptr("additionalValue"), - // "cpu": to.Ptr("1"), - // "memory": to.Ptr("8Gi"), - // }, - // }, - // }, - // }, - // }, - // }, - // LicenseType: to.Ptr(armazurearcdata.ArcSQLManagedInstanceLicenseTypeLicenseIncluded), - // StartTime: to.Ptr("Instance start time"), - // }, - // SKU: &armazurearcdata.SQLManagedInstanceSKU{ - // Name: to.Ptr("vCore"), - // Dev: to.Ptr(true), - // Tier: to.Ptr(armazurearcdata.SQLManagedInstanceSKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/CreateOrUpdateSqlManagedInstance.json -func ExampleSQLManagedInstancesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLManagedInstancesClient().BeginCreate(ctx, "testrg", "testsqlManagedInstance", armazurearcdata.SQLManagedInstance{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - ExtendedLocation: &armazurearcdata.ExtendedLocation{ - Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurearcdata.SQLManagedInstanceProperties{ - ActiveDirectoryInformation: &armazurearcdata.ActiveDirectoryInformation{ - KeytabInformation: &armazurearcdata.KeytabInformation{ - Keytab: to.Ptr("********"), - }, - }, - Admin: to.Ptr("Admin user"), - BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - Password: to.Ptr("********"), - Username: to.Ptr("username"), - }, - ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - EndTime: to.Ptr("Instance end time"), - ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - K8SRaw: &armazurearcdata.SQLManagedInstanceK8SRaw{ - AdditionalProperties: map[string]any{ - "additionalProperty": float64(1234), - }, - Spec: &armazurearcdata.SQLManagedInstanceK8SSpec{ - Replicas: to.Ptr[int32](1), - Scheduling: &armazurearcdata.K8SScheduling{ - Default: &armazurearcdata.K8SSchedulingOptions{ - Resources: &armazurearcdata.K8SResourceRequirements{ - Limits: map[string]*string{ - "additionalProperty": to.Ptr("additionalValue"), - "cpu": to.Ptr("1"), - "memory": to.Ptr("8Gi"), - }, - Requests: map[string]*string{ - "additionalProperty": to.Ptr("additionalValue"), - "cpu": to.Ptr("1"), - "memory": to.Ptr("8Gi"), - }, - }, - }, - }, - }, - }, - LicenseType: to.Ptr(armazurearcdata.ArcSQLManagedInstanceLicenseTypeLicenseIncluded), - StartTime: to.Ptr("Instance start time"), - }, - SKU: &armazurearcdata.SQLManagedInstanceSKU{ - Name: to.Ptr("vCore"), - Dev: to.Ptr(true), - Tier: to.Ptr(armazurearcdata.SQLManagedInstanceSKUTierGeneralPurpose), - }, - }, 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.SQLManagedInstance = armazurearcdata.SQLManagedInstance{ - // Name: to.Ptr("testsqlManagedInstance"), - // Type: to.Ptr("Microsoft.AzureArcData/sqlManagedInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlManagedInstances/testsqlManagedInstance"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.SQLManagedInstanceProperties{ - // ActiveDirectoryInformation: &armazurearcdata.ActiveDirectoryInformation{ - // KeytabInformation: &armazurearcdata.KeytabInformation{ - // }, - // }, - // Admin: to.Ptr("Admin user"), - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - // EndTime: to.Ptr("Instance end time"), - // ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - // K8SRaw: &armazurearcdata.SQLManagedInstanceK8SRaw{ - // AdditionalProperties: map[string]any{ - // "additionalProperty": float64(1234), - // }, - // Spec: &armazurearcdata.SQLManagedInstanceK8SSpec{ - // Replicas: to.Ptr[int32](1), - // Scheduling: &armazurearcdata.K8SScheduling{ - // Default: &armazurearcdata.K8SSchedulingOptions{ - // Resources: &armazurearcdata.K8SResourceRequirements{ - // Limits: map[string]*string{ - // "additionalProperty": to.Ptr("additionalValue"), - // "cpu": to.Ptr("1"), - // "memory": to.Ptr("8Gi"), - // }, - // Requests: map[string]*string{ - // "additionalProperty": to.Ptr("additionalValue"), - // "cpu": to.Ptr("1"), - // "memory": to.Ptr("8Gi"), - // }, - // }, - // }, - // }, - // }, - // }, - // LicenseType: to.Ptr(armazurearcdata.ArcSQLManagedInstanceLicenseTypeLicenseIncluded), - // StartTime: to.Ptr("Instance start time"), - // }, - // SKU: &armazurearcdata.SQLManagedInstanceSKU{ - // Name: to.Ptr("vCore"), - // Dev: to.Ptr(true), - // Tier: to.Ptr(armazurearcdata.SQLManagedInstanceSKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/DeleteSqlManagedInstance.json -func ExampleSQLManagedInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLManagedInstancesClient().BeginDelete(ctx, "testrg", "testsqlManagedInstance", 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/UpdateSqlManagedInstance.json -func ExampleSQLManagedInstancesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLManagedInstancesClient().Update(ctx, "testrg", "testsqlManagedInstance", armazurearcdata.SQLManagedInstanceUpdate{ - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - }, 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.SQLManagedInstance = armazurearcdata.SQLManagedInstance{ - // Name: to.Ptr("testsqlManagedInstance"), - // Type: to.Ptr("Microsoft.AzureArcData/sqlManagedInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlManagedInstances/testsqlManagedInstance"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // ExtendedLocation: &armazurearcdata.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - // Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurearcdata.SQLManagedInstanceProperties{ - // ActiveDirectoryInformation: &armazurearcdata.ActiveDirectoryInformation{ - // KeytabInformation: &armazurearcdata.KeytabInformation{ - // }, - // }, - // Admin: to.Ptr("Admin user"), - // BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - // Username: to.Ptr("username"), - // }, - // ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - // EndTime: to.Ptr("Instance end time"), - // ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - // K8SRaw: &armazurearcdata.SQLManagedInstanceK8SRaw{ - // AdditionalProperties: map[string]any{ - // "additionalProperty": float64(1234), - // }, - // Spec: &armazurearcdata.SQLManagedInstanceK8SSpec{ - // Replicas: to.Ptr[int32](1), - // Scheduling: &armazurearcdata.K8SScheduling{ - // Default: &armazurearcdata.K8SSchedulingOptions{ - // Resources: &armazurearcdata.K8SResourceRequirements{ - // Limits: map[string]*string{ - // "additionalProperty": to.Ptr("additionalValue"), - // "cpu": to.Ptr("1"), - // "memory": to.Ptr("8Gi"), - // }, - // Requests: map[string]*string{ - // "additionalProperty": to.Ptr("additionalValue"), - // "cpu": to.Ptr("1"), - // "memory": to.Ptr("8Gi"), - // }, - // }, - // }, - // }, - // }, - // }, - // LicenseType: to.Ptr(armazurearcdata.ArcSQLManagedInstanceLicenseTypeLicenseIncluded), - // StartTime: to.Ptr("Instance start time"), - // }, - // SKU: &armazurearcdata.SQLManagedInstanceSKU{ - // Name: to.Ptr("vCore"), - // Dev: to.Ptr(true), - // Tier: to.Ptr(armazurearcdata.SQLManagedInstanceSKUTierGeneralPurpose), - // }, - // } -} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserveravailabilitygroups_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserveravailabilitygroups_client.go new file mode 100644 index 000000000000..62f37695e257 --- /dev/null +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserveravailabilitygroups_client.go @@ -0,0 +1,360 @@ +//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 armazurearcdata + +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" +) + +// SQLServerAvailabilityGroupsClient contains the methods for the SQLServerAvailabilityGroups group. +// Don't use this type directly, use NewSQLServerAvailabilityGroupsClient() instead. +type SQLServerAvailabilityGroupsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSQLServerAvailabilityGroupsClient creates a new instance of SQLServerAvailabilityGroupsClient with the specified values. +// - subscriptionID - The ID of the Azure subscription +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSQLServerAvailabilityGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLServerAvailabilityGroupsClient, error) { + cl, err := arm.NewClient(moduleName+".SQLServerAvailabilityGroupsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SQLServerAvailabilityGroupsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Creates or replaces an Arc Sql Server Availability Group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - sqlServerAvailabilityGroupResource - The request body for availability group resource. +// - options - SQLServerAvailabilityGroupsClientCreateOptions contains the optional parameters for the SQLServerAvailabilityGroupsClient.Create +// method. +func (client *SQLServerAvailabilityGroupsClient) Create(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlAvailabilityGroupName string, sqlServerAvailabilityGroupResource SQLServerAvailabilityGroupResource, options *SQLServerAvailabilityGroupsClientCreateOptions) (SQLServerAvailabilityGroupsClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, sqlServerAvailabilityGroupResource, options) + if err != nil { + return SQLServerAvailabilityGroupsClientCreateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLServerAvailabilityGroupsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLServerAvailabilityGroupsClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *SQLServerAvailabilityGroupsClient) createCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlAvailabilityGroupName string, sqlServerAvailabilityGroupResource SQLServerAvailabilityGroupResource, options *SQLServerAvailabilityGroupsClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/sqlAvailabilityGroups/{sqlAvailabilityGroupName}" + 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 sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + if sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, sqlServerAvailabilityGroupResource) +} + +// createHandleResponse handles the Create response. +func (client *SQLServerAvailabilityGroupsClient) createHandleResponse(resp *http.Response) (SQLServerAvailabilityGroupsClientCreateResponse, error) { + result := SQLServerAvailabilityGroupsClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLServerAvailabilityGroupResource); err != nil { + return SQLServerAvailabilityGroupsClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Deletes an Arc Sql Server availability group resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - options - SQLServerAvailabilityGroupsClientDeleteOptions contains the optional parameters for the SQLServerAvailabilityGroupsClient.Delete +// method. +func (client *SQLServerAvailabilityGroupsClient) Delete(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlAvailabilityGroupName string, options *SQLServerAvailabilityGroupsClientDeleteOptions) (SQLServerAvailabilityGroupsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, options) + if err != nil { + return SQLServerAvailabilityGroupsClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLServerAvailabilityGroupsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return SQLServerAvailabilityGroupsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return SQLServerAvailabilityGroupsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SQLServerAvailabilityGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlAvailabilityGroupName string, options *SQLServerAvailabilityGroupsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/sqlAvailabilityGroups/{sqlAvailabilityGroupName}" + 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 sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + if sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves an Arc Sql Server availability group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - options - SQLServerAvailabilityGroupsClientGetOptions contains the optional parameters for the SQLServerAvailabilityGroupsClient.Get +// method. +func (client *SQLServerAvailabilityGroupsClient) Get(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlAvailabilityGroupName string, options *SQLServerAvailabilityGroupsClientGetOptions) (SQLServerAvailabilityGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, options) + if err != nil { + return SQLServerAvailabilityGroupsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLServerAvailabilityGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLServerAvailabilityGroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SQLServerAvailabilityGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlAvailabilityGroupName string, options *SQLServerAvailabilityGroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/sqlAvailabilityGroups/{sqlAvailabilityGroupName}" + 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 sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + if sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SQLServerAvailabilityGroupsClient) getHandleResponse(resp *http.Response) (SQLServerAvailabilityGroupsClientGetResponse, error) { + result := SQLServerAvailabilityGroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLServerAvailabilityGroupResource); err != nil { + return SQLServerAvailabilityGroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List the availability group associated with the given Arc Sql Server. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - options - SQLServerAvailabilityGroupsClientListOptions contains the optional parameters for the SQLServerAvailabilityGroupsClient.NewListPager +// method. +func (client *SQLServerAvailabilityGroupsClient) NewListPager(resourceGroupName string, sqlServerInstanceName string, options *SQLServerAvailabilityGroupsClientListOptions) *runtime.Pager[SQLServerAvailabilityGroupsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLServerAvailabilityGroupsClientListResponse]{ + More: func(page SQLServerAvailabilityGroupsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLServerAvailabilityGroupsClientListResponse) (SQLServerAvailabilityGroupsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SQLServerAvailabilityGroupsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLServerAvailabilityGroupsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLServerAvailabilityGroupsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SQLServerAvailabilityGroupsClient) listCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, options *SQLServerAvailabilityGroupsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/sqlAvailabilityGroups" + 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 sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SQLServerAvailabilityGroupsClient) listHandleResponse(resp *http.Response) (SQLServerAvailabilityGroupsClientListResponse, error) { + result := SQLServerAvailabilityGroupsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArcSQLServerAvailabilityGroupListResult); err != nil { + return SQLServerAvailabilityGroupsClientListResponse{}, err + } + return result, nil +} + +// Update - Updates an existing Availability Group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - sqlAvailabilityGroupName - Name of SQL Availability Group +// - sqlServerAvailabilityGroupUpdate - The requested server availability group resource state. +// - options - SQLServerAvailabilityGroupsClientUpdateOptions contains the optional parameters for the SQLServerAvailabilityGroupsClient.Update +// method. +func (client *SQLServerAvailabilityGroupsClient) Update(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlAvailabilityGroupName string, sqlServerAvailabilityGroupUpdate SQLServerAvailabilityGroupUpdate, options *SQLServerAvailabilityGroupsClientUpdateOptions) (SQLServerAvailabilityGroupsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, sqlAvailabilityGroupName, sqlServerAvailabilityGroupUpdate, options) + if err != nil { + return SQLServerAvailabilityGroupsClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLServerAvailabilityGroupsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLServerAvailabilityGroupsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *SQLServerAvailabilityGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlAvailabilityGroupName string, sqlServerAvailabilityGroupUpdate SQLServerAvailabilityGroupUpdate, options *SQLServerAvailabilityGroupsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/sqlAvailabilityGroups/{sqlAvailabilityGroupName}" + 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 sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + if sqlAvailabilityGroupName == "" { + return nil, errors.New("parameter sqlAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlAvailabilityGroupName}", url.PathEscape(sqlAvailabilityGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, sqlServerAvailabilityGroupUpdate) +} + +// updateHandleResponse handles the Update response. +func (client *SQLServerAvailabilityGroupsClient) updateHandleResponse(resp *http.Response) (SQLServerAvailabilityGroupsClientUpdateResponse, error) { + result := SQLServerAvailabilityGroupsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLServerAvailabilityGroupResource); err != nil { + return SQLServerAvailabilityGroupsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverdatabases_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverdatabases_client.go new file mode 100644 index 000000000000..cea4f1844289 --- /dev/null +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverdatabases_client.go @@ -0,0 +1,359 @@ +//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 armazurearcdata + +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" +) + +// SQLServerDatabasesClient contains the methods for the SQLServerDatabases group. +// Don't use this type directly, use NewSQLServerDatabasesClient() instead. +type SQLServerDatabasesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSQLServerDatabasesClient creates a new instance of SQLServerDatabasesClient with the specified values. +// - subscriptionID - The ID of the Azure subscription +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSQLServerDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLServerDatabasesClient, error) { + cl, err := arm.NewClient(moduleName+".SQLServerDatabasesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SQLServerDatabasesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Creates or replaces an Arc Sql Server Database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - databaseName - Name of the database +// - sqlServerDatabaseResource - The request body for database resource. +// - options - SQLServerDatabasesClientCreateOptions contains the optional parameters for the SQLServerDatabasesClient.Create +// method. +func (client *SQLServerDatabasesClient) Create(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, databaseName string, sqlServerDatabaseResource SQLServerDatabaseResource, options *SQLServerDatabasesClientCreateOptions) (SQLServerDatabasesClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseResource, options) + if err != nil { + return SQLServerDatabasesClientCreateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLServerDatabasesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLServerDatabasesClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *SQLServerDatabasesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, databaseName string, sqlServerDatabaseResource SQLServerDatabaseResource, options *SQLServerDatabasesClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}" + 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 sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, sqlServerDatabaseResource) +} + +// createHandleResponse handles the Create response. +func (client *SQLServerDatabasesClient) createHandleResponse(resp *http.Response) (SQLServerDatabasesClientCreateResponse, error) { + result := SQLServerDatabasesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLServerDatabaseResource); err != nil { + return SQLServerDatabasesClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Deletes an Arc Sql Server database resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - databaseName - Name of the database +// - options - SQLServerDatabasesClientDeleteOptions contains the optional parameters for the SQLServerDatabasesClient.Delete +// method. +func (client *SQLServerDatabasesClient) Delete(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, databaseName string, options *SQLServerDatabasesClientDeleteOptions) (SQLServerDatabasesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, databaseName, options) + if err != nil { + return SQLServerDatabasesClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLServerDatabasesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return SQLServerDatabasesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return SQLServerDatabasesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SQLServerDatabasesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, databaseName string, options *SQLServerDatabasesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}" + 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 sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves an Arc Sql Server database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - databaseName - Name of the database +// - options - SQLServerDatabasesClientGetOptions contains the optional parameters for the SQLServerDatabasesClient.Get method. +func (client *SQLServerDatabasesClient) Get(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, databaseName string, options *SQLServerDatabasesClientGetOptions) (SQLServerDatabasesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, databaseName, options) + if err != nil { + return SQLServerDatabasesClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLServerDatabasesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLServerDatabasesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SQLServerDatabasesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, databaseName string, options *SQLServerDatabasesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}" + 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 sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SQLServerDatabasesClient) getHandleResponse(resp *http.Response) (SQLServerDatabasesClientGetResponse, error) { + result := SQLServerDatabasesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLServerDatabaseResource); err != nil { + return SQLServerDatabasesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List the databases associated with the given Arc Sql Server. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - options - SQLServerDatabasesClientListOptions contains the optional parameters for the SQLServerDatabasesClient.NewListPager +// method. +func (client *SQLServerDatabasesClient) NewListPager(resourceGroupName string, sqlServerInstanceName string, options *SQLServerDatabasesClientListOptions) *runtime.Pager[SQLServerDatabasesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLServerDatabasesClientListResponse]{ + More: func(page SQLServerDatabasesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLServerDatabasesClientListResponse) (SQLServerDatabasesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SQLServerDatabasesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLServerDatabasesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLServerDatabasesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SQLServerDatabasesClient) listCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, options *SQLServerDatabasesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases" + 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 sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + 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", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SQLServerDatabasesClient) listHandleResponse(resp *http.Response) (SQLServerDatabasesClientListResponse, error) { + result := SQLServerDatabasesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArcSQLServerDatabaseListResult); err != nil { + return SQLServerDatabasesClientListResponse{}, err + } + return result, nil +} + +// Update - Updates an existing database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - databaseName - Name of the database +// - sqlServerDatabaseUpdate - The requested database resource state. +// - options - SQLServerDatabasesClientUpdateOptions contains the optional parameters for the SQLServerDatabasesClient.Update +// method. +func (client *SQLServerDatabasesClient) Update(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, databaseName string, sqlServerDatabaseUpdate SQLServerDatabaseUpdate, options *SQLServerDatabasesClientUpdateOptions) (SQLServerDatabasesClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate, options) + if err != nil { + return SQLServerDatabasesClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLServerDatabasesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLServerDatabasesClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *SQLServerDatabasesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, databaseName string, sqlServerDatabaseUpdate SQLServerDatabaseUpdate, options *SQLServerDatabasesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}" + 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 sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, sqlServerDatabaseUpdate) +} + +// updateHandleResponse handles the Update response. +func (client *SQLServerDatabasesClient) updateHandleResponse(resp *http.Response) (SQLServerDatabasesClientUpdateResponse, error) { + result := SQLServerDatabasesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLServerDatabaseResource); err != nil { + return SQLServerDatabasesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverinstances_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverinstances_client.go index d826d5553d7a..f2e04c0f5ae3 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverinstances_client.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverinstances_client.go @@ -47,7 +47,7 @@ func NewSQLServerInstancesClient(subscriptionID string, credential azcore.TokenC // BeginCreate - Creates or replaces a SQL Server Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - sqlServerInstanceName - Name of SQL Server Instance // - sqlServerInstance - The SQL Server Instance to be created or updated. @@ -70,7 +70,7 @@ func (client *SQLServerInstancesClient) BeginCreate(ctx context.Context, resourc // Create - Creates or replaces a SQL Server Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview func (client *SQLServerInstancesClient) create(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlServerInstance SQLServerInstance, options *SQLServerInstancesClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, sqlServerInstance, options) if err != nil { @@ -106,7 +106,7 @@ func (client *SQLServerInstancesClient) createCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, sqlServerInstance) @@ -115,7 +115,7 @@ func (client *SQLServerInstancesClient) createCreateRequest(ctx context.Context, // BeginDelete - Deletes a SQL Server Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - sqlServerInstanceName - Name of SQL Server Instance // - options - SQLServerInstancesClientBeginDeleteOptions contains the optional parameters for the SQLServerInstancesClient.BeginDelete @@ -135,7 +135,7 @@ func (client *SQLServerInstancesClient) BeginDelete(ctx context.Context, resourc // Delete - Deletes a SQL Server Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview func (client *SQLServerInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, options *SQLServerInstancesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, options) if err != nil { @@ -171,7 +171,7 @@ func (client *SQLServerInstancesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +180,7 @@ func (client *SQLServerInstancesClient) deleteCreateRequest(ctx context.Context, // Get - Retrieves a SQL Server Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - sqlServerInstanceName - Name of SQL Server Instance // - options - SQLServerInstancesClientGetOptions contains the optional parameters for the SQLServerInstancesClient.Get method. @@ -219,7 +219,7 @@ func (client *SQLServerInstancesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -236,7 +236,7 @@ func (client *SQLServerInstancesClient) getHandleResponse(resp *http.Response) ( // NewListPager - List sqlServerInstance resources in the subscription // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - options - SQLServerInstancesClientListOptions contains the optional parameters for the SQLServerInstancesClient.NewListPager // method. func (client *SQLServerInstancesClient) NewListPager(options *SQLServerInstancesClientListOptions) *runtime.Pager[SQLServerInstancesClientListResponse] { @@ -279,7 +279,7 @@ func (client *SQLServerInstancesClient) listCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -296,7 +296,7 @@ func (client *SQLServerInstancesClient) listHandleResponse(resp *http.Response) // NewListByResourceGroupPager - Gets all sqlServerInstances in a resource group. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - options - SQLServerInstancesClientListByResourceGroupOptions contains the optional parameters for the SQLServerInstancesClient.NewListByResourceGroupPager // method. @@ -344,7 +344,7 @@ func (client *SQLServerInstancesClient) listByResourceGroupCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -362,7 +362,7 @@ func (client *SQLServerInstancesClient) listByResourceGroupHandleResponse(resp * // Update - Updates a SQL Server Instance resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-01-preview +// Generated from API version 2023-03-15-preview // - resourceGroupName - The name of the Azure resource group // - sqlServerInstanceName - Name of SQL Server Instance // - parameters - The SQL Server Instance. @@ -403,7 +403,7 @@ func (client *SQLServerInstancesClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-03-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverinstances_client_example_test.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverinstances_client_example_test.go deleted file mode 100644 index f69704d06b53..000000000000 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverinstances_client_example_test.go +++ /dev/null @@ -1,439 +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 armazurearcdata_test - -import ( - "context" - "log" - - "time" - - "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/azurearcdata/armazurearcdata" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListSubscriptionSqlServerInstance.json -func ExampleSQLServerInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSQLServerInstancesClient().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.SQLServerInstanceListResult = armazurearcdata.SQLServerInstanceListResult{ - // Value: []*armazurearcdata.SQLServerInstance{ - // { - // Name: to.Ptr("sqlServerInstance1"), - // Type: to.Ptr("Microsoft.AzureArcData/SqlServerInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/SqlServerInstances/sqlServerInstance1"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // Properties: &armazurearcdata.SQLServerInstanceProperties{ - // AzureDefenderStatus: to.Ptr(armazurearcdata.DefenderStatusProtected), - // AzureDefenderStatusLastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // Collation: to.Ptr("collation"), - // ContainerResourceID: to.Ptr("Resource id of hosting Arc Machine"), - // CreateTime: to.Ptr("01/01/2020 01:01:01"), - // CurrentVersion: to.Ptr("2008 R2"), - // Edition: to.Ptr(armazurearcdata.EditionTypeDeveloper), - // HostType: to.Ptr(armazurearcdata.HostTypePhysicalServer), - // InstanceName: to.Ptr("name of instance"), - // LicenseType: to.Ptr(armazurearcdata.ArcSQLServerLicenseTypeFree), - // PatchLevel: to.Ptr("patchlevel"), - // ProductID: to.Ptr("sql id"), - // Status: to.Ptr(armazurearcdata.ConnectionStatusRegistered), - // TCPDynamicPorts: to.Ptr("1433"), - // TCPStaticPorts: to.Ptr("1433"), - // VCore: to.Ptr("4"), - // Version: to.Ptr(armazurearcdata.SQLVersionSQLServer2012), - // }, - // }, - // { - // Name: to.Ptr("sqlServerInstance2"), - // Type: to.Ptr("Microsoft.AzureArcData/SqlServerInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/SqlServerInstances/sqlServerInstance2"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // Properties: &armazurearcdata.SQLServerInstanceProperties{ - // AzureDefenderStatus: to.Ptr(armazurearcdata.DefenderStatusProtected), - // AzureDefenderStatusLastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // Collation: to.Ptr("collation"), - // ContainerResourceID: to.Ptr("Arc Machine Name"), - // CreateTime: to.Ptr("01/01/2020 01:01:01"), - // CurrentVersion: to.Ptr("2008 R2"), - // Edition: to.Ptr(armazurearcdata.EditionTypeDeveloper), - // InstanceName: to.Ptr("name of instance"), - // LicenseType: to.Ptr(armazurearcdata.ArcSQLServerLicenseTypeFree), - // PatchLevel: to.Ptr("patchlevel"), - // ProductID: to.Ptr("sql id"), - // Status: to.Ptr(armazurearcdata.ConnectionStatusConnected), - // TCPDynamicPorts: to.Ptr("1433"), - // TCPStaticPorts: to.Ptr("1433"), - // VCore: to.Ptr("4"), - // Version: to.Ptr(armazurearcdata.SQLVersionSQLServer2017), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListByResourceGroupSqlServerInstance.json -func ExampleSQLServerInstancesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSQLServerInstancesClient().NewListByResourceGroupPager("testrg", 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.SQLServerInstanceListResult = armazurearcdata.SQLServerInstanceListResult{ - // Value: []*armazurearcdata.SQLServerInstance{ - // { - // Name: to.Ptr("sqlServerInstance1"), - // Type: to.Ptr("Microsoft.AzureArcData/SqlServerInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/SqlServerInstances/sqlServerInstance1"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // Properties: &armazurearcdata.SQLServerInstanceProperties{ - // AzureDefenderStatus: to.Ptr(armazurearcdata.DefenderStatusProtected), - // AzureDefenderStatusLastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // Collation: to.Ptr("collation"), - // ContainerResourceID: to.Ptr("Resource id of hosting Arc Machine"), - // CreateTime: to.Ptr("01/01/2020 01:01:01"), - // CurrentVersion: to.Ptr("2012"), - // Edition: to.Ptr(armazurearcdata.EditionTypeDeveloper), - // HostType: to.Ptr(armazurearcdata.HostTypePhysicalServer), - // InstanceName: to.Ptr("name of instance"), - // LicenseType: to.Ptr(armazurearcdata.ArcSQLServerLicenseTypeFree), - // PatchLevel: to.Ptr("patchlevel"), - // ProductID: to.Ptr("sql id"), - // Status: to.Ptr(armazurearcdata.ConnectionStatusRegistered), - // TCPDynamicPorts: to.Ptr("1433"), - // TCPStaticPorts: to.Ptr("1433"), - // VCore: to.Ptr("4"), - // Version: to.Ptr(armazurearcdata.SQLVersionSQLServer2012), - // }, - // }, - // { - // Name: to.Ptr("sqlServerInstance2"), - // Type: to.Ptr("Microsoft.AzureArcData/SqlServerInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/SqlServerInstances/sqlServerInstance2"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // Properties: &armazurearcdata.SQLServerInstanceProperties{ - // AzureDefenderStatus: to.Ptr(armazurearcdata.DefenderStatusProtected), - // AzureDefenderStatusLastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // Collation: to.Ptr("collation"), - // ContainerResourceID: to.Ptr("Arc Machine Name"), - // CreateTime: to.Ptr("01/01/2020 01:01:01"), - // CurrentVersion: to.Ptr("2008 R2"), - // Edition: to.Ptr(armazurearcdata.EditionTypeDeveloper), - // InstanceName: to.Ptr("name of instance"), - // LicenseType: to.Ptr(armazurearcdata.ArcSQLServerLicenseTypeFree), - // PatchLevel: to.Ptr("patchlevel"), - // ProductID: to.Ptr("sql id"), - // Status: to.Ptr(armazurearcdata.ConnectionStatusConnected), - // TCPDynamicPorts: to.Ptr("1433"), - // TCPStaticPorts: to.Ptr("1433"), - // VCore: to.Ptr("4"), - // Version: to.Ptr(armazurearcdata.SQLVersionSQLServer2017), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/GetSqlServerInstance.json -func ExampleSQLServerInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLServerInstancesClient().Get(ctx, "testrg", "testsqlServerInstance", 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.SQLServerInstance = armazurearcdata.SQLServerInstance{ - // Name: to.Ptr("testsqlServerInstance"), - // Type: to.Ptr("Microsoft.AzureArcData/SqlServerInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/SqlServerInstances/testsqlServerInstance"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // Properties: &armazurearcdata.SQLServerInstanceProperties{ - // AzureDefenderStatus: to.Ptr(armazurearcdata.DefenderStatusProtected), - // AzureDefenderStatusLastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // Collation: to.Ptr("collation"), - // ContainerResourceID: to.Ptr("Resource id of hosting Arc Machine"), - // CreateTime: to.Ptr("01/01/2020 01:01:01"), - // CurrentVersion: to.Ptr("2012"), - // Edition: to.Ptr(armazurearcdata.EditionTypeDeveloper), - // HostType: to.Ptr(armazurearcdata.HostTypePhysicalServer), - // InstanceName: to.Ptr("name of instance"), - // LicenseType: to.Ptr(armazurearcdata.ArcSQLServerLicenseTypeFree), - // PatchLevel: to.Ptr("patchlevel"), - // ProductID: to.Ptr("sql id"), - // Status: to.Ptr(armazurearcdata.ConnectionStatusRegistered), - // TCPDynamicPorts: to.Ptr("1433"), - // TCPStaticPorts: to.Ptr("1433"), - // VCore: to.Ptr("4"), - // Version: to.Ptr(armazurearcdata.SQLVersionSQLServer2012), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/CreateOrUpdateSqlServerInstance.json -func ExampleSQLServerInstancesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLServerInstancesClient().BeginCreate(ctx, "testrg", "testsqlServerInstance", armazurearcdata.SQLServerInstance{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - Properties: &armazurearcdata.SQLServerInstanceProperties{ - AzureDefenderStatus: to.Ptr(armazurearcdata.DefenderStatusProtected), - AzureDefenderStatusLastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t }()), - Collation: to.Ptr("collation"), - ContainerResourceID: to.Ptr("Resource id of hosting Arc Machine"), - CurrentVersion: to.Ptr("2012"), - Edition: to.Ptr(armazurearcdata.EditionTypeDeveloper), - HostType: to.Ptr(armazurearcdata.HostTypePhysicalServer), - InstanceName: to.Ptr("name of instance"), - LicenseType: to.Ptr(armazurearcdata.ArcSQLServerLicenseTypeFree), - PatchLevel: to.Ptr("patchlevel"), - ProductID: to.Ptr("sql id"), - Status: to.Ptr(armazurearcdata.ConnectionStatusRegistered), - TCPDynamicPorts: to.Ptr("1433"), - TCPStaticPorts: to.Ptr("1433"), - VCore: to.Ptr("4"), - Version: to.Ptr(armazurearcdata.SQLVersionSQLServer2012), - }, - }, 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.SQLServerInstance = armazurearcdata.SQLServerInstance{ - // Name: to.Ptr("testsqlServerInstance"), - // Type: to.Ptr("Microsoft.AzureArcData/SqlServerInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/SqlServerInstances/testsqlServerInstance"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // Properties: &armazurearcdata.SQLServerInstanceProperties{ - // AzureDefenderStatus: to.Ptr(armazurearcdata.DefenderStatusProtected), - // AzureDefenderStatusLastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // Collation: to.Ptr("collation"), - // ContainerResourceID: to.Ptr("Resource id of hosting Arc Machine"), - // CreateTime: to.Ptr("01/01/2020 01:01:01"), - // CurrentVersion: to.Ptr("2012"), - // Edition: to.Ptr(armazurearcdata.EditionTypeDeveloper), - // HostType: to.Ptr(armazurearcdata.HostTypePhysicalServer), - // InstanceName: to.Ptr("name of instance"), - // LicenseType: to.Ptr(armazurearcdata.ArcSQLServerLicenseTypeFree), - // PatchLevel: to.Ptr("patchlevel"), - // ProductID: to.Ptr("sql id"), - // Status: to.Ptr(armazurearcdata.ConnectionStatusRegistered), - // TCPDynamicPorts: to.Ptr("1433"), - // TCPStaticPorts: to.Ptr("1433"), - // VCore: to.Ptr("4"), - // Version: to.Ptr(armazurearcdata.SQLVersionSQLServer2012), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/DeleteSqlServerInstance.json -func ExampleSQLServerInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLServerInstancesClient().BeginDelete(ctx, "testrg", "testsqlServerInstance", 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/UpdateSqlServerInstance.json -func ExampleSQLServerInstancesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurearcdata.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLServerInstancesClient().Update(ctx, "testrg", "testsqlServerInstance", armazurearcdata.SQLServerInstanceUpdate{ - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - }, 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.SQLServerInstance = armazurearcdata.SQLServerInstance{ - // Name: to.Ptr("testsqlServerInstance"), - // Type: to.Ptr("Microsoft.AzureArcData/SqlServerInstances"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/SqlServerInstances/testsqlServerInstance"), - // SystemData: &armazurearcdata.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser), - // }, - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "mytag": to.Ptr("myval"), - // }, - // Properties: &armazurearcdata.SQLServerInstanceProperties{ - // AzureDefenderStatus: to.Ptr(armazurearcdata.DefenderStatusProtected), - // AzureDefenderStatusLastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // Collation: to.Ptr("collation"), - // ContainerResourceID: to.Ptr("Resource id of hosting Arc Machine"), - // CreateTime: to.Ptr("01/01/2020 01:01:01"), - // CurrentVersion: to.Ptr("2012"), - // Edition: to.Ptr(armazurearcdata.EditionTypeDeveloper), - // HostType: to.Ptr(armazurearcdata.HostTypePhysicalServer), - // InstanceName: to.Ptr("name of instance"), - // LicenseType: to.Ptr(armazurearcdata.ArcSQLServerLicenseTypeFree), - // PatchLevel: to.Ptr("patchlevel"), - // ProductID: to.Ptr("sql id"), - // Status: to.Ptr(armazurearcdata.ConnectionStatusRegistered), - // TCPDynamicPorts: to.Ptr("1433"), - // TCPStaticPorts: to.Ptr("1433"), - // VCore: to.Ptr("4"), - // Version: to.Ptr(armazurearcdata.SQLVersionSQLServer2012), - // }, - // } -}