diff --git a/services/azurearcdata/mgmt/2021-11-01/azurearcdata/CHANGELOG.md b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/azurearcdata/mgmt/2021-11-01/azurearcdata/_meta.json b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/_meta.json new file mode 100644 index 000000000000..c3d471fd54cb --- /dev/null +++ b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "b28a542b3eb4f2f4f384b14b635d0a835df818cd", + "readme": "/_/azure-rest-api-specs/specification/azurearcdata/resource-manager/readme.md", + "tag": "package-2021-11-01", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-11-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/azurearcdata/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/azurearcdata/mgmt/2021-11-01/azurearcdata/azurearcdataapi/interfaces.go b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/azurearcdataapi/interfaces.go new file mode 100644 index 000000000000..2d365ba76e2f --- /dev/null +++ b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/azurearcdataapi/interfaces.go @@ -0,0 +1,62 @@ +package azurearcdataapi + +// 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. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/azurearcdata/mgmt/2021-11-01/azurearcdata" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result azurearcdata.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result azurearcdata.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*azurearcdata.OperationsClient)(nil) + +// SQLManagedInstancesClientAPI contains the set of methods on the SQLManagedInstancesClient type. +type SQLManagedInstancesClientAPI interface { + Create(ctx context.Context, resourceGroupName string, SQLManagedInstanceName string, SQLManagedInstance azurearcdata.SQLManagedInstance) (result azurearcdata.SQLManagedInstancesCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, SQLManagedInstanceName string) (result azurearcdata.SQLManagedInstancesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, SQLManagedInstanceName string) (result azurearcdata.SQLManagedInstance, err error) + List(ctx context.Context) (result azurearcdata.SQLManagedInstanceListResultPage, err error) + ListComplete(ctx context.Context) (result azurearcdata.SQLManagedInstanceListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result azurearcdata.SQLManagedInstanceListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result azurearcdata.SQLManagedInstanceListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, SQLManagedInstanceName string, parameters azurearcdata.SQLManagedInstanceUpdate) (result azurearcdata.SQLManagedInstance, err error) +} + +var _ SQLManagedInstancesClientAPI = (*azurearcdata.SQLManagedInstancesClient)(nil) + +// SQLServerInstancesClientAPI contains the set of methods on the SQLServerInstancesClient type. +type SQLServerInstancesClientAPI interface { + Create(ctx context.Context, resourceGroupName string, SQLServerInstanceName string, SQLServerInstance azurearcdata.SQLServerInstance) (result azurearcdata.SQLServerInstancesCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, SQLServerInstanceName string) (result azurearcdata.SQLServerInstancesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, SQLServerInstanceName string) (result azurearcdata.SQLServerInstance, err error) + List(ctx context.Context) (result azurearcdata.SQLServerInstanceListResultPage, err error) + ListComplete(ctx context.Context) (result azurearcdata.SQLServerInstanceListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result azurearcdata.SQLServerInstanceListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result azurearcdata.SQLServerInstanceListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, SQLServerInstanceName string, parameters azurearcdata.SQLServerInstanceUpdate) (result azurearcdata.SQLServerInstance, err error) +} + +var _ SQLServerInstancesClientAPI = (*azurearcdata.SQLServerInstancesClient)(nil) + +// DataControllersClientAPI contains the set of methods on the DataControllersClient type. +type DataControllersClientAPI interface { + DeleteDataController(ctx context.Context, resourceGroupName string, dataControllerName string) (result azurearcdata.DataControllersDeleteDataControllerFuture, err error) + GetDataController(ctx context.Context, resourceGroupName string, dataControllerName string) (result azurearcdata.DataControllerResource, err error) + ListInGroup(ctx context.Context, resourceGroupName string) (result azurearcdata.PageOfDataControllerResourcePage, err error) + ListInGroupComplete(ctx context.Context, resourceGroupName string) (result azurearcdata.PageOfDataControllerResourceIterator, err error) + ListInSubscription(ctx context.Context) (result azurearcdata.PageOfDataControllerResourcePage, err error) + ListInSubscriptionComplete(ctx context.Context) (result azurearcdata.PageOfDataControllerResourceIterator, err error) + PatchDataController(ctx context.Context, resourceGroupName string, dataControllerName string, dataControllerResource azurearcdata.DataControllerUpdate) (result azurearcdata.DataControllerResource, err error) + PutDataController(ctx context.Context, resourceGroupName string, dataControllerResource azurearcdata.DataControllerResource, dataControllerName string) (result azurearcdata.DataControllersPutDataControllerFuture, err error) +} + +var _ DataControllersClientAPI = (*azurearcdata.DataControllersClient)(nil) diff --git a/services/azurearcdata/mgmt/2021-11-01/azurearcdata/client.go b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/client.go new file mode 100644 index 000000000000..d617392eedc5 --- /dev/null +++ b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/client.go @@ -0,0 +1,42 @@ +// Package azurearcdata implements the Azure ARM Azurearcdata service API version 2021-11-01. +// +// The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc +// Resources. +package azurearcdata + +// 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. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Azurearcdata + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Azurearcdata. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/azurearcdata/mgmt/2021-11-01/azurearcdata/datacontrollers.go b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/datacontrollers.go new file mode 100644 index 000000000000..a58753241749 --- /dev/null +++ b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/datacontrollers.go @@ -0,0 +1,584 @@ +package azurearcdata + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DataControllersClient is the the AzureArcData management API provides a RESTful set of web APIs to manage Azure Data +// Services on Azure Arc Resources. +type DataControllersClient struct { + BaseClient +} + +// NewDataControllersClient creates an instance of the DataControllersClient client. +func NewDataControllersClient(subscriptionID string) DataControllersClient { + return NewDataControllersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataControllersClientWithBaseURI creates an instance of the DataControllersClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewDataControllersClientWithBaseURI(baseURI string, subscriptionID string) DataControllersClient { + return DataControllersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// DeleteDataController deletes a dataController resource +// Parameters: +// resourceGroupName - the name of the Azure resource group +func (client DataControllersClient) DeleteDataController(ctx context.Context, resourceGroupName string, dataControllerName string) (result DataControllersDeleteDataControllerFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataControllersClient.DeleteDataController") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteDataControllerPreparer(ctx, resourceGroupName, dataControllerName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "DeleteDataController", nil, "Failure preparing request") + return + } + + result, err = client.DeleteDataControllerSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "DeleteDataController", result.Response(), "Failure sending request") + return + } + + return +} + +// DeleteDataControllerPreparer prepares the DeleteDataController request. +func (client DataControllersClient) DeleteDataControllerPreparer(ctx context.Context, resourceGroupName string, dataControllerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataControllerName": autorest.Encode("path", dataControllerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteDataControllerSender sends the DeleteDataController request. The method will close the +// http.Response Body if it receives an error. +func (client DataControllersClient) DeleteDataControllerSender(req *http.Request) (future DataControllersDeleteDataControllerFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteDataControllerResponder handles the response to the DeleteDataController request. The method always +// closes the http.Response Body. +func (client DataControllersClient) DeleteDataControllerResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetDataController retrieves a dataController resource +// Parameters: +// resourceGroupName - the name of the Azure resource group +func (client DataControllersClient) GetDataController(ctx context.Context, resourceGroupName string, dataControllerName string) (result DataControllerResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataControllersClient.GetDataController") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetDataControllerPreparer(ctx, resourceGroupName, dataControllerName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "GetDataController", nil, "Failure preparing request") + return + } + + resp, err := client.GetDataControllerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "GetDataController", resp, "Failure sending request") + return + } + + result, err = client.GetDataControllerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "GetDataController", resp, "Failure responding to request") + return + } + + return +} + +// GetDataControllerPreparer prepares the GetDataController request. +func (client DataControllersClient) GetDataControllerPreparer(ctx context.Context, resourceGroupName string, dataControllerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataControllerName": autorest.Encode("path", dataControllerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDataControllerSender sends the GetDataController request. The method will close the +// http.Response Body if it receives an error. +func (client DataControllersClient) GetDataControllerSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDataControllerResponder handles the response to the GetDataController request. The method always +// closes the http.Response Body. +func (client DataControllersClient) GetDataControllerResponder(resp *http.Response) (result DataControllerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListInGroup sends the list in group request. +// Parameters: +// resourceGroupName - the name of the Azure resource group +func (client DataControllersClient) ListInGroup(ctx context.Context, resourceGroupName string) (result PageOfDataControllerResourcePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataControllersClient.ListInGroup") + defer func() { + sc := -1 + if result.podcr.Response.Response != nil { + sc = result.podcr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listInGroupNextResults + req, err := client.ListInGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "ListInGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListInGroupSender(req) + if err != nil { + result.podcr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "ListInGroup", resp, "Failure sending request") + return + } + + result.podcr, err = client.ListInGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "ListInGroup", resp, "Failure responding to request") + return + } + if result.podcr.hasNextLink() && result.podcr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListInGroupPreparer prepares the ListInGroup request. +func (client DataControllersClient) ListInGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListInGroupSender sends the ListInGroup request. The method will close the +// http.Response Body if it receives an error. +func (client DataControllersClient) ListInGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListInGroupResponder handles the response to the ListInGroup request. The method always +// closes the http.Response Body. +func (client DataControllersClient) ListInGroupResponder(resp *http.Response) (result PageOfDataControllerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listInGroupNextResults retrieves the next set of results, if any. +func (client DataControllersClient) listInGroupNextResults(ctx context.Context, lastResults PageOfDataControllerResource) (result PageOfDataControllerResource, err error) { + req, err := lastResults.pageOfDataControllerResourcePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "listInGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListInGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "listInGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListInGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "listInGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListInGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client DataControllersClient) ListInGroupComplete(ctx context.Context, resourceGroupName string) (result PageOfDataControllerResourceIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataControllersClient.ListInGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListInGroup(ctx, resourceGroupName) + return +} + +// ListInSubscription sends the list in subscription request. +func (client DataControllersClient) ListInSubscription(ctx context.Context) (result PageOfDataControllerResourcePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataControllersClient.ListInSubscription") + defer func() { + sc := -1 + if result.podcr.Response.Response != nil { + sc = result.podcr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listInSubscriptionNextResults + req, err := client.ListInSubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "ListInSubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListInSubscriptionSender(req) + if err != nil { + result.podcr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "ListInSubscription", resp, "Failure sending request") + return + } + + result.podcr, err = client.ListInSubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "ListInSubscription", resp, "Failure responding to request") + return + } + if result.podcr.hasNextLink() && result.podcr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListInSubscriptionPreparer prepares the ListInSubscription request. +func (client DataControllersClient) ListInSubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/dataControllers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListInSubscriptionSender sends the ListInSubscription request. The method will close the +// http.Response Body if it receives an error. +func (client DataControllersClient) ListInSubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListInSubscriptionResponder handles the response to the ListInSubscription request. The method always +// closes the http.Response Body. +func (client DataControllersClient) ListInSubscriptionResponder(resp *http.Response) (result PageOfDataControllerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listInSubscriptionNextResults retrieves the next set of results, if any. +func (client DataControllersClient) listInSubscriptionNextResults(ctx context.Context, lastResults PageOfDataControllerResource) (result PageOfDataControllerResource, err error) { + req, err := lastResults.pageOfDataControllerResourcePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "listInSubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListInSubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "listInSubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListInSubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "listInSubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListInSubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client DataControllersClient) ListInSubscriptionComplete(ctx context.Context) (result PageOfDataControllerResourceIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataControllersClient.ListInSubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListInSubscription(ctx) + return +} + +// PatchDataController updates a dataController resource +// Parameters: +// resourceGroupName - the name of the Azure resource group +// dataControllerResource - the update data controller resource +func (client DataControllersClient) PatchDataController(ctx context.Context, resourceGroupName string, dataControllerName string, dataControllerResource DataControllerUpdate) (result DataControllerResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataControllersClient.PatchDataController") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PatchDataControllerPreparer(ctx, resourceGroupName, dataControllerName, dataControllerResource) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "PatchDataController", nil, "Failure preparing request") + return + } + + resp, err := client.PatchDataControllerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "PatchDataController", resp, "Failure sending request") + return + } + + result, err = client.PatchDataControllerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "PatchDataController", resp, "Failure responding to request") + return + } + + return +} + +// PatchDataControllerPreparer prepares the PatchDataController request. +func (client DataControllersClient) PatchDataControllerPreparer(ctx context.Context, resourceGroupName string, dataControllerName string, dataControllerResource DataControllerUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataControllerName": autorest.Encode("path", dataControllerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}", pathParameters), + autorest.WithJSON(dataControllerResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PatchDataControllerSender sends the PatchDataController request. The method will close the +// http.Response Body if it receives an error. +func (client DataControllersClient) PatchDataControllerSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PatchDataControllerResponder handles the response to the PatchDataController request. The method always +// closes the http.Response Body. +func (client DataControllersClient) PatchDataControllerResponder(resp *http.Response) (result DataControllerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// PutDataController creates or replaces a dataController resource +// Parameters: +// resourceGroupName - the name of the Azure resource group +// dataControllerResource - desc +func (client DataControllersClient) PutDataController(ctx context.Context, resourceGroupName string, dataControllerResource DataControllerResource, dataControllerName string) (result DataControllersPutDataControllerFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataControllersClient.PutDataController") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataControllerResource, + Constraints: []validation.Constraint{{Target: "dataControllerResource.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "dataControllerResource.Properties.OnPremiseProperty", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "dataControllerResource.Properties.OnPremiseProperty.ID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "dataControllerResource.Properties.OnPremiseProperty.PublicSigningKey", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("azurearcdata.DataControllersClient", "PutDataController", err.Error()) + } + + req, err := client.PutDataControllerPreparer(ctx, resourceGroupName, dataControllerResource, dataControllerName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "PutDataController", nil, "Failure preparing request") + return + } + + result, err = client.PutDataControllerSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersClient", "PutDataController", result.Response(), "Failure sending request") + return + } + + return +} + +// PutDataControllerPreparer prepares the PutDataController request. +func (client DataControllersClient) PutDataControllerPreparer(ctx context.Context, resourceGroupName string, dataControllerResource DataControllerResource, dataControllerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataControllerName": autorest.Encode("path", dataControllerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}", pathParameters), + autorest.WithJSON(dataControllerResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutDataControllerSender sends the PutDataController request. The method will close the +// http.Response Body if it receives an error. +func (client DataControllersClient) PutDataControllerSender(req *http.Request) (future DataControllersPutDataControllerFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PutDataControllerResponder handles the response to the PutDataController request. The method always +// closes the http.Response Body. +func (client DataControllersClient) PutDataControllerResponder(resp *http.Response) (result DataControllerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/azurearcdata/mgmt/2021-11-01/azurearcdata/enums.go b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/enums.go new file mode 100644 index 000000000000..9c2b549a3977 --- /dev/null +++ b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/enums.go @@ -0,0 +1,213 @@ +package azurearcdata + +// 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. + +// ArcSQLManagedInstanceLicenseType enumerates the values for arc sql managed instance license type. +type ArcSQLManagedInstanceLicenseType string + +const ( + // BasePrice ... + BasePrice ArcSQLManagedInstanceLicenseType = "BasePrice" + // LicenseIncluded ... + LicenseIncluded ArcSQLManagedInstanceLicenseType = "LicenseIncluded" +) + +// PossibleArcSQLManagedInstanceLicenseTypeValues returns an array of possible values for the ArcSQLManagedInstanceLicenseType const type. +func PossibleArcSQLManagedInstanceLicenseTypeValues() []ArcSQLManagedInstanceLicenseType { + return []ArcSQLManagedInstanceLicenseType{BasePrice, LicenseIncluded} +} + +// ArcSQLServerLicenseType enumerates the values for arc sql server license type. +type ArcSQLServerLicenseType string + +const ( + // Free ... + Free ArcSQLServerLicenseType = "Free" + // HADR ... + HADR ArcSQLServerLicenseType = "HADR" + // Paid ... + Paid ArcSQLServerLicenseType = "Paid" + // Undefined ... + Undefined ArcSQLServerLicenseType = "Undefined" +) + +// PossibleArcSQLServerLicenseTypeValues returns an array of possible values for the ArcSQLServerLicenseType const type. +func PossibleArcSQLServerLicenseTypeValues() []ArcSQLServerLicenseType { + return []ArcSQLServerLicenseType{Free, HADR, Paid, Undefined} +} + +// ConnectionStatus enumerates the values for connection status. +type ConnectionStatus string + +const ( + // Connected ... + Connected ConnectionStatus = "Connected" + // Disconnected ... + Disconnected ConnectionStatus = "Disconnected" + // Unknown ... + Unknown ConnectionStatus = "Unknown" +) + +// PossibleConnectionStatusValues returns an array of possible values for the ConnectionStatus const type. +func PossibleConnectionStatusValues() []ConnectionStatus { + return []ConnectionStatus{Connected, Disconnected, Unknown} +} + +// DefenderStatus enumerates the values for defender status. +type DefenderStatus string + +const ( + // DefenderStatusProtected ... + DefenderStatusProtected DefenderStatus = "Protected" + // DefenderStatusUnknown ... + DefenderStatusUnknown DefenderStatus = "Unknown" + // DefenderStatusUnprotected ... + DefenderStatusUnprotected DefenderStatus = "Unprotected" +) + +// PossibleDefenderStatusValues returns an array of possible values for the DefenderStatus const type. +func PossibleDefenderStatusValues() []DefenderStatus { + return []DefenderStatus{DefenderStatusProtected, DefenderStatusUnknown, DefenderStatusUnprotected} +} + +// EditionType enumerates the values for edition type. +type EditionType string + +const ( + // Developer ... + Developer EditionType = "Developer" + // Enterprise ... + Enterprise EditionType = "Enterprise" + // Evaluation ... + Evaluation EditionType = "Evaluation" + // Express ... + Express EditionType = "Express" + // Standard ... + Standard EditionType = "Standard" + // Web ... + Web EditionType = "Web" +) + +// PossibleEditionTypeValues returns an array of possible values for the EditionType const type. +func PossibleEditionTypeValues() []EditionType { + return []EditionType{Developer, Enterprise, Evaluation, Express, Standard, Web} +} + +// ExtendedLocationTypes enumerates the values for extended location types. +type ExtendedLocationTypes string + +const ( + // CustomLocation ... + CustomLocation ExtendedLocationTypes = "CustomLocation" +) + +// PossibleExtendedLocationTypesValues returns an array of possible values for the ExtendedLocationTypes const type. +func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { + return []ExtendedLocationTypes{CustomLocation} +} + +// IdentityType enumerates the values for identity type. +type IdentityType string + +const ( + // Application ... + Application IdentityType = "Application" + // Key ... + Key IdentityType = "Key" + // ManagedIdentity ... + ManagedIdentity IdentityType = "ManagedIdentity" + // User ... + User IdentityType = "User" +) + +// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{Application, Key, ManagedIdentity, User} +} + +// Infrastructure enumerates the values for infrastructure. +type Infrastructure string + +const ( + // Alibaba ... + Alibaba Infrastructure = "alibaba" + // Aws ... + Aws Infrastructure = "aws" + // Azure ... + Azure Infrastructure = "azure" + // Gcp ... + Gcp Infrastructure = "gcp" + // Onpremises ... + Onpremises Infrastructure = "onpremises" + // Other ... + Other Infrastructure = "other" +) + +// PossibleInfrastructureValues returns an array of possible values for the Infrastructure const type. +func PossibleInfrastructureValues() []Infrastructure { + return []Infrastructure{Alibaba, Aws, Azure, Gcp, Onpremises, Other} +} + +// OperationOrigin enumerates the values for operation origin. +type OperationOrigin string + +const ( + // OperationOriginSystem ... + OperationOriginSystem OperationOrigin = "system" + // OperationOriginUser ... + OperationOriginUser OperationOrigin = "user" +) + +// PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type. +func PossibleOperationOriginValues() []OperationOrigin { + return []OperationOrigin{OperationOriginSystem, OperationOriginUser} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // SystemAssigned ... + SystemAssigned ResourceIdentityType = "SystemAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{SystemAssigned} +} + +// SQLManagedInstanceSkuTier enumerates the values for sql managed instance sku tier. +type SQLManagedInstanceSkuTier string + +const ( + // BusinessCritical ... + BusinessCritical SQLManagedInstanceSkuTier = "BusinessCritical" + // GeneralPurpose ... + GeneralPurpose SQLManagedInstanceSkuTier = "GeneralPurpose" +) + +// PossibleSQLManagedInstanceSkuTierValues returns an array of possible values for the SQLManagedInstanceSkuTier const type. +func PossibleSQLManagedInstanceSkuTierValues() []SQLManagedInstanceSkuTier { + return []SQLManagedInstanceSkuTier{BusinessCritical, GeneralPurpose} +} + +// SQLVersion enumerates the values for sql version. +type SQLVersion string + +const ( + // SQLServer2016 ... + SQLServer2016 SQLVersion = "SQL Server 2016" + // SQLServer2017 ... + SQLServer2017 SQLVersion = "SQL Server 2017" + // SQLServer2019 ... + SQLServer2019 SQLVersion = "SQL Server 2019" +) + +// PossibleSQLVersionValues returns an array of possible values for the SQLVersion const type. +func PossibleSQLVersionValues() []SQLVersion { + return []SQLVersion{SQLServer2016, SQLServer2017, SQLServer2019} +} diff --git a/services/azurearcdata/mgmt/2021-11-01/azurearcdata/models.go b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/models.go new file mode 100644 index 000000000000..e91510c99a7c --- /dev/null +++ b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/models.go @@ -0,0 +1,1879 @@ +package azurearcdata + +// 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. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/azurearcdata/mgmt/2021-11-01/azurearcdata" + +// BasicLoginInformation username and password for basic login authentication. +type BasicLoginInformation struct { + // Username - Login username. + Username *string `json:"username,omitempty"` + // Password - Login password. + Password *string `json:"password,omitempty"` +} + +// CommonSku the resource model definition representing SKU for ARM resources +type CommonSku struct { + // Name - The name of the SKU. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Dev - Whether dev/test is enabled. When the dev field is set to true, the resource is used for dev/test purpose. + Dev *bool `json:"dev,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// DataControllerProperties the data controller properties. +type DataControllerProperties struct { + // Infrastructure - The infrastructure the data controller is running on. Possible values include: 'Azure', 'Gcp', 'Aws', 'Alibaba', 'Onpremises', 'Other' + Infrastructure Infrastructure `json:"infrastructure,omitempty"` + OnPremiseProperty *OnPremiseProperty `json:"onPremiseProperty,omitempty"` + // K8sRaw - The raw kubernetes information + K8sRaw interface{} `json:"k8sRaw,omitempty"` + UploadWatermark *UploadWatermark `json:"uploadWatermark,omitempty"` + // LastUploadedDate - Last uploaded date from Kubernetes cluster. Defaults to current date time + LastUploadedDate *date.Time `json:"lastUploadedDate,omitempty"` + // BasicLoginInformation - Deprecated. Azure Arc Data Services data controller no longer expose any endpoint. All traffic are exposed through Kubernetes native API. + BasicLoginInformation *BasicLoginInformation `json:"basicLoginInformation,omitempty"` + // MetricsDashboardCredential - Login credential for metrics dashboard on the Kubernetes cluster. + MetricsDashboardCredential *BasicLoginInformation `json:"metricsDashboardCredential,omitempty"` + // LogsDashboardCredential - Login credential for logs dashboard on the Kubernetes cluster. + LogsDashboardCredential *BasicLoginInformation `json:"logsDashboardCredential,omitempty"` + LogAnalyticsWorkspaceConfig *LogAnalyticsWorkspaceConfig `json:"logAnalyticsWorkspaceConfig,omitempty"` + // UploadServicePrincipal - Deprecated. Service principal is deprecated in favor of Arc Kubernetes service extension managed identity. + UploadServicePrincipal *UploadServicePrincipal `json:"uploadServicePrincipal,omitempty"` + // ProvisioningState - READ-ONLY + ProvisioningState *string `json:"provisioningState,omitempty"` + // ClusterID - If a CustomLocation is provided, this contains the ARM id of the connected cluster the custom location belongs to. + ClusterID *string `json:"clusterId,omitempty"` + // ExtensionID - If a CustomLocation is provided, this contains the ARM id of the extension the custom location belongs to. + ExtensionID *string `json:"extensionId,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataControllerProperties. +func (dcp DataControllerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcp.Infrastructure != "" { + objectMap["infrastructure"] = dcp.Infrastructure + } + if dcp.OnPremiseProperty != nil { + objectMap["onPremiseProperty"] = dcp.OnPremiseProperty + } + if dcp.K8sRaw != nil { + objectMap["k8sRaw"] = dcp.K8sRaw + } + if dcp.UploadWatermark != nil { + objectMap["uploadWatermark"] = dcp.UploadWatermark + } + if dcp.LastUploadedDate != nil { + objectMap["lastUploadedDate"] = dcp.LastUploadedDate + } + if dcp.BasicLoginInformation != nil { + objectMap["basicLoginInformation"] = dcp.BasicLoginInformation + } + if dcp.MetricsDashboardCredential != nil { + objectMap["metricsDashboardCredential"] = dcp.MetricsDashboardCredential + } + if dcp.LogsDashboardCredential != nil { + objectMap["logsDashboardCredential"] = dcp.LogsDashboardCredential + } + if dcp.LogAnalyticsWorkspaceConfig != nil { + objectMap["logAnalyticsWorkspaceConfig"] = dcp.LogAnalyticsWorkspaceConfig + } + if dcp.UploadServicePrincipal != nil { + objectMap["uploadServicePrincipal"] = dcp.UploadServicePrincipal + } + if dcp.ClusterID != nil { + objectMap["clusterId"] = dcp.ClusterID + } + if dcp.ExtensionID != nil { + objectMap["extensionId"] = dcp.ExtensionID + } + return json.Marshal(objectMap) +} + +// DataControllerResource data controller resource +type DataControllerResource struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extendedLocation of the resource. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Properties - The data controller's properties + Properties *DataControllerProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataControllerResource. +func (dcr DataControllerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcr.ExtendedLocation != nil { + objectMap["extendedLocation"] = dcr.ExtendedLocation + } + if dcr.Properties != nil { + objectMap["properties"] = dcr.Properties + } + if dcr.Tags != nil { + objectMap["tags"] = dcr.Tags + } + if dcr.Location != nil { + objectMap["location"] = dcr.Location + } + return json.Marshal(objectMap) +} + +// DataControllersDeleteDataControllerFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DataControllersDeleteDataControllerFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DataControllersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DataControllersDeleteDataControllerFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DataControllersDeleteDataControllerFuture.Result. +func (future *DataControllersDeleteDataControllerFuture) result(client DataControllersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersDeleteDataControllerFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("azurearcdata.DataControllersDeleteDataControllerFuture") + return + } + ar.Response = future.Response() + return +} + +// DataControllersPutDataControllerFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DataControllersPutDataControllerFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DataControllersClient) (DataControllerResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DataControllersPutDataControllerFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DataControllersPutDataControllerFuture.Result. +func (future *DataControllersPutDataControllerFuture) result(client DataControllersClient) (dcr DataControllerResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersPutDataControllerFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dcr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("azurearcdata.DataControllersPutDataControllerFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dcr.Response.Response, err = future.GetResult(sender); err == nil && dcr.Response.Response.StatusCode != http.StatusNoContent { + dcr, err = client.PutDataControllerResponder(dcr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.DataControllersPutDataControllerFuture", "Result", dcr.Response.Response, "Failure responding to request") + } + } + return +} + +// DataControllerUpdate used for updating a data controller resource. +type DataControllerUpdate struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DataControllerUpdate. +func (dcu DataControllerUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcu.Tags != nil { + objectMap["tags"] = dcu.Tags + } + return json.Marshal(objectMap) +} + +// ErrorResponse an error response from the Azure Data on Azure Arc service. +type ErrorResponse struct { + // Error - null + Error *ErrorResponseBody `json:"error,omitempty"` +} + +// ErrorResponseBody an error response from the Batch service. +type ErrorResponseBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]ErrorResponseBody `json:"details,omitempty"` +} + +// ExtendedLocation the complex type of the extended location. +type ExtendedLocation struct { + // Name - The name of the extended location. + Name *string `json:"name,omitempty"` + // Type - The type of the extended location. Possible values include: 'CustomLocation' + Type ExtendedLocationTypes `json:"type,omitempty"` +} + +// Identity identity for the resource. +type Identity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + return json.Marshal(objectMap) +} + +// K8sResourceRequirements the kubernetes resource limits and requests used to restrict or reserve resource +// usage. +type K8sResourceRequirements struct { + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // Requests - Requests for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' request must be less than or equal to 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', minimum is '2Gi. If sku.tier is GeneralPurpose, maximum 'cpu' is 24 and maximum 'memory' is '128Gi'. + Requests map[string]*string `json:"requests"` + // Limits - Limits for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' request must be less than or equal to 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', minimum is '2Gi. If sku.tier is GeneralPurpose, maximum 'cpu' is 24 and maximum 'memory' is '128Gi'. + Limits map[string]*string `json:"limits"` +} + +// MarshalJSON is the custom marshaler for K8sResourceRequirements. +func (krr K8sResourceRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if krr.Requests != nil { + objectMap["requests"] = krr.Requests + } + if krr.Limits != nil { + objectMap["limits"] = krr.Limits + } + for k, v := range krr.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for K8sResourceRequirements struct. +func (krr *K8sResourceRequirements) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if krr.AdditionalProperties == nil { + krr.AdditionalProperties = make(map[string]interface{}) + } + krr.AdditionalProperties[k] = additionalProperties + } + case "requests": + if v != nil { + var requests map[string]*string + err = json.Unmarshal(*v, &requests) + if err != nil { + return err + } + krr.Requests = requests + } + case "limits": + if v != nil { + var limits map[string]*string + err = json.Unmarshal(*v, &limits) + if err != nil { + return err + } + krr.Limits = limits + } + } + } + + return nil +} + +// K8sScheduling the kubernetes scheduling information. +type K8sScheduling struct { + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + Default *K8sSchedulingOptions `json:"default,omitempty"` +} + +// MarshalJSON is the custom marshaler for K8sScheduling. +func (ks K8sScheduling) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ks.Default != nil { + objectMap["default"] = ks.Default + } + for k, v := range ks.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for K8sScheduling struct. +func (ks *K8sScheduling) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if ks.AdditionalProperties == nil { + ks.AdditionalProperties = make(map[string]interface{}) + } + ks.AdditionalProperties[k] = additionalProperties + } + case "default": + if v != nil { + var defaultVar K8sSchedulingOptions + err = json.Unmarshal(*v, &defaultVar) + if err != nil { + return err + } + ks.Default = &defaultVar + } + } + } + + return nil +} + +// K8sSchedulingOptions the kubernetes scheduling options. It describes restrictions used to help +// Kubernetes select appropriate nodes to host the database service +type K8sSchedulingOptions struct { + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + Resources *K8sResourceRequirements `json:"resources,omitempty"` +} + +// MarshalJSON is the custom marshaler for K8sSchedulingOptions. +func (kso K8sSchedulingOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kso.Resources != nil { + objectMap["resources"] = kso.Resources + } + for k, v := range kso.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for K8sSchedulingOptions struct. +func (kso *K8sSchedulingOptions) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if kso.AdditionalProperties == nil { + kso.AdditionalProperties = make(map[string]interface{}) + } + kso.AdditionalProperties[k] = additionalProperties + } + case "resources": + if v != nil { + var resources K8sResourceRequirements + err = json.Unmarshal(*v, &resources) + if err != nil { + return err + } + kso.Resources = &resources + } + } + } + + return nil +} + +// LogAnalyticsWorkspaceConfig log analytics workspace id and primary key +type LogAnalyticsWorkspaceConfig struct { + // WorkspaceID - Azure Log Analytics workspace ID + WorkspaceID *uuid.UUID `json:"workspaceId,omitempty"` + // PrimaryKey - Primary key of the workspace + PrimaryKey *string `json:"primaryKey,omitempty"` +} + +// ODataError information about an error. +type ODataError struct { + // Code - A language-independent error name. + Code *string `json:"code,omitempty"` + // Message - The error message. + Message *string `json:"message,omitempty"` + // Target - The target of the error (for example, the name of the property in error). + Target *string `json:"target,omitempty"` + // Details - The error details. + Details *[]ODataError `json:"details,omitempty"` +} + +// OnPremiseProperty properties from the Kubernetes data controller +type OnPremiseProperty struct { + // ID - A globally unique ID identifying the associated Kubernetes cluster + ID *uuid.UUID `json:"id,omitempty"` + // PublicSigningKey - Certificate that contains the Kubernetes cluster public key used to verify signing + PublicSigningKey *string `json:"publicSigningKey,omitempty"` + // SigningCertificateThumbprint - Unique thumbprint returned to customer to verify the certificate being uploaded + SigningCertificateThumbprint *string `json:"signingCertificateThumbprint,omitempty"` +} + +// Operation azure Data Services on Azure Arc operation definition. +type Operation struct { + // Name - The name of the operation being performed on this particular object. + Name *string `json:"name,omitempty"` + // Display - The localized display information for this particular operation / action. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'OperationOriginUser', 'OperationOriginSystem' + Origin OperationOrigin `json:"origin,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + // Properties - READ-ONLY; Additional descriptions for the operation. + Properties map[string]interface{} `json:"properties"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.Name != nil { + objectMap["name"] = o.Name + } + if o.Display != nil { + objectMap["display"] = o.Display + } + if o.IsDataAction != nil { + objectMap["isDataAction"] = o.IsDataAction + } + return json.Marshal(objectMap) +} + +// OperationDisplay display metadata associated with the operation. +type OperationDisplay struct { + // Provider - The localized friendly form of the resource provider name. + Provider *string `json:"provider,omitempty"` + // Resource - The localized friendly form of the resource type related to this action/operation. + Resource *string `json:"resource,omitempty"` + // Operation - The localized friendly name for the operation. + Operation *string `json:"operation,omitempty"` + // Description - The localized friendly description for the operation. + Description *string `json:"description,omitempty"` +} + +// OperationListResult result of the request to list Azure Data Services on Azure Arc operations. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]Operation `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationListResult. +func (olr OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// PageOfDataControllerResource ... +type PageOfDataControllerResource struct { + autorest.Response `json:"-"` + Value *[]DataControllerResource `json:"value,omitempty"` + // NextLink - Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// PageOfDataControllerResourceIterator provides access to a complete listing of DataControllerResource +// values. +type PageOfDataControllerResourceIterator struct { + i int + page PageOfDataControllerResourcePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PageOfDataControllerResourceIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PageOfDataControllerResourceIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PageOfDataControllerResourceIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PageOfDataControllerResourceIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PageOfDataControllerResourceIterator) Response() PageOfDataControllerResource { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PageOfDataControllerResourceIterator) Value() DataControllerResource { + if !iter.page.NotDone() { + return DataControllerResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PageOfDataControllerResourceIterator type. +func NewPageOfDataControllerResourceIterator(page PageOfDataControllerResourcePage) PageOfDataControllerResourceIterator { + return PageOfDataControllerResourceIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (podcr PageOfDataControllerResource) IsEmpty() bool { + return podcr.Value == nil || len(*podcr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (podcr PageOfDataControllerResource) hasNextLink() bool { + return podcr.NextLink != nil && len(*podcr.NextLink) != 0 +} + +// pageOfDataControllerResourcePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (podcr PageOfDataControllerResource) pageOfDataControllerResourcePreparer(ctx context.Context) (*http.Request, error) { + if !podcr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(podcr.NextLink))) +} + +// PageOfDataControllerResourcePage contains a page of DataControllerResource values. +type PageOfDataControllerResourcePage struct { + fn func(context.Context, PageOfDataControllerResource) (PageOfDataControllerResource, error) + podcr PageOfDataControllerResource +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PageOfDataControllerResourcePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PageOfDataControllerResourcePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.podcr) + if err != nil { + return err + } + page.podcr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PageOfDataControllerResourcePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PageOfDataControllerResourcePage) NotDone() bool { + return !page.podcr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PageOfDataControllerResourcePage) Response() PageOfDataControllerResource { + return page.podcr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PageOfDataControllerResourcePage) Values() []DataControllerResource { + if page.podcr.IsEmpty() { + return nil + } + return *page.podcr.Value +} + +// Creates a new instance of the PageOfDataControllerResourcePage type. +func NewPageOfDataControllerResourcePage(cur PageOfDataControllerResource, getNextPage func(context.Context, PageOfDataControllerResource) (PageOfDataControllerResource, error)) PageOfDataControllerResourcePage { + return PageOfDataControllerResourcePage{ + fn: getNextPage, + podcr: cur, + } +} + +// Plan plan for the resource. +type Plan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than +// required location and tags +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource ... +type Resource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceSku ... +type ResourceSku struct { + Capacity *int32 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name *string `json:"name,omitempty"` + Size *string `json:"size,omitempty"` + Tier *string `json:"tier,omitempty"` +} + +// SQLManagedInstance a SqlManagedInstance. +type SQLManagedInstance struct { + autorest.Response `json:"-"` + // Properties - null + Properties *SQLManagedInstanceProperties `json:"properties,omitempty"` + // ExtendedLocation - The extendedLocation of the resource. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Sku - Resource sku. + Sku *SQLManagedInstanceSku `json:"sku,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLManagedInstance. +func (smi SQLManagedInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if smi.Properties != nil { + objectMap["properties"] = smi.Properties + } + if smi.ExtendedLocation != nil { + objectMap["extendedLocation"] = smi.ExtendedLocation + } + if smi.Sku != nil { + objectMap["sku"] = smi.Sku + } + if smi.Tags != nil { + objectMap["tags"] = smi.Tags + } + if smi.Location != nil { + objectMap["location"] = smi.Location + } + return json.Marshal(objectMap) +} + +// SQLManagedInstanceK8sRaw the raw kubernetes information. +type SQLManagedInstanceK8sRaw struct { + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + Spec *SQLManagedInstanceK8sSpec `json:"spec,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLManagedInstanceK8sRaw. +func (smikr SQLManagedInstanceK8sRaw) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if smikr.Spec != nil { + objectMap["spec"] = smikr.Spec + } + for k, v := range smikr.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SQLManagedInstanceK8sRaw struct. +func (smikr *SQLManagedInstanceK8sRaw) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if smikr.AdditionalProperties == nil { + smikr.AdditionalProperties = make(map[string]interface{}) + } + smikr.AdditionalProperties[k] = additionalProperties + } + case "spec": + if v != nil { + var spec SQLManagedInstanceK8sSpec + err = json.Unmarshal(*v, &spec) + if err != nil { + return err + } + smikr.Spec = &spec + } + } + } + + return nil +} + +// SQLManagedInstanceK8sSpec the kubernetes spec information. +type SQLManagedInstanceK8sSpec struct { + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + Scheduling *K8sScheduling `json:"scheduling,omitempty"` + // Replicas - This option specifies the number of SQL Managed Instance replicas that will be deployed in your Kubernetes cluster for high availability purposes. If sku.tier is BusinessCritical, allowed values are '2' or '3' with default of '3'. If sku.tier is GeneralPurpose, replicas must be '1'. + Replicas *int32 `json:"replicas,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLManagedInstanceK8sSpec. +func (smiks SQLManagedInstanceK8sSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if smiks.Scheduling != nil { + objectMap["scheduling"] = smiks.Scheduling + } + if smiks.Replicas != nil { + objectMap["replicas"] = smiks.Replicas + } + for k, v := range smiks.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SQLManagedInstanceK8sSpec struct. +func (smiks *SQLManagedInstanceK8sSpec) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if smiks.AdditionalProperties == nil { + smiks.AdditionalProperties = make(map[string]interface{}) + } + smiks.AdditionalProperties[k] = additionalProperties + } + case "scheduling": + if v != nil { + var scheduling K8sScheduling + err = json.Unmarshal(*v, &scheduling) + if err != nil { + return err + } + smiks.Scheduling = &scheduling + } + case "replicas": + if v != nil { + var replicas int32 + err = json.Unmarshal(*v, &replicas) + if err != nil { + return err + } + smiks.Replicas = &replicas + } + } + } + + return nil +} + +// SQLManagedInstanceListResult a list of SqlManagedInstance. +type SQLManagedInstanceListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]SQLManagedInstance `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLManagedInstanceListResult. +func (smilr SQLManagedInstanceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SQLManagedInstanceListResultIterator provides access to a complete listing of SQLManagedInstance values. +type SQLManagedInstanceListResultIterator struct { + i int + page SQLManagedInstanceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SQLManagedInstanceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLManagedInstanceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SQLManagedInstanceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SQLManagedInstanceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SQLManagedInstanceListResultIterator) Response() SQLManagedInstanceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SQLManagedInstanceListResultIterator) Value() SQLManagedInstance { + if !iter.page.NotDone() { + return SQLManagedInstance{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SQLManagedInstanceListResultIterator type. +func NewSQLManagedInstanceListResultIterator(page SQLManagedInstanceListResultPage) SQLManagedInstanceListResultIterator { + return SQLManagedInstanceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (smilr SQLManagedInstanceListResult) IsEmpty() bool { + return smilr.Value == nil || len(*smilr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (smilr SQLManagedInstanceListResult) hasNextLink() bool { + return smilr.NextLink != nil && len(*smilr.NextLink) != 0 +} + +// sQLManagedInstanceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (smilr SQLManagedInstanceListResult) sQLManagedInstanceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !smilr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(smilr.NextLink))) +} + +// SQLManagedInstanceListResultPage contains a page of SQLManagedInstance values. +type SQLManagedInstanceListResultPage struct { + fn func(context.Context, SQLManagedInstanceListResult) (SQLManagedInstanceListResult, error) + smilr SQLManagedInstanceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SQLManagedInstanceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLManagedInstanceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.smilr) + if err != nil { + return err + } + page.smilr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SQLManagedInstanceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SQLManagedInstanceListResultPage) NotDone() bool { + return !page.smilr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SQLManagedInstanceListResultPage) Response() SQLManagedInstanceListResult { + return page.smilr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SQLManagedInstanceListResultPage) Values() []SQLManagedInstance { + if page.smilr.IsEmpty() { + return nil + } + return *page.smilr.Value +} + +// Creates a new instance of the SQLManagedInstanceListResultPage type. +func NewSQLManagedInstanceListResultPage(cur SQLManagedInstanceListResult, getNextPage func(context.Context, SQLManagedInstanceListResult) (SQLManagedInstanceListResult, error)) SQLManagedInstanceListResultPage { + return SQLManagedInstanceListResultPage{ + fn: getNextPage, + smilr: cur, + } +} + +// SQLManagedInstanceProperties properties of sqlManagedInstance. +type SQLManagedInstanceProperties struct { + // DataControllerID - null + DataControllerID *string `json:"dataControllerId,omitempty"` + // Admin - The instance admin user + Admin *string `json:"admin,omitempty"` + // StartTime - The instance start time + StartTime *string `json:"startTime,omitempty"` + // EndTime - The instance end time + EndTime *string `json:"endTime,omitempty"` + // K8sRaw - The raw kubernetes information + K8sRaw *SQLManagedInstanceK8sRaw `json:"k8sRaw,omitempty"` + // BasicLoginInformation - Username and password for basic authentication. + BasicLoginInformation *BasicLoginInformation `json:"basicLoginInformation,omitempty"` + // LastUploadedDate - Last uploaded date from Kubernetes cluster. Defaults to current date time + LastUploadedDate *date.Time `json:"lastUploadedDate,omitempty"` + // ProvisioningState - READ-ONLY + ProvisioningState *string `json:"provisioningState,omitempty"` + // LicenseType - The license type to apply for this managed instance. Possible values include: 'BasePrice', 'LicenseIncluded' + LicenseType ArcSQLManagedInstanceLicenseType `json:"licenseType,omitempty"` + // ClusterID - If a CustomLocation is provided, this contains the ARM id of the connected cluster the custom location belongs to. + ClusterID *string `json:"clusterId,omitempty"` + // ExtensionID - If a CustomLocation is provided, this contains the ARM id of the extension the custom location belongs to. + ExtensionID *string `json:"extensionId,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLManagedInstanceProperties. +func (smip SQLManagedInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if smip.DataControllerID != nil { + objectMap["dataControllerId"] = smip.DataControllerID + } + if smip.Admin != nil { + objectMap["admin"] = smip.Admin + } + if smip.StartTime != nil { + objectMap["startTime"] = smip.StartTime + } + if smip.EndTime != nil { + objectMap["endTime"] = smip.EndTime + } + if smip.K8sRaw != nil { + objectMap["k8sRaw"] = smip.K8sRaw + } + if smip.BasicLoginInformation != nil { + objectMap["basicLoginInformation"] = smip.BasicLoginInformation + } + if smip.LastUploadedDate != nil { + objectMap["lastUploadedDate"] = smip.LastUploadedDate + } + if smip.LicenseType != "" { + objectMap["licenseType"] = smip.LicenseType + } + if smip.ClusterID != nil { + objectMap["clusterId"] = smip.ClusterID + } + if smip.ExtensionID != nil { + objectMap["extensionId"] = smip.ExtensionID + } + return json.Marshal(objectMap) +} + +// SQLManagedInstancesCreateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SQLManagedInstancesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SQLManagedInstancesClient) (SQLManagedInstance, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SQLManagedInstancesCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SQLManagedInstancesCreateFuture.Result. +func (future *SQLManagedInstancesCreateFuture) result(client SQLManagedInstancesClient) (smi SQLManagedInstance, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + smi.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("azurearcdata.SQLManagedInstancesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if smi.Response.Response, err = future.GetResult(sender); err == nil && smi.Response.Response.StatusCode != http.StatusNoContent { + smi, err = client.CreateResponder(smi.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesCreateFuture", "Result", smi.Response.Response, "Failure responding to request") + } + } + return +} + +// SQLManagedInstancesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SQLManagedInstancesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SQLManagedInstancesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SQLManagedInstancesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SQLManagedInstancesDeleteFuture.Result. +func (future *SQLManagedInstancesDeleteFuture) result(client SQLManagedInstancesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("azurearcdata.SQLManagedInstancesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SQLManagedInstanceSku the resource model definition representing SKU for Azure Managed Instance - Azure +// Arc +type SQLManagedInstanceSku struct { + // Name - The name of the SKU. + Name *string `json:"name,omitempty"` + // Tier - The pricing tier for the instance. Possible values include: 'GeneralPurpose', 'BusinessCritical' + Tier SQLManagedInstanceSkuTier `json:"tier,omitempty"` + // Dev - Whether dev/test is enabled. When the dev field is set to true, the resource is used for dev/test purpose. + Dev *bool `json:"dev,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + Family *string `json:"family,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` +} + +// SQLManagedInstanceUpdate an update to a SQL Managed Instance. +type SQLManagedInstanceUpdate struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for SQLManagedInstanceUpdate. +func (smiu SQLManagedInstanceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if smiu.Tags != nil { + objectMap["tags"] = smiu.Tags + } + return json.Marshal(objectMap) +} + +// SQLServerInstance a SqlServerInstance. +type SQLServerInstance struct { + autorest.Response `json:"-"` + // Properties - null + Properties *SQLServerInstanceProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLServerInstance. +func (ssi SQLServerInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssi.Properties != nil { + objectMap["properties"] = ssi.Properties + } + if ssi.Tags != nil { + objectMap["tags"] = ssi.Tags + } + if ssi.Location != nil { + objectMap["location"] = ssi.Location + } + return json.Marshal(objectMap) +} + +// SQLServerInstanceListResult a list of SqlServerInstance. +type SQLServerInstanceListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]SQLServerInstance `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLServerInstanceListResult. +func (ssilr SQLServerInstanceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SQLServerInstanceListResultIterator provides access to a complete listing of SQLServerInstance values. +type SQLServerInstanceListResultIterator struct { + i int + page SQLServerInstanceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SQLServerInstanceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLServerInstanceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SQLServerInstanceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SQLServerInstanceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SQLServerInstanceListResultIterator) Response() SQLServerInstanceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SQLServerInstanceListResultIterator) Value() SQLServerInstance { + if !iter.page.NotDone() { + return SQLServerInstance{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SQLServerInstanceListResultIterator type. +func NewSQLServerInstanceListResultIterator(page SQLServerInstanceListResultPage) SQLServerInstanceListResultIterator { + return SQLServerInstanceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ssilr SQLServerInstanceListResult) IsEmpty() bool { + return ssilr.Value == nil || len(*ssilr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ssilr SQLServerInstanceListResult) hasNextLink() bool { + return ssilr.NextLink != nil && len(*ssilr.NextLink) != 0 +} + +// sQLServerInstanceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ssilr SQLServerInstanceListResult) sQLServerInstanceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ssilr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ssilr.NextLink))) +} + +// SQLServerInstanceListResultPage contains a page of SQLServerInstance values. +type SQLServerInstanceListResultPage struct { + fn func(context.Context, SQLServerInstanceListResult) (SQLServerInstanceListResult, error) + ssilr SQLServerInstanceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SQLServerInstanceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLServerInstanceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ssilr) + if err != nil { + return err + } + page.ssilr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SQLServerInstanceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SQLServerInstanceListResultPage) NotDone() bool { + return !page.ssilr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SQLServerInstanceListResultPage) Response() SQLServerInstanceListResult { + return page.ssilr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SQLServerInstanceListResultPage) Values() []SQLServerInstance { + if page.ssilr.IsEmpty() { + return nil + } + return *page.ssilr.Value +} + +// Creates a new instance of the SQLServerInstanceListResultPage type. +func NewSQLServerInstanceListResultPage(cur SQLServerInstanceListResult, getNextPage func(context.Context, SQLServerInstanceListResult) (SQLServerInstanceListResult, error)) SQLServerInstanceListResultPage { + return SQLServerInstanceListResultPage{ + fn: getNextPage, + ssilr: cur, + } +} + +// SQLServerInstanceProperties properties of SqlServerInstance. +type SQLServerInstanceProperties struct { + // Version - SQL Server version. Possible values include: 'SQLServer2019', 'SQLServer2017', 'SQLServer2016' + Version SQLVersion `json:"version,omitempty"` + // Edition - SQL Server edition. Possible values include: 'Evaluation', 'Enterprise', 'Standard', 'Web', 'Developer', 'Express' + Edition EditionType `json:"edition,omitempty"` + // ContainerResourceID - ARM Resource id of the container resource (Azure Arc for Servers). + ContainerResourceID *string `json:"containerResourceId,omitempty"` + // CreateTime - READ-ONLY; The time when the resource was created. + CreateTime *string `json:"createTime,omitempty"` + // VCore - The number of logical processors used by the SQL Server instance. + VCore *string `json:"vCore,omitempty"` + // Status - The cloud connectivity status. Possible values include: 'Connected', 'Disconnected', 'Unknown' + Status ConnectionStatus `json:"status,omitempty"` + // PatchLevel - SQL Server update level. + PatchLevel *string `json:"patchLevel,omitempty"` + // Collation - SQL Server collation. + Collation *string `json:"collation,omitempty"` + // CurrentVersion - SQL Server current version. + CurrentVersion *string `json:"currentVersion,omitempty"` + // InstanceName - SQL Server instance name. + InstanceName *string `json:"instanceName,omitempty"` + // TCPDynamicPorts - Dynamic TCP ports used by SQL Server. + TCPDynamicPorts *string `json:"tcpDynamicPorts,omitempty"` + // TCPStaticPorts - Static TCP ports used by SQL Server. + TCPStaticPorts *string `json:"tcpStaticPorts,omitempty"` + // ProductID - SQL Server product ID. + ProductID *string `json:"productId,omitempty"` + // LicenseType - SQL Server license type. Possible values include: 'Paid', 'Free', 'HADR', 'Undefined' + LicenseType ArcSQLServerLicenseType `json:"licenseType,omitempty"` + // AzureDefenderStatusLastUpdated - Timestamp of last Azure Defender status update. + AzureDefenderStatusLastUpdated *date.Time `json:"azureDefenderStatusLastUpdated,omitempty"` + // AzureDefenderStatus - Status of Azure Defender. Possible values include: 'DefenderStatusProtected', 'DefenderStatusUnprotected', 'DefenderStatusUnknown' + AzureDefenderStatus DefenderStatus `json:"azureDefenderStatus,omitempty"` + // ProvisioningState - READ-ONLY + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLServerInstanceProperties. +func (ssip SQLServerInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssip.Version != "" { + objectMap["version"] = ssip.Version + } + if ssip.Edition != "" { + objectMap["edition"] = ssip.Edition + } + if ssip.ContainerResourceID != nil { + objectMap["containerResourceId"] = ssip.ContainerResourceID + } + if ssip.VCore != nil { + objectMap["vCore"] = ssip.VCore + } + if ssip.Status != "" { + objectMap["status"] = ssip.Status + } + if ssip.PatchLevel != nil { + objectMap["patchLevel"] = ssip.PatchLevel + } + if ssip.Collation != nil { + objectMap["collation"] = ssip.Collation + } + if ssip.CurrentVersion != nil { + objectMap["currentVersion"] = ssip.CurrentVersion + } + if ssip.InstanceName != nil { + objectMap["instanceName"] = ssip.InstanceName + } + if ssip.TCPDynamicPorts != nil { + objectMap["tcpDynamicPorts"] = ssip.TCPDynamicPorts + } + if ssip.TCPStaticPorts != nil { + objectMap["tcpStaticPorts"] = ssip.TCPStaticPorts + } + if ssip.ProductID != nil { + objectMap["productId"] = ssip.ProductID + } + if ssip.LicenseType != "" { + objectMap["licenseType"] = ssip.LicenseType + } + if ssip.AzureDefenderStatusLastUpdated != nil { + objectMap["azureDefenderStatusLastUpdated"] = ssip.AzureDefenderStatusLastUpdated + } + if ssip.AzureDefenderStatus != "" { + objectMap["azureDefenderStatus"] = ssip.AzureDefenderStatus + } + return json.Marshal(objectMap) +} + +// SQLServerInstancesCreateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SQLServerInstancesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SQLServerInstancesClient) (SQLServerInstance, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SQLServerInstancesCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SQLServerInstancesCreateFuture.Result. +func (future *SQLServerInstancesCreateFuture) result(client SQLServerInstancesClient) (ssi SQLServerInstance, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ssi.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("azurearcdata.SQLServerInstancesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ssi.Response.Response, err = future.GetResult(sender); err == nil && ssi.Response.Response.StatusCode != http.StatusNoContent { + ssi, err = client.CreateResponder(ssi.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesCreateFuture", "Result", ssi.Response.Response, "Failure responding to request") + } + } + return +} + +// SQLServerInstancesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SQLServerInstancesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SQLServerInstancesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SQLServerInstancesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SQLServerInstancesDeleteFuture.Result. +func (future *SQLServerInstancesDeleteFuture) result(client SQLServerInstancesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("azurearcdata.SQLServerInstancesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SQLServerInstanceUpdate an update to a SQL Server Instance. +type SQLServerInstanceUpdate struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for SQLServerInstanceUpdate. +func (ssiu SQLServerInstanceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssiu.Tags != nil { + objectMap["tags"] = ssiu.Tags + } + return json.Marshal(objectMap) +} + +// SystemData read only system data +type SystemData struct { + // CreatedBy - An identifier for the identity that created the resource + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType IdentityType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC) + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - An identifier for the identity that last modified the resource + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType IdentityType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TrackedResource the resource model definition for a ARM tracked top level resource +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// UploadServicePrincipal service principal for uploading billing, metrics and logs. +type UploadServicePrincipal struct { + // ClientID - Client ID of the service principal for uploading data. + ClientID *uuid.UUID `json:"clientId,omitempty"` + // TenantID - Tenant ID of the service principal. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // Authority - Authority for the service principal. Example: https://login.microsoftonline.com/ + Authority *string `json:"authority,omitempty"` + // ClientSecret - Secret of the service principal + ClientSecret *string `json:"clientSecret,omitempty"` +} + +// UploadWatermark properties on upload watermark. Mostly timestamp for each upload data type +type UploadWatermark struct { + // Metrics - Last uploaded date for metrics from kubernetes cluster. Defaults to current date time + Metrics *date.Time `json:"metrics,omitempty"` + // Logs - Last uploaded date for logs from kubernetes cluster. Defaults to current date time + Logs *date.Time `json:"logs,omitempty"` + // Usages - Last uploaded date for usages from kubernetes cluster. Defaults to current date time + Usages *date.Time `json:"usages,omitempty"` +} diff --git a/services/azurearcdata/mgmt/2021-11-01/azurearcdata/operations.go b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/operations.go new file mode 100644 index 000000000000..e9a6648e043f --- /dev/null +++ b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/operations.go @@ -0,0 +1,141 @@ +package azurearcdata + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the the AzureArcData management API provides a RESTful set of web APIs to manage Azure Data +// Services on Azure Arc Resources. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available Azure Data Services on Azure Arc API operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurearcdata.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.AzureArcData/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "azurearcdata.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "azurearcdata.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/azurearcdata/mgmt/2021-11-01/azurearcdata/sqlmanagedinstances.go b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/sqlmanagedinstances.go new file mode 100644 index 000000000000..33cef9ce1452 --- /dev/null +++ b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/sqlmanagedinstances.go @@ -0,0 +1,586 @@ +package azurearcdata + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SQLManagedInstancesClient is the the AzureArcData management API provides a RESTful set of web APIs to manage Azure +// Data Services on Azure Arc Resources. +type SQLManagedInstancesClient struct { + BaseClient +} + +// NewSQLManagedInstancesClient creates an instance of the SQLManagedInstancesClient client. +func NewSQLManagedInstancesClient(subscriptionID string) SQLManagedInstancesClient { + return NewSQLManagedInstancesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSQLManagedInstancesClientWithBaseURI creates an instance of the SQLManagedInstancesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewSQLManagedInstancesClientWithBaseURI(baseURI string, subscriptionID string) SQLManagedInstancesClient { + return SQLManagedInstancesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates or replaces a SQL Managed Instance resource +// Parameters: +// resourceGroupName - the name of the Azure resource group +// SQLManagedInstanceName - the name of SQL Managed Instances +// SQLManagedInstance - the SQL Managed Instance to be created or updated. +func (client SQLManagedInstancesClient) Create(ctx context.Context, resourceGroupName string, SQLManagedInstanceName string, SQLManagedInstance SQLManagedInstance) (result SQLManagedInstancesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLManagedInstancesClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: SQLManagedInstance, + Constraints: []validation.Constraint{{Target: "SQLManagedInstance.Properties", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "SQLManagedInstance.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "SQLManagedInstance.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("azurearcdata.SQLManagedInstancesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, SQLManagedInstanceName, SQLManagedInstance) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client SQLManagedInstancesClient) CreatePreparer(ctx context.Context, resourceGroupName string, SQLManagedInstanceName string, SQLManagedInstance SQLManagedInstance) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sqlManagedInstanceName": autorest.Encode("path", SQLManagedInstanceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}", pathParameters), + autorest.WithJSON(SQLManagedInstance), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client SQLManagedInstancesClient) CreateSender(req *http.Request) (future SQLManagedInstancesCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client SQLManagedInstancesClient) CreateResponder(resp *http.Response) (result SQLManagedInstance, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a SQL Managed Instance resource +// Parameters: +// resourceGroupName - the name of the Azure resource group +// SQLManagedInstanceName - the name of Sql Managed Instances +func (client SQLManagedInstancesClient) Delete(ctx context.Context, resourceGroupName string, SQLManagedInstanceName string) (result SQLManagedInstancesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLManagedInstancesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, SQLManagedInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SQLManagedInstancesClient) DeletePreparer(ctx context.Context, resourceGroupName string, SQLManagedInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sqlManagedInstanceName": autorest.Encode("path", SQLManagedInstanceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SQLManagedInstancesClient) DeleteSender(req *http.Request) (future SQLManagedInstancesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SQLManagedInstancesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves a SQL Managed Instance resource +// Parameters: +// resourceGroupName - the name of the Azure resource group +// SQLManagedInstanceName - name of SQL Managed Instance +func (client SQLManagedInstancesClient) Get(ctx context.Context, resourceGroupName string, SQLManagedInstanceName string) (result SQLManagedInstance, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLManagedInstancesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, SQLManagedInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SQLManagedInstancesClient) GetPreparer(ctx context.Context, resourceGroupName string, SQLManagedInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sqlManagedInstanceName": autorest.Encode("path", SQLManagedInstanceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SQLManagedInstancesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SQLManagedInstancesClient) GetResponder(resp *http.Response) (result SQLManagedInstance, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +func (client SQLManagedInstancesClient) List(ctx context.Context) (result SQLManagedInstanceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLManagedInstancesClient.List") + defer func() { + sc := -1 + if result.smilr.Response.Response != nil { + sc = result.smilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.smilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "List", resp, "Failure sending request") + return + } + + result.smilr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "List", resp, "Failure responding to request") + return + } + if result.smilr.hasNextLink() && result.smilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SQLManagedInstancesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlManagedInstances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SQLManagedInstancesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SQLManagedInstancesClient) ListResponder(resp *http.Response) (result SQLManagedInstanceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SQLManagedInstancesClient) listNextResults(ctx context.Context, lastResults SQLManagedInstanceListResult) (result SQLManagedInstanceListResult, err error) { + req, err := lastResults.sQLManagedInstanceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SQLManagedInstancesClient) ListComplete(ctx context.Context) (result SQLManagedInstanceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLManagedInstancesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets all sqlManagedInstances in a resource group. +// Parameters: +// resourceGroupName - the name of the Azure resource group +func (client SQLManagedInstancesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SQLManagedInstanceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLManagedInstancesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.smilr.Response.Response != nil { + sc = result.smilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.smilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.smilr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.smilr.hasNextLink() && result.smilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client SQLManagedInstancesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client SQLManagedInstancesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client SQLManagedInstancesClient) ListByResourceGroupResponder(resp *http.Response) (result SQLManagedInstanceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client SQLManagedInstancesClient) listByResourceGroupNextResults(ctx context.Context, lastResults SQLManagedInstanceListResult) (result SQLManagedInstanceListResult, err error) { + req, err := lastResults.sQLManagedInstanceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client SQLManagedInstancesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result SQLManagedInstanceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLManagedInstancesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Update updates a SQL Managed Instance resource +// Parameters: +// resourceGroupName - the name of the Azure resource group +// SQLManagedInstanceName - name of sqlManagedInstance +// parameters - the SQL Managed Instance. +func (client SQLManagedInstancesClient) Update(ctx context.Context, resourceGroupName string, SQLManagedInstanceName string, parameters SQLManagedInstanceUpdate) (result SQLManagedInstance, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLManagedInstancesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, SQLManagedInstanceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLManagedInstancesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SQLManagedInstancesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, SQLManagedInstanceName string, parameters SQLManagedInstanceUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sqlManagedInstanceName": autorest.Encode("path", SQLManagedInstanceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client SQLManagedInstancesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SQLManagedInstancesClient) UpdateResponder(resp *http.Response) (result SQLManagedInstance, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/azurearcdata/mgmt/2021-11-01/azurearcdata/sqlserverinstances.go b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/sqlserverinstances.go new file mode 100644 index 000000000000..27086afa2143 --- /dev/null +++ b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/sqlserverinstances.go @@ -0,0 +1,585 @@ +package azurearcdata + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SQLServerInstancesClient is the the AzureArcData management API provides a RESTful set of web APIs to manage Azure +// Data Services on Azure Arc Resources. +type SQLServerInstancesClient struct { + BaseClient +} + +// NewSQLServerInstancesClient creates an instance of the SQLServerInstancesClient client. +func NewSQLServerInstancesClient(subscriptionID string) SQLServerInstancesClient { + return NewSQLServerInstancesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSQLServerInstancesClientWithBaseURI creates an instance of the SQLServerInstancesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewSQLServerInstancesClientWithBaseURI(baseURI string, subscriptionID string) SQLServerInstancesClient { + return SQLServerInstancesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates or replaces a SQL Server Instance resource +// Parameters: +// resourceGroupName - the name of the Azure resource group +// SQLServerInstanceName - the name of SQL Server Instance +// SQLServerInstance - the SQL Server Instance to be created or updated. +func (client SQLServerInstancesClient) Create(ctx context.Context, resourceGroupName string, SQLServerInstanceName string, SQLServerInstance SQLServerInstance) (result SQLServerInstancesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLServerInstancesClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: SQLServerInstance, + Constraints: []validation.Constraint{{Target: "SQLServerInstance.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "SQLServerInstance.Properties.ContainerResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("azurearcdata.SQLServerInstancesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, SQLServerInstanceName, SQLServerInstance) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client SQLServerInstancesClient) CreatePreparer(ctx context.Context, resourceGroupName string, SQLServerInstanceName string, SQLServerInstance SQLServerInstance) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sqlServerInstanceName": autorest.Encode("path", SQLServerInstanceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}", pathParameters), + autorest.WithJSON(SQLServerInstance), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client SQLServerInstancesClient) CreateSender(req *http.Request) (future SQLServerInstancesCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client SQLServerInstancesClient) CreateResponder(resp *http.Response) (result SQLServerInstance, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a SQL Server Instance resource +// Parameters: +// resourceGroupName - the name of the Azure resource group +// SQLServerInstanceName - the name of SQL Server Instance +func (client SQLServerInstancesClient) Delete(ctx context.Context, resourceGroupName string, SQLServerInstanceName string) (result SQLServerInstancesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLServerInstancesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, SQLServerInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SQLServerInstancesClient) DeletePreparer(ctx context.Context, resourceGroupName string, SQLServerInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sqlServerInstanceName": autorest.Encode("path", SQLServerInstanceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SQLServerInstancesClient) DeleteSender(req *http.Request) (future SQLServerInstancesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SQLServerInstancesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves a SQL Server Instance resource +// Parameters: +// resourceGroupName - the name of the Azure resource group +// SQLServerInstanceName - name of SQL Server Instance +func (client SQLServerInstancesClient) Get(ctx context.Context, resourceGroupName string, SQLServerInstanceName string) (result SQLServerInstance, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLServerInstancesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, SQLServerInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SQLServerInstancesClient) GetPreparer(ctx context.Context, resourceGroupName string, SQLServerInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sqlServerInstanceName": autorest.Encode("path", SQLServerInstanceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SQLServerInstancesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SQLServerInstancesClient) GetResponder(resp *http.Response) (result SQLServerInstance, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +func (client SQLServerInstancesClient) List(ctx context.Context) (result SQLServerInstanceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLServerInstancesClient.List") + defer func() { + sc := -1 + if result.ssilr.Response.Response != nil { + sc = result.ssilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ssilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "List", resp, "Failure sending request") + return + } + + result.ssilr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "List", resp, "Failure responding to request") + return + } + if result.ssilr.hasNextLink() && result.ssilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SQLServerInstancesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlServerInstances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SQLServerInstancesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SQLServerInstancesClient) ListResponder(resp *http.Response) (result SQLServerInstanceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SQLServerInstancesClient) listNextResults(ctx context.Context, lastResults SQLServerInstanceListResult) (result SQLServerInstanceListResult, err error) { + req, err := lastResults.sQLServerInstanceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SQLServerInstancesClient) ListComplete(ctx context.Context) (result SQLServerInstanceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLServerInstancesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets all sqlServerInstances in a resource group. +// Parameters: +// resourceGroupName - the name of the Azure resource group +func (client SQLServerInstancesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SQLServerInstanceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLServerInstancesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.ssilr.Response.Response != nil { + sc = result.ssilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.ssilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.ssilr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.ssilr.hasNextLink() && result.ssilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client SQLServerInstancesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client SQLServerInstancesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client SQLServerInstancesClient) ListByResourceGroupResponder(resp *http.Response) (result SQLServerInstanceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client SQLServerInstancesClient) listByResourceGroupNextResults(ctx context.Context, lastResults SQLServerInstanceListResult) (result SQLServerInstanceListResult, err error) { + req, err := lastResults.sQLServerInstanceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client SQLServerInstancesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result SQLServerInstanceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLServerInstancesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Update updates a SQL Server Instance resource +// Parameters: +// resourceGroupName - the name of the Azure resource group +// SQLServerInstanceName - name of sqlServerInstance +// parameters - the SQL Server Instance. +func (client SQLServerInstancesClient) Update(ctx context.Context, resourceGroupName string, SQLServerInstanceName string, parameters SQLServerInstanceUpdate) (result SQLServerInstance, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLServerInstancesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, SQLServerInstanceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "azurearcdata.SQLServerInstancesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SQLServerInstancesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, SQLServerInstanceName string, parameters SQLServerInstanceUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sqlServerInstanceName": autorest.Encode("path", SQLServerInstanceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client SQLServerInstancesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SQLServerInstancesClient) UpdateResponder(resp *http.Response) (result SQLServerInstance, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/azurearcdata/mgmt/2021-11-01/azurearcdata/version.go b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/version.go new file mode 100644 index 000000000000..cddddcbf55ed --- /dev/null +++ b/services/azurearcdata/mgmt/2021-11-01/azurearcdata/version.go @@ -0,0 +1,19 @@ +package azurearcdata + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " azurearcdata/2021-11-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}