diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md b/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md index 14759c10e004..6e67767e23f2 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md @@ -1,5 +1,49 @@ # Release History +## 0.7.0 (2023-06-12) +### 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.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 `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 `ArcSQLServerDatabaseListResult` +- New struct `FailoverGroupListResult` +- New struct `FailoverGroupProperties` +- New struct `FailoverGroupResource` +- New struct `FailoverGroupSpec` +- New struct `K8SActiveDirectory` +- New struct `K8SActiveDirectoryConnector` +- New struct `K8SNetworkSettings` +- New struct `K8SSecurity` +- New struct `K8SSettings` +- New struct `K8StransparentDataEncryption` +- New struct `SQLServerDatabaseResource` +- New struct `SQLServerDatabaseResourceProperties` +- New struct `SQLServerDatabaseResourcePropertiesBackupInformation` +- New struct `SQLServerDatabaseResourcePropertiesDatabaseOptions` +- New struct `SQLServerDatabaseUpdate` +- New field `Security`, `Settings` in struct `SQLManagedInstanceK8SSpec` +- 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..6a44799d9d50 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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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..a9b0b9fb5c25 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/client_factory.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/client_factory.go @@ -48,6 +48,11 @@ 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 @@ -67,3 +72,8 @@ 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 +} 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..4cacae0017d8 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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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..0b4670f7bbee --- /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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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..fae6bedfab2e 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,15 @@ type ActiveDirectoryInformation struct { KeytabInformation *KeytabInformation } +// 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 +} + // BasicLoginInformation - Username and password for basic login authentication. type BasicLoginInformation struct { // Login password. @@ -334,6 +343,134 @@ 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 +} + +// K8SActiveDirectory - The kubernetes active directory information. +type K8SActiveDirectory struct { + // Account name for AAD + AccountName *string + Connector *K8SActiveDirectoryConnector + + // An array of encryption types + EncryptionTypes []*string + + // Keytab secret used to authenticate with Active Directory. + KeytabSecret *string +} + +type K8SActiveDirectoryConnector struct { + // Name of the connector + Name *string + + // Name space of the connector + Namespace *string +} + +// K8SNetworkSettings - The kubernetes network settings information. +type K8SNetworkSettings struct { + // If 1, then SQL Server forces all connections to be encrypted. By default, this option is 0 + Forceencryption *int32 + + // Specifies which ciphers are allowed by SQL Server for TLS + Tlsciphers *string + + // A comma-separated list of which TLS protocols are allowed by SQL Server + Tlsprotocols *string +} + // 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. @@ -370,6 +507,42 @@ type K8SSchedulingOptions struct { Resources *K8SResourceRequirements } +// K8SSecurity - The kubernetes security information. +type K8SSecurity struct { + // The kubernetes active directory information. + ActiveDirectory *K8SActiveDirectory + + // OPTIONAL; Contains additional key/value pairs not defined in the schema. + AdditionalProperties map[string]any + + // Admin login secret key + AdminLoginSecret *string + + // Service certificate secret used + ServiceCertificateSecret *string + + // Transparent data encryption information. + TransparentDataEncryption *K8StransparentDataEncryption +} + +// K8SSettings - The kubernetes settings information. +type K8SSettings struct { + // OPTIONAL; Contains additional key/value pairs not defined in the schema. + AdditionalProperties map[string]any + + // The kubernetes network settings information. + Network *K8SNetworkSettings +} + +// K8StransparentDataEncryption - Transparent data encryption information. +type K8StransparentDataEncryption struct { + // Transparent data encryption mode. Can be Service Managed, Customer managed or disabled + Mode *string + + // Protector secret for customer managed Transparent data encryption mode + ProtectorSecret *string +} + // KeytabInformation - Keytab used for authenticate with Active Directory. type KeytabInformation struct { // A base64-encoded keytab. @@ -661,6 +834,12 @@ type SQLManagedInstanceK8SSpec struct { // The kubernetes scheduling information. Scheduling *K8SScheduling + + // The kubernetes security information. + Security *K8SSecurity + + // The kubernetes settings information. + Settings *K8SSettings } // SQLManagedInstanceListResult - A list of SqlManagedInstance. @@ -774,6 +953,119 @@ type SQLManagedInstancesClientUpdateOptions 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 +1116,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..2d50d555bb6a 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/models_serde.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/models_serde.go @@ -377,6 +377,37 @@ func (a *ActiveDirectoryInformation) UnmarshalJSON(data []byte) error { 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 BasicLoginInformation. func (b BasicLoginInformation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -709,6 +740,305 @@ func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type FailoverGroupListResult. +func (f FailoverGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + 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 FailoverGroupProperties. +func (f FailoverGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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 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 FailoverGroupResource. +func (f FailoverGroupResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + 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", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FailoverGroupSpec. +func (f FailoverGroupSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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 K8SActiveDirectory. +func (k K8SActiveDirectory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accountName", k.AccountName) + populate(objectMap, "connector", k.Connector) + populate(objectMap, "encryptionTypes", k.EncryptionTypes) + populate(objectMap, "keytabSecret", k.KeytabSecret) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type K8SActiveDirectory. +func (k *K8SActiveDirectory) 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 "accountName": + err = unpopulate(val, "AccountName", &k.AccountName) + delete(rawMsg, key) + case "connector": + err = unpopulate(val, "Connector", &k.Connector) + delete(rawMsg, key) + case "encryptionTypes": + err = unpopulate(val, "EncryptionTypes", &k.EncryptionTypes) + delete(rawMsg, key) + case "keytabSecret": + err = unpopulate(val, "KeytabSecret", &k.KeytabSecret) + 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 K8SActiveDirectoryConnector. +func (k K8SActiveDirectoryConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", k.Name) + populate(objectMap, "namespace", k.Namespace) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type K8SActiveDirectoryConnector. +func (k *K8SActiveDirectoryConnector) 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 "name": + err = unpopulate(val, "Name", &k.Name) + delete(rawMsg, key) + case "namespace": + err = unpopulate(val, "Namespace", &k.Namespace) + 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 K8SNetworkSettings. +func (k K8SNetworkSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "forceencryption", k.Forceencryption) + populate(objectMap, "tlsciphers", k.Tlsciphers) + populate(objectMap, "tlsprotocols", k.Tlsprotocols) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type K8SNetworkSettings. +func (k *K8SNetworkSettings) 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 "forceencryption": + err = unpopulate(val, "Forceencryption", &k.Forceencryption) + delete(rawMsg, key) + case "tlsciphers": + err = unpopulate(val, "Tlsciphers", &k.Tlsciphers) + delete(rawMsg, key) + case "tlsprotocols": + err = unpopulate(val, "Tlsprotocols", &k.Tlsprotocols) + 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 K8SResourceRequirements. func (k K8SResourceRequirements) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -839,6 +1169,133 @@ func (k *K8SSchedulingOptions) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type K8SSecurity. +func (k K8SSecurity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "activeDirectory", k.ActiveDirectory) + populate(objectMap, "adminLoginSecret", k.AdminLoginSecret) + populate(objectMap, "serviceCertificateSecret", k.ServiceCertificateSecret) + populate(objectMap, "transparentDataEncryption", k.TransparentDataEncryption) + 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 K8SSecurity. +func (k *K8SSecurity) 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 "activeDirectory": + err = unpopulate(val, "ActiveDirectory", &k.ActiveDirectory) + delete(rawMsg, key) + case "adminLoginSecret": + err = unpopulate(val, "AdminLoginSecret", &k.AdminLoginSecret) + delete(rawMsg, key) + case "serviceCertificateSecret": + err = unpopulate(val, "ServiceCertificateSecret", &k.ServiceCertificateSecret) + delete(rawMsg, key) + case "transparentDataEncryption": + err = unpopulate(val, "TransparentDataEncryption", &k.TransparentDataEncryption) + 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 K8SSettings. +func (k K8SSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "network", k.Network) + 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 K8SSettings. +func (k *K8SSettings) 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 "network": + err = unpopulate(val, "Network", &k.Network) + 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 K8StransparentDataEncryption. +func (k K8StransparentDataEncryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "mode", k.Mode) + populate(objectMap, "protectorSecret", k.ProtectorSecret) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type K8StransparentDataEncryption. +func (k *K8StransparentDataEncryption) 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 "mode": + err = unpopulate(val, "Mode", &k.Mode) + delete(rawMsg, key) + case "protectorSecret": + err = unpopulate(val, "ProtectorSecret", &k.ProtectorSecret) + 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) @@ -1475,6 +1932,8 @@ func (s SQLManagedInstanceK8SSpec) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "replicas", s.Replicas) populate(objectMap, "scheduling", s.Scheduling) + populate(objectMap, "security", s.Security) + populate(objectMap, "settings", s.Settings) if s.AdditionalProperties != nil { for key, val := range s.AdditionalProperties { objectMap[key] = val @@ -1498,6 +1957,12 @@ func (s *SQLManagedInstanceK8SSpec) UnmarshalJSON(data []byte) error { case "scheduling": err = unpopulate(val, "Scheduling", &s.Scheduling) delete(rawMsg, key) + case "security": + err = unpopulate(val, "Security", &s.Security) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &s.Settings) + delete(rawMsg, key) default: if s.AdditionalProperties == nil { s.AdditionalProperties = map[string]any{} @@ -1692,6 +2157,241 @@ func (s *SQLManagedInstanceUpdate) UnmarshalJSON(data []byte) error { 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 "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 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 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) + } + 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 SQLServerInstance. func (s SQLServerInstance) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1781,6 +2481,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 +2520,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..ffd6b1aa70f3 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-01-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-01-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..c73a3e71a91b 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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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..a18f1931c9d1 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 @@ -124,6 +144,31 @@ type SQLManagedInstancesClientUpdateResponse struct { SQLManagedInstance } +// 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/sqlmanagedinstances_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlmanagedinstances_client.go index e43c6aedb923..0b9f21b23657 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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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/sqlserverdatabases_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverdatabases_client.go new file mode 100644 index 000000000000..91eb632ee4c5 --- /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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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..92a57aef9d7d 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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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-01-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), - // }, - // } -}