diff --git a/profiles/preview/preview/sql/mgmt/sql/models.go b/profiles/preview/preview/sql/mgmt/sql/models.go index 6cf9cb68b154..883d52532db5 100644 --- a/profiles/preview/preview/sql/mgmt/sql/models.go +++ b/profiles/preview/preview/sql/mgmt/sql/models.go @@ -35,6 +35,7 @@ type DatabaseVulnerabilityAssessmentScansClient = original.DatabaseVulnerability type ElasticPoolOperationsClient = original.ElasticPoolOperationsClient type ElasticPoolsClient = original.ElasticPoolsClient type InstanceFailoverGroupsClient = original.InstanceFailoverGroupsClient +type InterfaceEndpointProfilesClient = original.InterfaceEndpointProfilesClient type ManagedInstanceEncryptionProtectorsClient = original.ManagedInstanceEncryptionProtectorsClient type ManagedInstanceKeysClient = original.ManagedInstanceKeysClient type ManagedInstanceTdeCertificatesClient = original.ManagedInstanceTdeCertificatesClient @@ -136,6 +137,17 @@ const ( Secondary InstanceFailoverGroupReplicationRole = original.Secondary ) +type InterfaceEndpointProfileStateType = original.InterfaceEndpointProfileStateType + +const ( + Deleting InterfaceEndpointProfileStateType = original.Deleting + Failed InterfaceEndpointProfileStateType = original.Failed + Initializing InterfaceEndpointProfileStateType = original.Initializing + InProgress InterfaceEndpointProfileStateType = original.InProgress + Ready InterfaceEndpointProfileStateType = original.Ready + Unknown InterfaceEndpointProfileStateType = original.Unknown +) + type LogSizeUnit = original.LogSizeUnit const ( @@ -149,12 +161,12 @@ const ( type ManagementOperationState = original.ManagementOperationState const ( - CancelInProgress ManagementOperationState = original.CancelInProgress - Cancelled ManagementOperationState = original.Cancelled - Failed ManagementOperationState = original.Failed - InProgress ManagementOperationState = original.InProgress - Pending ManagementOperationState = original.Pending - Succeeded ManagementOperationState = original.Succeeded + ManagementOperationStateCancelInProgress ManagementOperationState = original.ManagementOperationStateCancelInProgress + ManagementOperationStateCancelled ManagementOperationState = original.ManagementOperationStateCancelled + ManagementOperationStateFailed ManagementOperationState = original.ManagementOperationStateFailed + ManagementOperationStateInProgress ManagementOperationState = original.ManagementOperationStateInProgress + ManagementOperationStatePending ManagementOperationState = original.ManagementOperationStatePending + ManagementOperationStateSucceeded ManagementOperationState = original.ManagementOperationStateSucceeded ) type MaxSizeUnit = original.MaxSizeUnit @@ -277,6 +289,13 @@ type InstanceFailoverGroupsCreateOrUpdateFuture = original.InstanceFailoverGroup type InstanceFailoverGroupsDeleteFuture = original.InstanceFailoverGroupsDeleteFuture type InstanceFailoverGroupsFailoverFuture = original.InstanceFailoverGroupsFailoverFuture type InstanceFailoverGroupsForceFailoverAllowDataLossFuture = original.InstanceFailoverGroupsForceFailoverAllowDataLossFuture +type InterfaceEndpointProfile = original.InterfaceEndpointProfile +type InterfaceEndpointProfileProperties = original.InterfaceEndpointProfileProperties +type InterfaceEndpointProfilesCreateOrUpdateFuture = original.InterfaceEndpointProfilesCreateOrUpdateFuture +type InterfaceEndpointProfilesDeleteFuture = original.InterfaceEndpointProfilesDeleteFuture +type InterfaceEndpointProfilesListResult = original.InterfaceEndpointProfilesListResult +type InterfaceEndpointProfilesListResultIterator = original.InterfaceEndpointProfilesListResultIterator +type InterfaceEndpointProfilesListResultPage = original.InterfaceEndpointProfilesListResultPage type LicenseTypeCapability = original.LicenseTypeCapability type LocationCapabilities = original.LocationCapabilities type LogSizeCapability = original.LogSizeCapability @@ -376,6 +395,12 @@ func NewInstanceFailoverGroupsClient(subscriptionID string) InstanceFailoverGrou func NewInstanceFailoverGroupsClientWithBaseURI(baseURI string, subscriptionID string) InstanceFailoverGroupsClient { return original.NewInstanceFailoverGroupsClientWithBaseURI(baseURI, subscriptionID) } +func NewInterfaceEndpointProfilesClient(subscriptionID string) InterfaceEndpointProfilesClient { + return original.NewInterfaceEndpointProfilesClient(subscriptionID) +} +func NewInterfaceEndpointProfilesClientWithBaseURI(baseURI string, subscriptionID string) InterfaceEndpointProfilesClient { + return original.NewInterfaceEndpointProfilesClientWithBaseURI(baseURI, subscriptionID) +} func NewManagedInstanceEncryptionProtectorsClient(subscriptionID string) ManagedInstanceEncryptionProtectorsClient { return original.NewManagedInstanceEncryptionProtectorsClient(subscriptionID) } @@ -424,6 +449,9 @@ func PossibleElasticPoolStateValues() []ElasticPoolState { func PossibleInstanceFailoverGroupReplicationRoleValues() []InstanceFailoverGroupReplicationRole { return original.PossibleInstanceFailoverGroupReplicationRoleValues() } +func PossibleInterfaceEndpointProfileStateTypeValues() []InterfaceEndpointProfileStateType { + return original.PossibleInterfaceEndpointProfileStateTypeValues() +} func PossibleLogSizeUnitValues() []LogSizeUnit { return original.PossibleLogSizeUnitValues() } diff --git a/services/preview/sql/mgmt/2017-03-01-preview/sql/models.go b/services/preview/sql/mgmt/2017-03-01-preview/sql/models.go index eee534e25fc8..743c5ffb3a7f 100644 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/models.go +++ b/services/preview/sql/mgmt/2017-03-01-preview/sql/models.go @@ -944,21 +944,6 @@ func PossibleSecurityAlertPolicyUseServerDefaultValues() []SecurityAlertPolicyUs return []SecurityAlertPolicyUseServerDefault{SecurityAlertPolicyUseServerDefaultDisabled, SecurityAlertPolicyUseServerDefaultEnabled} } -// SensitivityLabelSource enumerates the values for sensitivity label source. -type SensitivityLabelSource string - -const ( - // Current ... - Current SensitivityLabelSource = "current" - // Recommended ... - Recommended SensitivityLabelSource = "recommended" -) - -// PossibleSensitivityLabelSourceValues returns an array of possible values for the SensitivityLabelSource const type. -func PossibleSensitivityLabelSourceValues() []SensitivityLabelSource { - return []SensitivityLabelSource{Current, Recommended} -} - // ServerConnectionType enumerates the values for server connection type. type ServerConnectionType string @@ -8966,198 +8951,6 @@ type SecurityAlertPolicyProperties struct { RetentionDays *int32 `json:"retentionDays,omitempty"` } -// SensitivityLabel a sensitivity label. -type SensitivityLabel struct { - autorest.Response `json:"-"` - // SensitivityLabelProperties - Resource properties. - *SensitivityLabelProperties `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - Resource name. - Name *string `json:"name,omitempty"` - // Type - Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SensitivityLabel. -func (sl SensitivityLabel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sl.SensitivityLabelProperties != nil { - objectMap["properties"] = sl.SensitivityLabelProperties - } - if sl.ID != nil { - objectMap["id"] = sl.ID - } - if sl.Name != nil { - objectMap["name"] = sl.Name - } - if sl.Type != nil { - objectMap["type"] = sl.Type - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SensitivityLabel struct. -func (sl *SensitivityLabel) 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 { - case "properties": - if v != nil { - var sensitivityLabelProperties SensitivityLabelProperties - err = json.Unmarshal(*v, &sensitivityLabelProperties) - if err != nil { - return err - } - sl.SensitivityLabelProperties = &sensitivityLabelProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sl.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sl.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sl.Type = &typeVar - } - } - } - - return nil -} - -// SensitivityLabelListResult a list of sensitivity labels. -type SensitivityLabelListResult struct { - autorest.Response `json:"-"` - // Value - Array of results. - Value *[]SensitivityLabel `json:"value,omitempty"` - // NextLink - Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// SensitivityLabelListResultIterator provides access to a complete listing of SensitivityLabel values. -type SensitivityLabelListResultIterator struct { - i int - page SensitivityLabelListResultPage -} - -// Next 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 *SensitivityLabelListResultIterator) Next() error { - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SensitivityLabelListResultIterator) 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 SensitivityLabelListResultIterator) Response() SensitivityLabelListResult { - 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 SensitivityLabelListResultIterator) Value() SensitivityLabel { - if !iter.page.NotDone() { - return SensitivityLabel{} - } - return iter.page.Values()[iter.i] -} - -// IsEmpty returns true if the ListResult contains no values. -func (sllr SensitivityLabelListResult) IsEmpty() bool { - return sllr.Value == nil || len(*sllr.Value) == 0 -} - -// sensitivityLabelListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sllr SensitivityLabelListResult) sensitivityLabelListResultPreparer() (*http.Request, error) { - if sllr.NextLink == nil || len(to.String(sllr.NextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sllr.NextLink))) -} - -// SensitivityLabelListResultPage contains a page of SensitivityLabel values. -type SensitivityLabelListResultPage struct { - fn func(SensitivityLabelListResult) (SensitivityLabelListResult, error) - sllr SensitivityLabelListResult -} - -// 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. -func (page *SensitivityLabelListResultPage) Next() error { - next, err := page.fn(page.sllr) - if err != nil { - return err - } - page.sllr = next - return nil -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SensitivityLabelListResultPage) NotDone() bool { - return !page.sllr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SensitivityLabelListResultPage) Response() SensitivityLabelListResult { - return page.sllr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SensitivityLabelListResultPage) Values() []SensitivityLabel { - if page.sllr.IsEmpty() { - return nil - } - return *page.sllr.Value -} - -// SensitivityLabelProperties properties of a sensitivity label. -type SensitivityLabelProperties struct { - // LabelName - The label name. - LabelName *string `json:"labelName,omitempty"` - // InformationType - The information type. - InformationType *string `json:"informationType,omitempty"` -} - // Server an Azure SQL Database server. type Server struct { autorest.Response `json:"-"` diff --git a/services/preview/sql/mgmt/2017-03-01-preview/sql/sensitivitylabels.go b/services/preview/sql/mgmt/2017-03-01-preview/sql/sensitivitylabels.go deleted file mode 100644 index 70115a06a3b4..000000000000 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/sensitivitylabels.go +++ /dev/null @@ -1,483 +0,0 @@ -package sql - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// 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" - "net/http" -) - -// SensitivityLabelsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type SensitivityLabelsClient struct { - BaseClient -} - -// NewSensitivityLabelsClient creates an instance of the SensitivityLabelsClient client. -func NewSensitivityLabelsClient(subscriptionID string) SensitivityLabelsClient { - return NewSensitivityLabelsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSensitivityLabelsClientWithBaseURI creates an instance of the SensitivityLabelsClient client. -func NewSensitivityLabelsClientWithBaseURI(baseURI string, subscriptionID string) SensitivityLabelsClient { - return SensitivityLabelsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the sensitivity label of a given column -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -// parameters - the column sensitivity label resource. -func (client SensitivityLabelsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, parameters SensitivityLabel) (result SensitivityLabel, err error) { - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SensitivityLabelsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, parameters SensitivityLabel) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "current"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2017-03-01-preview" - 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.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SensitivityLabelsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SensitivityLabelsClient) CreateOrUpdateResponder(resp *http.Response) (result SensitivityLabel, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the sensitivity label of a given column -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -func (client SensitivityLabelsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SensitivityLabelsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "current"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", 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 SensitivityLabelsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SensitivityLabelsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the sensitivity label of a given column -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -// sensitivityLabelSource - the source of the sensitivity label. -func (client SensitivityLabelsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, sensitivityLabelSource SensitivityLabelSource) (result SensitivityLabel, err error) { - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client SensitivityLabelsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, sensitivityLabelSource SensitivityLabelSource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", sensitivityLabelSource), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", 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 SensitivityLabelsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SensitivityLabelsClient) GetResponder(resp *http.Response) (result SensitivityLabel, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase gets the sensitivity labels of a given database -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// filter - an OData filter expression that filters elements in the collection. -func (client SensitivityLabelsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result SensitivityLabelListResultPage, err error) { - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.sllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.sllr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "ListByDatabase", resp, "Failure responding to request") - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client SensitivityLabelsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sensitivityLabels", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SensitivityLabelsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client SensitivityLabelsClient) ListByDatabaseResponder(resp *http.Response) (result SensitivityLabelListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client SensitivityLabelsClient) listByDatabaseNextResults(lastResults SensitivityLabelListResult) (result SensitivityLabelListResult, err error) { - req, err := lastResults.sensitivityLabelListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client SensitivityLabelsClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result SensitivityLabelListResultIterator, err error) { - result.page, err = client.ListByDatabase(ctx, resourceGroupName, serverName, databaseName, filter) - return -} - -// ListByDatabaseWithSource gets the sensitivity labels of a given database -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// sensitivityLabelSource - optional source of the sensitivity label. Valid values are current or recommeneded. -// In not specified both returned. -// filter - an OData filter expression that filters elements in the collection. -func (client SensitivityLabelsClient) ListByDatabaseWithSource(ctx context.Context, resourceGroupName string, serverName string, databaseName string, sensitivityLabelSource SensitivityLabelSource, filter string) (result SensitivityLabelListResultPage, err error) { - result.fn = client.listByDatabaseWithSourceNextResults - req, err := client.ListByDatabaseWithSourcePreparer(ctx, resourceGroupName, serverName, databaseName, sensitivityLabelSource, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "ListByDatabaseWithSource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseWithSourceSender(req) - if err != nil { - result.sllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "ListByDatabaseWithSource", resp, "Failure sending request") - return - } - - result.sllr, err = client.ListByDatabaseWithSourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "ListByDatabaseWithSource", resp, "Failure responding to request") - } - - return -} - -// ListByDatabaseWithSourcePreparer prepares the ListByDatabaseWithSource request. -func (client SensitivityLabelsClient) ListByDatabaseWithSourcePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, sensitivityLabelSource SensitivityLabelSource, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sensitivityLabelSource": autorest.Encode("path", sensitivityLabelSource), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sensitivityLabels/{sensitivityLabelSource}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseWithSourceSender sends the ListByDatabaseWithSource request. The method will close the -// http.Response Body if it receives an error. -func (client SensitivityLabelsClient) ListByDatabaseWithSourceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseWithSourceResponder handles the response to the ListByDatabaseWithSource request. The method always -// closes the http.Response Body. -func (client SensitivityLabelsClient) ListByDatabaseWithSourceResponder(resp *http.Response) (result SensitivityLabelListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseWithSourceNextResults retrieves the next set of results, if any. -func (client SensitivityLabelsClient) listByDatabaseWithSourceNextResults(lastResults SensitivityLabelListResult) (result SensitivityLabelListResult, err error) { - req, err := lastResults.sensitivityLabelListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "listByDatabaseWithSourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseWithSourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "listByDatabaseWithSourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseWithSourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "listByDatabaseWithSourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseWithSourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client SensitivityLabelsClient) ListByDatabaseWithSourceComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, sensitivityLabelSource SensitivityLabelSource, filter string) (result SensitivityLabelListResultIterator, err error) { - result.page, err = client.ListByDatabaseWithSource(ctx, resourceGroupName, serverName, databaseName, sensitivityLabelSource, filter) - return -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/interfaceendpointprofiles.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/interfaceendpointprofiles.go new file mode 100644 index 000000000000..727b88a82c12 --- /dev/null +++ b/services/preview/sql/mgmt/2017-10-01-preview/sql/interfaceendpointprofiles.go @@ -0,0 +1,363 @@ +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "net/http" +) + +// InterfaceEndpointProfilesClient is the the Azure SQL Database management API provides a RESTful set of web services +// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, +// update, and delete databases. +type InterfaceEndpointProfilesClient struct { + BaseClient +} + +// NewInterfaceEndpointProfilesClient creates an instance of the InterfaceEndpointProfilesClient client. +func NewInterfaceEndpointProfilesClient(subscriptionID string) InterfaceEndpointProfilesClient { + return NewInterfaceEndpointProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewInterfaceEndpointProfilesClientWithBaseURI creates an instance of the InterfaceEndpointProfilesClient client. +func NewInterfaceEndpointProfilesClientWithBaseURI(baseURI string, subscriptionID string) InterfaceEndpointProfilesClient { + return InterfaceEndpointProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a interface endpoint profile. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client InterfaceEndpointProfilesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, interfaceEndpointProfileName string, parameters InterfaceEndpointProfile) (result InterfaceEndpointProfilesCreateOrUpdateFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.InterfaceEndpointProfileProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.InterfaceEndpointProfileProperties.VirtualNetworkSubnetID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("sql.InterfaceEndpointProfilesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, interfaceEndpointProfileName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InterfaceEndpointProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InterfaceEndpointProfilesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client InterfaceEndpointProfilesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, interfaceEndpointProfileName string, parameters InterfaceEndpointProfile) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "interfaceEndpointProfileName": autorest.Encode("path", interfaceEndpointProfileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-10-01-preview" + 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.Sql/servers/{serverName}/interfaceEndpointProfiles/{interfaceEndpointProfileName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client InterfaceEndpointProfilesClient) CreateOrUpdateSender(req *http.Request) (future InterfaceEndpointProfilesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client InterfaceEndpointProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result InterfaceEndpointProfile, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the interface endpoint profile with the given name. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client InterfaceEndpointProfilesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, interfaceEndpointProfileName string) (result InterfaceEndpointProfilesDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, interfaceEndpointProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InterfaceEndpointProfilesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InterfaceEndpointProfilesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client InterfaceEndpointProfilesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, interfaceEndpointProfileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "interfaceEndpointProfileName": autorest.Encode("path", interfaceEndpointProfileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/interfaceEndpointProfiles/{interfaceEndpointProfileName}", 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 InterfaceEndpointProfilesClient) DeleteSender(req *http.Request) (future InterfaceEndpointProfilesDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client InterfaceEndpointProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a interface endpoint profile. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// interfaceEndpointProfileName - the name of the interface endpoint profile. +func (client InterfaceEndpointProfilesClient) Get(ctx context.Context, resourceGroupName string, serverName string, interfaceEndpointProfileName string) (result InterfaceEndpointProfile, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, interfaceEndpointProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InterfaceEndpointProfilesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.InterfaceEndpointProfilesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InterfaceEndpointProfilesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client InterfaceEndpointProfilesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, interfaceEndpointProfileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "interfaceEndpointProfileName": autorest.Encode("path", interfaceEndpointProfileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/interfaceEndpointProfiles/{interfaceEndpointProfileName}", 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 InterfaceEndpointProfilesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client InterfaceEndpointProfilesClient) GetResponder(resp *http.Response) (result InterfaceEndpointProfile, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer gets a list of interface endpoint profiles attached to a server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client InterfaceEndpointProfilesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result InterfaceEndpointProfilesListResultPage, err error) { + result.fn = client.listByServerNextResults + req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InterfaceEndpointProfilesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.ieplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.InterfaceEndpointProfilesClient", "ListByServer", resp, "Failure sending request") + return + } + + result.ieplr, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InterfaceEndpointProfilesClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client InterfaceEndpointProfilesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/interfaceEndpointProfiles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client InterfaceEndpointProfilesClient) ListByServerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client InterfaceEndpointProfilesClient) ListByServerResponder(resp *http.Response) (result InterfaceEndpointProfilesListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByServerNextResults retrieves the next set of results, if any. +func (client InterfaceEndpointProfilesClient) listByServerNextResults(lastResults InterfaceEndpointProfilesListResult) (result InterfaceEndpointProfilesListResult, err error) { + req, err := lastResults.interfaceEndpointProfilesListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.InterfaceEndpointProfilesClient", "listByServerNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.InterfaceEndpointProfilesClient", "listByServerNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InterfaceEndpointProfilesClient", "listByServerNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. +func (client InterfaceEndpointProfilesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result InterfaceEndpointProfilesListResultIterator, err error) { + result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) + return +} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/models.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/models.go index b9d700d8359a..85c617c99ebf 100644 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/models.go +++ b/services/preview/sql/mgmt/2017-10-01-preview/sql/models.go @@ -233,6 +233,29 @@ func PossibleInstanceFailoverGroupReplicationRoleValues() []InstanceFailoverGrou return []InstanceFailoverGroupReplicationRole{Primary, Secondary} } +// InterfaceEndpointProfileStateType enumerates the values for interface endpoint profile state type. +type InterfaceEndpointProfileStateType string + +const ( + // Deleting ... + Deleting InterfaceEndpointProfileStateType = "Deleting" + // Failed ... + Failed InterfaceEndpointProfileStateType = "Failed" + // Initializing ... + Initializing InterfaceEndpointProfileStateType = "Initializing" + // InProgress ... + InProgress InterfaceEndpointProfileStateType = "InProgress" + // Ready ... + Ready InterfaceEndpointProfileStateType = "Ready" + // Unknown ... + Unknown InterfaceEndpointProfileStateType = "Unknown" +) + +// PossibleInterfaceEndpointProfileStateTypeValues returns an array of possible values for the InterfaceEndpointProfileStateType const type. +func PossibleInterfaceEndpointProfileStateTypeValues() []InterfaceEndpointProfileStateType { + return []InterfaceEndpointProfileStateType{Deleting, Failed, Initializing, InProgress, Ready, Unknown} +} + // LogSizeUnit enumerates the values for log size unit. type LogSizeUnit string @@ -258,23 +281,23 @@ func PossibleLogSizeUnitValues() []LogSizeUnit { type ManagementOperationState string const ( - // CancelInProgress ... - CancelInProgress ManagementOperationState = "CancelInProgress" - // Cancelled ... - Cancelled ManagementOperationState = "Cancelled" - // Failed ... - Failed ManagementOperationState = "Failed" - // InProgress ... - InProgress ManagementOperationState = "InProgress" - // Pending ... - Pending ManagementOperationState = "Pending" - // Succeeded ... - Succeeded ManagementOperationState = "Succeeded" + // ManagementOperationStateCancelInProgress ... + ManagementOperationStateCancelInProgress ManagementOperationState = "CancelInProgress" + // ManagementOperationStateCancelled ... + ManagementOperationStateCancelled ManagementOperationState = "Cancelled" + // ManagementOperationStateFailed ... + ManagementOperationStateFailed ManagementOperationState = "Failed" + // ManagementOperationStateInProgress ... + ManagementOperationStateInProgress ManagementOperationState = "InProgress" + // ManagementOperationStatePending ... + ManagementOperationStatePending ManagementOperationState = "Pending" + // ManagementOperationStateSucceeded ... + ManagementOperationStateSucceeded ManagementOperationState = "Succeeded" ) // PossibleManagementOperationStateValues returns an array of possible values for the ManagementOperationState const type. func PossibleManagementOperationStateValues() []ManagementOperationState { - return []ManagementOperationState{CancelInProgress, Cancelled, Failed, InProgress, Pending, Succeeded} + return []ManagementOperationState{ManagementOperationStateCancelInProgress, ManagementOperationStateCancelled, ManagementOperationStateFailed, ManagementOperationStateInProgress, ManagementOperationStatePending, ManagementOperationStateSucceeded} } // MaxSizeUnit enumerates the values for max size unit. @@ -1107,7 +1130,7 @@ type DatabaseOperationProperties struct { ServerName *string `json:"serverName,omitempty"` // StartTime - The operation start time. StartTime *date.Time `json:"startTime,omitempty"` - // State - The operation state. Possible values include: 'Pending', 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', 'Cancelled' + // State - The operation state. Possible values include: 'ManagementOperationStatePending', 'ManagementOperationStateInProgress', 'ManagementOperationStateSucceeded', 'ManagementOperationStateFailed', 'ManagementOperationStateCancelInProgress', 'ManagementOperationStateCancelled' State ManagementOperationState `json:"state,omitempty"` // ErrorCode - The operation error code. ErrorCode *int32 `json:"errorCode,omitempty"` @@ -2570,6 +2593,253 @@ func (future *InstanceFailoverGroupsForceFailoverAllowDataLossFuture) Result(cli return } +// InterfaceEndpointProfile a interface endpoint profile resource. +type InterfaceEndpointProfile struct { + autorest.Response `json:"-"` + // InterfaceEndpointProfileProperties - Resource properties. + *InterfaceEndpointProfileProperties `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceEndpointProfile. +func (iep InterfaceEndpointProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if iep.InterfaceEndpointProfileProperties != nil { + objectMap["properties"] = iep.InterfaceEndpointProfileProperties + } + if iep.ID != nil { + objectMap["id"] = iep.ID + } + if iep.Name != nil { + objectMap["name"] = iep.Name + } + if iep.Type != nil { + objectMap["type"] = iep.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for InterfaceEndpointProfile struct. +func (iep *InterfaceEndpointProfile) 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 { + case "properties": + if v != nil { + var interfaceEndpointProfileProperties InterfaceEndpointProfileProperties + err = json.Unmarshal(*v, &interfaceEndpointProfileProperties) + if err != nil { + return err + } + iep.InterfaceEndpointProfileProperties = &interfaceEndpointProfileProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + iep.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + iep.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + iep.Type = &typeVar + } + } + } + + return nil +} + +// InterfaceEndpointProfileProperties the properties of a interface endpoint profile. +type InterfaceEndpointProfileProperties struct { + // VirtualNetworkSubnetID - The ARM resource id of the virtual network subnet. + VirtualNetworkSubnetID *string `json:"virtualNetworkSubnetId,omitempty"` + // PrivateIP - The Private ip associated with the interface endpoint profile + PrivateIP *string `json:"privateIp,omitempty"` + // State - State of the interface endpoint profile. Possible values include: 'Initializing', 'InProgress', 'Ready', 'Failed', 'Deleting', 'Unknown' + State InterfaceEndpointProfileStateType `json:"state,omitempty"` +} + +// InterfaceEndpointProfilesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type InterfaceEndpointProfilesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *InterfaceEndpointProfilesCreateOrUpdateFuture) Result(client InterfaceEndpointProfilesClient) (iep InterfaceEndpointProfile, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InterfaceEndpointProfilesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.InterfaceEndpointProfilesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if iep.Response.Response, err = future.GetResult(sender); err == nil && iep.Response.Response.StatusCode != http.StatusNoContent { + iep, err = client.CreateOrUpdateResponder(iep.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InterfaceEndpointProfilesCreateOrUpdateFuture", "Result", iep.Response.Response, "Failure responding to request") + } + } + return +} + +// InterfaceEndpointProfilesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type InterfaceEndpointProfilesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *InterfaceEndpointProfilesDeleteFuture) Result(client InterfaceEndpointProfilesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InterfaceEndpointProfilesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("sql.InterfaceEndpointProfilesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// InterfaceEndpointProfilesListResult a list of interface endpoint profiles. +type InterfaceEndpointProfilesListResult struct { + autorest.Response `json:"-"` + // Value - Array of results. + Value *[]InterfaceEndpointProfile `json:"value,omitempty"` + // NextLink - Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// InterfaceEndpointProfilesListResultIterator provides access to a complete listing of InterfaceEndpointProfile +// values. +type InterfaceEndpointProfilesListResultIterator struct { + i int + page InterfaceEndpointProfilesListResultPage +} + +// Next 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 *InterfaceEndpointProfilesListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter InterfaceEndpointProfilesListResultIterator) 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 InterfaceEndpointProfilesListResultIterator) Response() InterfaceEndpointProfilesListResult { + 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 InterfaceEndpointProfilesListResultIterator) Value() InterfaceEndpointProfile { + if !iter.page.NotDone() { + return InterfaceEndpointProfile{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (ieplr InterfaceEndpointProfilesListResult) IsEmpty() bool { + return ieplr.Value == nil || len(*ieplr.Value) == 0 +} + +// interfaceEndpointProfilesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ieplr InterfaceEndpointProfilesListResult) interfaceEndpointProfilesListResultPreparer() (*http.Request, error) { + if ieplr.NextLink == nil || len(to.String(ieplr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ieplr.NextLink))) +} + +// InterfaceEndpointProfilesListResultPage contains a page of InterfaceEndpointProfile values. +type InterfaceEndpointProfilesListResultPage struct { + fn func(InterfaceEndpointProfilesListResult) (InterfaceEndpointProfilesListResult, error) + ieplr InterfaceEndpointProfilesListResult +} + +// 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. +func (page *InterfaceEndpointProfilesListResultPage) Next() error { + next, err := page.fn(page.ieplr) + if err != nil { + return err + } + page.ieplr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page InterfaceEndpointProfilesListResultPage) NotDone() bool { + return !page.ieplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page InterfaceEndpointProfilesListResultPage) Response() InterfaceEndpointProfilesListResult { + return page.ieplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page InterfaceEndpointProfilesListResultPage) Values() []InterfaceEndpointProfile { + if page.ieplr.IsEmpty() { + return nil + } + return *page.ieplr.Value +} + // LicenseTypeCapability the license type capability type LicenseTypeCapability struct { // Name - License type identifier.