diff --git a/profiles/preview/preview/sql/mgmt/sql/models.go b/profiles/preview/preview/sql/mgmt/sql/models.go index 9e00d45b72ee..91394b1779dc 100644 --- a/profiles/preview/preview/sql/mgmt/sql/models.go +++ b/profiles/preview/preview/sql/mgmt/sql/models.go @@ -21,6 +21,7 @@ package sql import original "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2017-10-01-preview/sql" +type BackupShortTermRetentionPoliciesClient = original.BackupShortTermRetentionPoliciesClient type CapabilitiesClient = original.CapabilitiesClient const ( @@ -207,6 +208,10 @@ const ( Recurring VulnerabilityAssessmentScanTriggerType = original.Recurring ) +type BackupShortTermRetentionPoliciesCreateOrUpdateFuture = original.BackupShortTermRetentionPoliciesCreateOrUpdateFuture +type BackupShortTermRetentionPoliciesUpdateFuture = original.BackupShortTermRetentionPoliciesUpdateFuture +type BackupShortTermRetentionPolicy = original.BackupShortTermRetentionPolicy +type BackupShortTermRetentionPolicyProperties = original.BackupShortTermRetentionPolicyProperties type Database = original.Database type DatabaseListResult = original.DatabaseListResult type DatabaseListResultIterator = original.DatabaseListResultIterator @@ -227,8 +232,8 @@ type DatabaseUpdate = original.DatabaseUpdate type DatabaseVulnerabilityAssessment = original.DatabaseVulnerabilityAssessment type DatabaseVulnerabilityAssessmentProperties = original.DatabaseVulnerabilityAssessmentProperties type DatabaseVulnerabilityAssessmentScanExportProperties = original.DatabaseVulnerabilityAssessmentScanExportProperties -type DatabaseVulnerabilityAssessmentScansExecuteFuture = original.DatabaseVulnerabilityAssessmentScansExecuteFuture type DatabaseVulnerabilityAssessmentScansExport = original.DatabaseVulnerabilityAssessmentScansExport +type DatabaseVulnerabilityAssessmentScansInitiateScanFuture = original.DatabaseVulnerabilityAssessmentScansInitiateScanFuture type EditionCapability = original.EditionCapability type ElasticPool = original.ElasticPool type ElasticPoolEditionCapability = original.ElasticPoolEditionCapability @@ -278,10 +283,6 @@ type Resource = original.Resource type ResourceMoveDefinition = original.ResourceMoveDefinition type ServerVersionCapability = original.ServerVersionCapability type ServiceObjectiveCapability = original.ServiceObjectiveCapability -type ShortTermRetentionPoliciesCreateOrUpdateFuture = original.ShortTermRetentionPoliciesCreateOrUpdateFuture -type ShortTermRetentionPoliciesUpdateFuture = original.ShortTermRetentionPoliciesUpdateFuture -type ShortTermRetentionPolicy = original.ShortTermRetentionPolicy -type ShortTermRetentionPolicyProperties = original.ShortTermRetentionPolicyProperties type Sku = original.Sku type TrackedResource = original.TrackedResource type VulnerabilityAssessmentRecurringScansProperties = original.VulnerabilityAssessmentRecurringScansProperties @@ -291,8 +292,13 @@ type VulnerabilityAssessmentScanRecordListResult = original.VulnerabilityAssessm type VulnerabilityAssessmentScanRecordListResultIterator = original.VulnerabilityAssessmentScanRecordListResultIterator type VulnerabilityAssessmentScanRecordListResultPage = original.VulnerabilityAssessmentScanRecordListResultPage type VulnerabilityAssessmentScanRecordProperties = original.VulnerabilityAssessmentScanRecordProperties -type ShortTermRetentionPoliciesClient = original.ShortTermRetentionPoliciesClient +func NewBackupShortTermRetentionPoliciesClient(subscriptionID string) BackupShortTermRetentionPoliciesClient { + return original.NewBackupShortTermRetentionPoliciesClient(subscriptionID) +} +func NewBackupShortTermRetentionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupShortTermRetentionPoliciesClient { + return original.NewBackupShortTermRetentionPoliciesClientWithBaseURI(baseURI, subscriptionID) +} func NewCapabilitiesClient(subscriptionID string) CapabilitiesClient { return original.NewCapabilitiesClient(subscriptionID) } @@ -398,12 +404,6 @@ func PossibleVulnerabilityAssessmentScanStateValues() []VulnerabilityAssessmentS func PossibleVulnerabilityAssessmentScanTriggerTypeValues() []VulnerabilityAssessmentScanTriggerType { return original.PossibleVulnerabilityAssessmentScanTriggerTypeValues() } -func NewShortTermRetentionPoliciesClient(subscriptionID string) ShortTermRetentionPoliciesClient { - return original.NewShortTermRetentionPoliciesClient(subscriptionID) -} -func NewShortTermRetentionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ShortTermRetentionPoliciesClient { - return original.NewShortTermRetentionPoliciesClientWithBaseURI(baseURI, subscriptionID) -} func UserAgent() string { return original.UserAgent() + " profiles/preview" } diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go index 8e20a0065a76..382153a0615e 100644 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go +++ b/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go @@ -1378,10 +1378,10 @@ type Database struct { Kind *string `json:"kind,omitempty"` // DatabaseProperties - The properties representing the resource. *DatabaseProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -1399,12 +1399,12 @@ func (d Database) MarshalJSON() ([]byte, error) { if d.DatabaseProperties != nil { objectMap["properties"] = d.DatabaseProperties } - if d.Tags != nil { - objectMap["tags"] = d.Tags - } if d.Location != nil { objectMap["location"] = d.Location } + if d.Tags != nil { + objectMap["tags"] = d.Tags + } if d.ID != nil { objectMap["id"] = d.ID } @@ -1444,23 +1444,23 @@ func (d *Database) UnmarshalJSON(body []byte) error { } d.DatabaseProperties = &databaseProperties } - case "tags": + case "location": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - d.Tags = tags + d.Location = &location } - case "location": + case "tags": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - d.Location = &location + d.Tags = tags } case "id": if v != nil { @@ -2554,10 +2554,10 @@ type ElasticPool struct { *ElasticPoolProperties `json:"properties,omitempty"` // Kind - Kind of elastic pool. This is metadata used for the Azure portal experience. Kind *string `json:"kind,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -2575,12 +2575,12 @@ func (ep ElasticPool) MarshalJSON() ([]byte, error) { if ep.Kind != nil { objectMap["kind"] = ep.Kind } - if ep.Tags != nil { - objectMap["tags"] = ep.Tags - } if ep.Location != nil { objectMap["location"] = ep.Location } + if ep.Tags != nil { + objectMap["tags"] = ep.Tags + } if ep.ID != nil { objectMap["id"] = ep.ID } @@ -2620,23 +2620,23 @@ func (ep *ElasticPool) UnmarshalJSON(body []byte) error { } ep.Kind = &kind } - case "tags": + case "location": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - ep.Tags = tags + ep.Location = &location } - case "location": + case "tags": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - ep.Location = &location + ep.Tags = tags } case "id": if v != nil { @@ -4550,10 +4550,10 @@ type ManagedInstance struct { Sku *Sku `json:"sku,omitempty"` // ManagedInstanceProperties - Resource properties. *ManagedInstanceProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -4574,12 +4574,12 @@ func (mi ManagedInstance) MarshalJSON() ([]byte, error) { if mi.ManagedInstanceProperties != nil { objectMap["properties"] = mi.ManagedInstanceProperties } - if mi.Tags != nil { - objectMap["tags"] = mi.Tags - } if mi.Location != nil { objectMap["location"] = mi.Location } + if mi.Tags != nil { + objectMap["tags"] = mi.Tags + } if mi.ID != nil { objectMap["id"] = mi.ID } @@ -4628,23 +4628,23 @@ func (mi *ManagedInstance) UnmarshalJSON(body []byte) error { } mi.ManagedInstanceProperties = &managedInstanceProperties } - case "tags": + case "location": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - mi.Tags = tags + mi.Location = &location } - case "location": + case "tags": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - mi.Location = &location + mi.Tags = tags } case "id": if v != nil { @@ -5972,10 +5972,10 @@ type Server struct { Kind *string `json:"kind,omitempty"` // ServerProperties - Resource properties. *ServerProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -5996,12 +5996,12 @@ func (s Server) MarshalJSON() ([]byte, error) { if s.ServerProperties != nil { objectMap["properties"] = s.ServerProperties } - if s.Tags != nil { - objectMap["tags"] = s.Tags - } if s.Location != nil { objectMap["location"] = s.Location } + if s.Tags != nil { + objectMap["tags"] = s.Tags + } if s.ID != nil { objectMap["id"] = s.ID } @@ -6050,23 +6050,23 @@ func (s *Server) UnmarshalJSON(body []byte) error { } s.ServerProperties = &serverProperties } - case "tags": + case "location": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - s.Tags = tags + s.Location = &location } - case "location": + case "tags": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - s.Location = &location + s.Tags = tags } case "id": if v != nil { @@ -7518,17 +7518,17 @@ type ServiceTierAdvisorProperties struct { Confidence *float64 `json:"confidence,omitempty"` } -// Sku an ARM Resource SKU. +// Sku the resource model definition representing SKU type Sku struct { - // Name - The name of the SKU, typically, a letter + Number code, e.g. P3. + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code Name *string `json:"name,omitempty"` - // Tier - The tier of the particular SKU, e.g. Basic, Premium. + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Tier *string `json:"tier,omitempty"` - // Size - Size of the particular SKU + // 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 - Capacity of the particular SKU. + // 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"` } @@ -9439,10 +9439,10 @@ func (future SyncMembersUpdateFuture) Result(client SyncMembersClient) (sm SyncM // TrackedResource ARM tracked top level resource. type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -9454,12 +9454,12 @@ type TrackedResource struct { // 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 } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } if tr.ID != nil { objectMap["id"] = tr.ID } diff --git a/services/preview/sql/mgmt/2017-03-01-preview/sql/databasevulnerabilityassessmentrulebaselines.go b/services/preview/sql/mgmt/2017-03-01-preview/sql/databasevulnerabilityassessmentrulebaselines.go index 9d97f35e2d24..c337dd1a9e4d 100644 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/databasevulnerabilityassessmentrulebaselines.go +++ b/services/preview/sql/mgmt/2017-03-01-preview/sql/databasevulnerabilityassessmentrulebaselines.go @@ -51,8 +51,10 @@ func NewDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(baseURI st // serverName - the name of the server. // databaseName - the name of the database for which the vulnerability assessment rule baseline is defined. // ruleID - the vulnerability assessment rule ID. +// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a +// database level rule and master for server level rule). // parameters - the requested rule baseline resource. -func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, parameters DatabaseVulnerabilityAssessmentRuleBaseline) (result DatabaseVulnerabilityAssessmentRuleBaseline, err error) { +func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters DatabaseVulnerabilityAssessmentRuleBaseline) (result DatabaseVulnerabilityAssessmentRuleBaseline, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.DatabaseVulnerabilityAssessmentRuleBaselineProperties", Name: validation.Null, Rule: false, @@ -60,7 +62,7 @@ func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdate( return result, validation.NewError("sql.DatabaseVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", err.Error()) } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, ruleID, parameters) + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, ruleID, baselineName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", nil, "Failure preparing request") return @@ -82,9 +84,9 @@ func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdate( } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, parameters DatabaseVulnerabilityAssessmentRuleBaseline) (*http.Request, error) { +func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters DatabaseVulnerabilityAssessmentRuleBaseline) (*http.Request, error) { pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", "default"), + "baselineName": autorest.Encode("path", baselineName), "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "ruleId": autorest.Encode("path", ruleID), @@ -135,8 +137,10 @@ func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdateR // serverName - the name of the server. // databaseName - the name of the database for which the vulnerability assessment rule baseline is defined. // ruleID - the vulnerability assessment rule ID. -func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, ruleID) +// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a +// database level rule and master for server level rule). +func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, ruleID, baselineName) if err != nil { err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentRuleBaselinesClient", "Delete", nil, "Failure preparing request") return @@ -158,9 +162,9 @@ func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) Delete(ctx cont } // DeletePreparer prepares the Delete request. -func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string) (*http.Request, error) { +func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (*http.Request, error) { pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", "default"), + "baselineName": autorest.Encode("path", baselineName), "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "ruleId": autorest.Encode("path", ruleID), @@ -208,8 +212,10 @@ func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) DeleteResponder // serverName - the name of the server. // databaseName - the name of the database for which the vulnerability assessment rule baseline is defined. // ruleID - the vulnerability assessment rule ID. -func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string) (result DatabaseVulnerabilityAssessmentRuleBaseline, err error) { - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName, ruleID) +// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a +// database level rule and master for server level rule). +func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (result DatabaseVulnerabilityAssessmentRuleBaseline, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName, ruleID, baselineName) if err != nil { err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentRuleBaselinesClient", "Get", nil, "Failure preparing request") return @@ -231,9 +237,9 @@ func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) Get(ctx context } // GetPreparer prepares the Get request. -func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string) (*http.Request, error) { +func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (*http.Request, error) { pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", "default"), + "baselineName": autorest.Encode("path", baselineName), "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "ruleId": autorest.Encode("path", ruleID), diff --git a/services/preview/sql/mgmt/2017-03-01-preview/sql/databasevulnerabilityassessments.go b/services/preview/sql/mgmt/2017-03-01-preview/sql/databasevulnerabilityassessments.go index 5d3eb02dc495..c28eb0a3b0d1 100644 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/databasevulnerabilityassessments.go +++ b/services/preview/sql/mgmt/2017-03-01-preview/sql/databasevulnerabilityassessments.go @@ -21,6 +21,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "net/http" ) @@ -50,6 +51,15 @@ func NewDatabaseVulnerabilityAssessmentsClientWithBaseURI(baseURI string, subscr // databaseName - the name of the database for which the vulnerability assessment is defined. // parameters - the requested resource. func (client DatabaseVulnerabilityAssessmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseVulnerabilityAssessment) (result DatabaseVulnerabilityAssessment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.DatabaseVulnerabilityAssessmentProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.DatabaseVulnerabilityAssessmentProperties.StorageContainerPath", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.DatabaseVulnerabilityAssessmentProperties.StorageContainerSasKey", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("sql.DatabaseVulnerabilityAssessmentsClient", "CreateOrUpdate", err.Error()) + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentsClient", "CreateOrUpdate", nil, "Failure preparing request") 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 f909a5299540..22a979315361 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 @@ -1381,6 +1381,22 @@ func PossibleVirtualNetworkRuleStateValues() []VirtualNetworkRuleState { return []VirtualNetworkRuleState{VirtualNetworkRuleStateDeleting, VirtualNetworkRuleStateInitializing, VirtualNetworkRuleStateInProgress, VirtualNetworkRuleStateReady, VirtualNetworkRuleStateUnknown} } +// VulnerabilityAssessmentPolicyBaselineName enumerates the values for vulnerability assessment policy baseline +// name. +type VulnerabilityAssessmentPolicyBaselineName string + +const ( + // VulnerabilityAssessmentPolicyBaselineNameDefault ... + VulnerabilityAssessmentPolicyBaselineNameDefault VulnerabilityAssessmentPolicyBaselineName = "default" + // VulnerabilityAssessmentPolicyBaselineNameMaster ... + VulnerabilityAssessmentPolicyBaselineNameMaster VulnerabilityAssessmentPolicyBaselineName = "master" +) + +// PossibleVulnerabilityAssessmentPolicyBaselineNameValues returns an array of possible values for the VulnerabilityAssessmentPolicyBaselineName const type. +func PossibleVulnerabilityAssessmentPolicyBaselineNameValues() []VulnerabilityAssessmentPolicyBaselineName { + return []VulnerabilityAssessmentPolicyBaselineName{VulnerabilityAssessmentPolicyBaselineNameDefault, VulnerabilityAssessmentPolicyBaselineNameMaster} +} + // AutomaticTuningOptions automatic tuning properties for individual advisors. type AutomaticTuningOptions struct { // DesiredState - Automatic tuning option desired state. Possible values include: 'AutomaticTuningOptionModeDesiredOff', 'AutomaticTuningOptionModeDesiredOn', 'AutomaticTuningOptionModeDesiredDefault' @@ -1790,10 +1806,10 @@ type Database struct { Kind *string `json:"kind,omitempty"` // DatabaseProperties - The properties representing the resource. *DatabaseProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -1811,12 +1827,12 @@ func (d Database) MarshalJSON() ([]byte, error) { if d.DatabaseProperties != nil { objectMap["properties"] = d.DatabaseProperties } - if d.Tags != nil { - objectMap["tags"] = d.Tags - } if d.Location != nil { objectMap["location"] = d.Location } + if d.Tags != nil { + objectMap["tags"] = d.Tags + } if d.ID != nil { objectMap["id"] = d.ID } @@ -1856,23 +1872,23 @@ func (d *Database) UnmarshalJSON(body []byte) error { } d.DatabaseProperties = &databaseProperties } - case "tags": + case "location": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - d.Tags = tags + d.Location = &location } - case "location": + case "tags": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - d.Location = &location + d.Tags = tags } case "id": if v != nil { @@ -3566,10 +3582,10 @@ type ElasticPool struct { *ElasticPoolProperties `json:"properties,omitempty"` // Kind - Kind of elastic pool. This is metadata used for the Azure portal experience. Kind *string `json:"kind,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -3587,12 +3603,12 @@ func (ep ElasticPool) MarshalJSON() ([]byte, error) { if ep.Kind != nil { objectMap["kind"] = ep.Kind } - if ep.Tags != nil { - objectMap["tags"] = ep.Tags - } if ep.Location != nil { objectMap["location"] = ep.Location } + if ep.Tags != nil { + objectMap["tags"] = ep.Tags + } if ep.ID != nil { objectMap["id"] = ep.ID } @@ -3632,23 +3648,23 @@ func (ep *ElasticPool) UnmarshalJSON(body []byte) error { } ep.Kind = &kind } - case "tags": + case "location": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - ep.Tags = tags + ep.Location = &location } - case "location": + case "tags": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - ep.Location = &location + ep.Tags = tags } case "id": if v != nil { @@ -5623,10 +5639,10 @@ type JobAgent struct { Sku *Sku `json:"sku,omitempty"` // JobAgentProperties - Resource properties. *JobAgentProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -5644,12 +5660,12 @@ func (ja JobAgent) MarshalJSON() ([]byte, error) { if ja.JobAgentProperties != nil { objectMap["properties"] = ja.JobAgentProperties } - if ja.Tags != nil { - objectMap["tags"] = ja.Tags - } if ja.Location != nil { objectMap["location"] = ja.Location } + if ja.Tags != nil { + objectMap["tags"] = ja.Tags + } if ja.ID != nil { objectMap["id"] = ja.ID } @@ -5689,23 +5705,23 @@ func (ja *JobAgent) UnmarshalJSON(body []byte) error { } ja.JobAgentProperties = &jobAgentProperties } - case "tags": + case "location": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - ja.Tags = tags + ja.Location = &location } - case "location": + case "tags": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - ja.Location = &location + ja.Tags = tags } case "id": if v != nil { @@ -7231,10 +7247,10 @@ type ManagedDatabase struct { autorest.Response `json:"-"` // ManagedDatabaseProperties - Resource properties. *ManagedDatabaseProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -7249,12 +7265,12 @@ func (md ManagedDatabase) MarshalJSON() ([]byte, error) { if md.ManagedDatabaseProperties != nil { objectMap["properties"] = md.ManagedDatabaseProperties } - if md.Tags != nil { - objectMap["tags"] = md.Tags - } if md.Location != nil { objectMap["location"] = md.Location } + if md.Tags != nil { + objectMap["tags"] = md.Tags + } if md.ID != nil { objectMap["id"] = md.ID } @@ -7285,23 +7301,23 @@ func (md *ManagedDatabase) UnmarshalJSON(body []byte) error { } md.ManagedDatabaseProperties = &managedDatabaseProperties } - case "tags": + case "location": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - md.Tags = tags + md.Location = &location } - case "location": + case "tags": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - md.Location = &location + md.Tags = tags } case "id": if v != nil { @@ -7724,10 +7740,10 @@ type ManagedInstance struct { Sku *Sku `json:"sku,omitempty"` // ManagedInstanceProperties - Resource properties. *ManagedInstanceProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -7748,12 +7764,12 @@ func (mi ManagedInstance) MarshalJSON() ([]byte, error) { if mi.ManagedInstanceProperties != nil { objectMap["properties"] = mi.ManagedInstanceProperties } - if mi.Tags != nil { - objectMap["tags"] = mi.Tags - } if mi.Location != nil { objectMap["location"] = mi.Location } + if mi.Tags != nil { + objectMap["tags"] = mi.Tags + } if mi.ID != nil { objectMap["id"] = mi.ID } @@ -7802,23 +7818,23 @@ func (mi *ManagedInstance) UnmarshalJSON(body []byte) error { } mi.ManagedInstanceProperties = &managedInstanceProperties } - case "tags": + case "location": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - mi.Tags = tags + mi.Location = &location } - case "location": + case "tags": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - mi.Location = &location + mi.Tags = tags } case "id": if v != nil { @@ -9217,10 +9233,10 @@ type Server struct { Kind *string `json:"kind,omitempty"` // ServerProperties - Resource properties. *ServerProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -9241,12 +9257,12 @@ func (s Server) MarshalJSON() ([]byte, error) { if s.ServerProperties != nil { objectMap["properties"] = s.ServerProperties } - if s.Tags != nil { - objectMap["tags"] = s.Tags - } if s.Location != nil { objectMap["location"] = s.Location } + if s.Tags != nil { + objectMap["tags"] = s.Tags + } if s.ID != nil { objectMap["id"] = s.ID } @@ -9295,23 +9311,23 @@ func (s *Server) UnmarshalJSON(body []byte) error { } s.ServerProperties = &serverProperties } - case "tags": + case "location": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - s.Tags = tags + s.Location = &location } - case "location": + case "tags": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - s.Location = &location + s.Tags = tags } case "id": if v != nil { @@ -11277,17 +11293,17 @@ type ServiceTierAdvisorProperties struct { Confidence *float64 `json:"confidence,omitempty"` } -// Sku an ARM Resource SKU. +// Sku the resource model definition representing SKU type Sku struct { - // Name - The name of the SKU, typically, a letter + Number code, e.g. P3. + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code Name *string `json:"name,omitempty"` - // Tier - The tier of the particular SKU, e.g. Basic, Premium. + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Tier *string `json:"tier,omitempty"` - // Size - Size of the particular SKU + // 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 - Capacity of the particular SKU. + // 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"` } @@ -13198,10 +13214,10 @@ func (future SyncMembersUpdateFuture) Result(client SyncMembersClient) (sm SyncM // TrackedResource ARM tracked top level resource. type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -13213,12 +13229,12 @@ type TrackedResource struct { // 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 } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } if tr.ID != nil { objectMap["id"] = tr.ID } diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/shorttermretentionpolicies.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/backupshorttermretentionpolicies.go similarity index 66% rename from services/preview/sql/mgmt/2017-10-01-preview/sql/shorttermretentionpolicies.go rename to services/preview/sql/mgmt/2017-10-01-preview/sql/backupshorttermretentionpolicies.go index 6aa1d5bb51df..a519580eb15b 100644 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/shorttermretentionpolicies.go +++ b/services/preview/sql/mgmt/2017-10-01-preview/sql/backupshorttermretentionpolicies.go @@ -24,21 +24,22 @@ import ( "net/http" ) -// ShortTermRetentionPoliciesClient 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 ShortTermRetentionPoliciesClient struct { +// BackupShortTermRetentionPoliciesClient 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 BackupShortTermRetentionPoliciesClient struct { BaseClient } -// NewShortTermRetentionPoliciesClient creates an instance of the ShortTermRetentionPoliciesClient client. -func NewShortTermRetentionPoliciesClient(subscriptionID string) ShortTermRetentionPoliciesClient { - return NewShortTermRetentionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewBackupShortTermRetentionPoliciesClient creates an instance of the BackupShortTermRetentionPoliciesClient client. +func NewBackupShortTermRetentionPoliciesClient(subscriptionID string) BackupShortTermRetentionPoliciesClient { + return NewBackupShortTermRetentionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewShortTermRetentionPoliciesClientWithBaseURI creates an instance of the ShortTermRetentionPoliciesClient client. -func NewShortTermRetentionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ShortTermRetentionPoliciesClient { - return ShortTermRetentionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewBackupShortTermRetentionPoliciesClientWithBaseURI creates an instance of the +// BackupShortTermRetentionPoliciesClient client. +func NewBackupShortTermRetentionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupShortTermRetentionPoliciesClient { + return BackupShortTermRetentionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} } // CreateOrUpdate updates a database's short term retention policy. @@ -48,16 +49,16 @@ func NewShortTermRetentionPoliciesClientWithBaseURI(baseURI string, subscription // serverName - the name of the server. // databaseName - the name of the database. // parameters - the short term retention policy info. -func (client ShortTermRetentionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ShortTermRetentionPolicy) (result ShortTermRetentionPoliciesCreateOrUpdateFuture, err error) { +func (client BackupShortTermRetentionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupShortTermRetentionPolicy) (result BackupShortTermRetentionPoliciesCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ShortTermRetentionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") return } result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ShortTermRetentionPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -65,7 +66,7 @@ func (client ShortTermRetentionPoliciesClient) CreateOrUpdate(ctx context.Contex } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ShortTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ShortTermRetentionPolicy) (*http.Request, error) { +func (client BackupShortTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupShortTermRetentionPolicy) (*http.Request, error) { pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "policyName": autorest.Encode("path", "default"), @@ -91,7 +92,7 @@ func (client ShortTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx contex // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. -func (client ShortTermRetentionPoliciesClient) CreateOrUpdateSender(req *http.Request) (future ShortTermRetentionPoliciesCreateOrUpdateFuture, err error) { +func (client BackupShortTermRetentionPoliciesClient) CreateOrUpdateSender(req *http.Request) (future BackupShortTermRetentionPoliciesCreateOrUpdateFuture, err error) { sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) future.Future = azure.NewFuture(req) future.req = req @@ -106,7 +107,7 @@ func (client ShortTermRetentionPoliciesClient) CreateOrUpdateSender(req *http.Re // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. -func (client ShortTermRetentionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ShortTermRetentionPolicy, err error) { +func (client BackupShortTermRetentionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result BackupShortTermRetentionPolicy, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -123,30 +124,30 @@ func (client ShortTermRetentionPoliciesClient) CreateOrUpdateResponder(resp *htt // from the Azure Resource Manager API or the portal. // serverName - the name of the server. // databaseName - the name of the database. -func (client ShortTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result ShortTermRetentionPolicy, err error) { +func (client BackupShortTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result BackupShortTermRetentionPolicy, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ShortTermRetentionPoliciesClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "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.ShortTermRetentionPoliciesClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ShortTermRetentionPoliciesClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "Get", resp, "Failure responding to request") } return } // GetPreparer prepares the Get request. -func (client ShortTermRetentionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { +func (client BackupShortTermRetentionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "policyName": autorest.Encode("path", "default"), @@ -170,14 +171,14 @@ func (client ShortTermRetentionPoliciesClient) GetPreparer(ctx context.Context, // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client ShortTermRetentionPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { +func (client BackupShortTermRetentionPoliciesClient) 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 ShortTermRetentionPoliciesClient) GetResponder(resp *http.Response) (result ShortTermRetentionPolicy, err error) { +func (client BackupShortTermRetentionPoliciesClient) GetResponder(resp *http.Response) (result BackupShortTermRetentionPolicy, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -195,16 +196,16 @@ func (client ShortTermRetentionPoliciesClient) GetResponder(resp *http.Response) // serverName - the name of the server. // databaseName - the name of the database. // parameters - the short term retention policy info. -func (client ShortTermRetentionPoliciesClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ShortTermRetentionPolicy) (result ShortTermRetentionPoliciesUpdateFuture, err error) { +func (client BackupShortTermRetentionPoliciesClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupShortTermRetentionPolicy) (result BackupShortTermRetentionPoliciesUpdateFuture, err error) { req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ShortTermRetentionPoliciesClient", "Update", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "Update", nil, "Failure preparing request") return } result, err = client.UpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ShortTermRetentionPoliciesClient", "Update", result.Response(), "Failure sending request") + err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "Update", result.Response(), "Failure sending request") return } @@ -212,7 +213,7 @@ func (client ShortTermRetentionPoliciesClient) Update(ctx context.Context, resou } // UpdatePreparer prepares the Update request. -func (client ShortTermRetentionPoliciesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ShortTermRetentionPolicy) (*http.Request, error) { +func (client BackupShortTermRetentionPoliciesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupShortTermRetentionPolicy) (*http.Request, error) { pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "policyName": autorest.Encode("path", "default"), @@ -238,7 +239,7 @@ func (client ShortTermRetentionPoliciesClient) UpdatePreparer(ctx context.Contex // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. -func (client ShortTermRetentionPoliciesClient) UpdateSender(req *http.Request) (future ShortTermRetentionPoliciesUpdateFuture, err error) { +func (client BackupShortTermRetentionPoliciesClient) UpdateSender(req *http.Request) (future BackupShortTermRetentionPoliciesUpdateFuture, err error) { sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) future.Future = azure.NewFuture(req) future.req = req @@ -253,7 +254,7 @@ func (client ShortTermRetentionPoliciesClient) UpdateSender(req *http.Request) ( // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client ShortTermRetentionPoliciesClient) UpdateResponder(resp *http.Response) (result ShortTermRetentionPolicy, err error) { +func (client BackupShortTermRetentionPoliciesClient) UpdateResponder(resp *http.Response) (result BackupShortTermRetentionPolicy, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/databasevulnerabilityassessmentscans.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/databasevulnerabilityassessmentscans.go index 71eae3e4dcde..f87616167fec 100644 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/databasevulnerabilityassessmentscans.go +++ b/services/preview/sql/mgmt/2017-10-01-preview/sql/databasevulnerabilityassessmentscans.go @@ -43,31 +43,37 @@ func NewDatabaseVulnerabilityAssessmentScansClientWithBaseURI(baseURI string, su return DatabaseVulnerabilityAssessmentScansClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Execute executes a Vulnerability Assessment database scan. +// Export convert an existing scan result to a human readable format. If already exists nothing happens // 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. -// scanID - the vulnerability assessment scan Id of the scan to retrieve. -func (client DatabaseVulnerabilityAssessmentScansClient) Execute(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result DatabaseVulnerabilityAssessmentScansExecuteFuture, err error) { - req, err := client.ExecutePreparer(ctx, resourceGroupName, serverName, databaseName, scanID) +// databaseName - the name of the scanned database. +// scanID - the vulnerability assessment scan Id. +func (client DatabaseVulnerabilityAssessmentScansClient) Export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result DatabaseVulnerabilityAssessmentScansExport, err error) { + req, err := client.ExportPreparer(ctx, resourceGroupName, serverName, databaseName, scanID) if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Execute", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Export", nil, "Failure preparing request") return } - result, err = client.ExecuteSender(req) + resp, err := client.ExportSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Execute", result.Response(), "Failure sending request") + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Export", resp, "Failure sending request") return } + result, err = client.ExportResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Export", resp, "Failure responding to request") + } + return } -// ExecutePreparer prepares the Execute request. -func (client DatabaseVulnerabilityAssessmentScansClient) ExecutePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (*http.Request, error) { +// ExportPreparer prepares the Export request. +func (client DatabaseVulnerabilityAssessmentScansClient) ExportPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (*http.Request, error) { pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -85,69 +91,62 @@ func (client DatabaseVulnerabilityAssessmentScansClient) ExecutePreparer(ctx con preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// ExecuteSender sends the Execute request. The method will close the +// ExportSender sends the Export request. The method will close the // http.Response Body if it receives an error. -func (client DatabaseVulnerabilityAssessmentScansClient) ExecuteSender(req *http.Request) (future DatabaseVulnerabilityAssessmentScansExecuteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) - if err != nil { - return - } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) - return +func (client DatabaseVulnerabilityAssessmentScansClient) ExportSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } -// ExecuteResponder handles the response to the Execute request. The method always +// ExportResponder handles the response to the Export request. The method always // closes the http.Response Body. -func (client DatabaseVulnerabilityAssessmentScansClient) ExecuteResponder(resp *http.Response) (result autorest.Response, err error) { +func (client DatabaseVulnerabilityAssessmentScansClient) ExportResponder(resp *http.Response) (result DatabaseVulnerabilityAssessmentScansExport, err error) { err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) - result.Response = resp + result.Response = autorest.Response{Response: resp} return } -// Export convert an existing scan result to a human readable format. If already exists nothing happens +// Get gets a vulnerability assessment scan record of a 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 scanned database. -// scanID - the vulnerability assessment scan Id. -func (client DatabaseVulnerabilityAssessmentScansClient) Export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result DatabaseVulnerabilityAssessmentScansExport, err error) { - req, err := client.ExportPreparer(ctx, resourceGroupName, serverName, databaseName, scanID) +// databaseName - the name of the database. +// scanID - the vulnerability assessment scan Id of the scan to retrieve. +func (client DatabaseVulnerabilityAssessmentScansClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result VulnerabilityAssessmentScanRecord, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName, scanID) if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Export", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Get", nil, "Failure preparing request") return } - resp, err := client.ExportSender(req) + resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Export", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Get", resp, "Failure sending request") return } - result, err = client.ExportResponder(resp) + result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Export", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Get", resp, "Failure responding to request") } return } -// ExportPreparer prepares the Export request. -func (client DatabaseVulnerabilityAssessmentScansClient) ExportPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (*http.Request, error) { +// GetPreparer prepares the Get request. +func (client DatabaseVulnerabilityAssessmentScansClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (*http.Request, error) { pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -163,64 +162,58 @@ func (client DatabaseVulnerabilityAssessmentScansClient) ExportPreparer(ctx cont } preparer := autorest.CreatePreparer( - autorest.AsPost(), + autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// ExportSender sends the Export request. The method will close the +// GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client DatabaseVulnerabilityAssessmentScansClient) ExportSender(req *http.Request) (*http.Response, error) { +func (client DatabaseVulnerabilityAssessmentScansClient) GetSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } -// ExportResponder handles the response to the Export request. The method always +// GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client DatabaseVulnerabilityAssessmentScansClient) ExportResponder(resp *http.Response) (result DatabaseVulnerabilityAssessmentScansExport, err error) { +func (client DatabaseVulnerabilityAssessmentScansClient) GetResponder(resp *http.Response) (result VulnerabilityAssessmentScanRecord, err error) { err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } -// Get gets a vulnerability assessment scan record of a database. +// InitiateScan executes a Vulnerability Assessment database scan. // 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. // scanID - the vulnerability assessment scan Id of the scan to retrieve. -func (client DatabaseVulnerabilityAssessmentScansClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result VulnerabilityAssessmentScanRecord, err error) { - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName, scanID) +func (client DatabaseVulnerabilityAssessmentScansClient) InitiateScan(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result DatabaseVulnerabilityAssessmentScansInitiateScanFuture, err error) { + req, err := client.InitiateScanPreparer(ctx, resourceGroupName, serverName, databaseName, scanID) if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "InitiateScan", nil, "Failure preparing request") return } - resp, err := client.GetSender(req) + result, err = client.InitiateScanSender(req) if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "InitiateScan", result.Response(), "Failure sending request") return } - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Get", resp, "Failure responding to request") - } - return } -// GetPreparer prepares the Get request. -func (client DatabaseVulnerabilityAssessmentScansClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (*http.Request, error) { +// InitiateScanPreparer prepares the InitiateScan request. +func (client DatabaseVulnerabilityAssessmentScansClient) InitiateScanPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (*http.Request, error) { pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -236,30 +229,37 @@ func (client DatabaseVulnerabilityAssessmentScansClient) GetPreparer(ctx context } preparer := autorest.CreatePreparer( - autorest.AsGet(), + autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// GetSender sends the Get request. The method will close the +// InitiateScanSender sends the InitiateScan request. The method will close the // http.Response Body if it receives an error. -func (client DatabaseVulnerabilityAssessmentScansClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) +func (client DatabaseVulnerabilityAssessmentScansClient) InitiateScanSender(req *http.Request) (future DatabaseVulnerabilityAssessmentScansInitiateScanFuture, err error) { + sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) + future.Future = azure.NewFuture(req) + future.req = req + _, err = future.Done(sender) + if err != nil { + return + } + err = autorest.Respond(future.Response(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + return } -// GetResponder handles the response to the Get request. The method always +// InitiateScanResponder handles the response to the InitiateScan request. The method always // closes the http.Response Body. -func (client DatabaseVulnerabilityAssessmentScansClient) GetResponder(resp *http.Response) (result VulnerabilityAssessmentScanRecord, err error) { +func (client DatabaseVulnerabilityAssessmentScansClient) InitiateScanResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} + result.Response = resp 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 0d280f63569c..fdfb6f21a3d1 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 @@ -392,6 +392,192 @@ func PossibleVulnerabilityAssessmentScanTriggerTypeValues() []VulnerabilityAsses return []VulnerabilityAssessmentScanTriggerType{OnDemand, Recurring} } +// BackupShortTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type BackupShortTermRetentionPoliciesCreateOrUpdateFuture struct { + azure.Future + req *http.Request +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future BackupShortTermRetentionPoliciesCreateOrUpdateFuture) Result(client BackupShortTermRetentionPoliciesClient) (bstrp BackupShortTermRetentionPolicy, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + return bstrp, azure.NewAsyncOpIncompleteError("sql.BackupShortTermRetentionPoliciesCreateOrUpdateFuture") + } + if future.PollingMethod() == azure.PollingLocation { + bstrp, err = client.CreateOrUpdateResponder(future.Response()) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") + } + return + } + var req *http.Request + var resp *http.Response + if future.PollingURL() != "" { + req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + if err != nil { + return + } + } else { + req = autorest.ChangeToGet(future.req) + } + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", resp, "Failure sending request") + return + } + bstrp, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") + } + return +} + +// BackupShortTermRetentionPoliciesUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BackupShortTermRetentionPoliciesUpdateFuture struct { + azure.Future + req *http.Request +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future BackupShortTermRetentionPoliciesUpdateFuture) Result(client BackupShortTermRetentionPoliciesClient) (bstrp BackupShortTermRetentionPolicy, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + return bstrp, azure.NewAsyncOpIncompleteError("sql.BackupShortTermRetentionPoliciesUpdateFuture") + } + if future.PollingMethod() == azure.PollingLocation { + bstrp, err = client.UpdateResponder(future.Response()) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesUpdateFuture", "Result", future.Response(), "Failure responding to request") + } + return + } + var req *http.Request + var resp *http.Response + if future.PollingURL() != "" { + req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + if err != nil { + return + } + } else { + req = autorest.ChangeToGet(future.req) + } + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesUpdateFuture", "Result", resp, "Failure sending request") + return + } + bstrp, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesUpdateFuture", "Result", resp, "Failure responding to request") + } + return +} + +// BackupShortTermRetentionPolicy a short term retention policy. +type BackupShortTermRetentionPolicy struct { + autorest.Response `json:"-"` + // BackupShortTermRetentionPolicyProperties - Resource properties. + *BackupShortTermRetentionPolicyProperties `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 BackupShortTermRetentionPolicy. +func (bstrp BackupShortTermRetentionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bstrp.BackupShortTermRetentionPolicyProperties != nil { + objectMap["properties"] = bstrp.BackupShortTermRetentionPolicyProperties + } + if bstrp.ID != nil { + objectMap["id"] = bstrp.ID + } + if bstrp.Name != nil { + objectMap["name"] = bstrp.Name + } + if bstrp.Type != nil { + objectMap["type"] = bstrp.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BackupShortTermRetentionPolicy struct. +func (bstrp *BackupShortTermRetentionPolicy) 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 backupShortTermRetentionPolicyProperties BackupShortTermRetentionPolicyProperties + err = json.Unmarshal(*v, &backupShortTermRetentionPolicyProperties) + if err != nil { + return err + } + bstrp.BackupShortTermRetentionPolicyProperties = &backupShortTermRetentionPolicyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bstrp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bstrp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bstrp.Type = &typeVar + } + } + } + + return nil +} + +// BackupShortTermRetentionPolicyProperties properties of a short term retention policy +type BackupShortTermRetentionPolicyProperties struct { + // RetentionDays - The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + RetentionDays *int32 `json:"retentionDays,omitempty"` +} + // Database a database resource. type Database struct { autorest.Response `json:"-"` @@ -1381,61 +1567,12 @@ type DatabaseVulnerabilityAssessmentProperties struct { RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` } -// DatabaseVulnerabilityAssessmentScanExportProperties properties of the export operation’s result. +// DatabaseVulnerabilityAssessmentScanExportProperties properties of the export operation's result. type DatabaseVulnerabilityAssessmentScanExportProperties struct { // ExportedReportLocation - Location of the exported report (e.g. https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). ExportedReportLocation *string `json:"exportedReportLocation,omitempty"` } -// DatabaseVulnerabilityAssessmentScansExecuteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseVulnerabilityAssessmentScansExecuteFuture struct { - azure.Future - req *http.Request -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future DatabaseVulnerabilityAssessmentScansExecuteFuture) Result(client DatabaseVulnerabilityAssessmentScansClient) (ar autorest.Response, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansExecuteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - return ar, azure.NewAsyncOpIncompleteError("sql.DatabaseVulnerabilityAssessmentScansExecuteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.ExecuteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansExecuteFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansExecuteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.ExecuteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansExecuteFuture", "Result", resp, "Failure responding to request") - } - return -} - // DatabaseVulnerabilityAssessmentScansExport a database Vulnerability Assessment scan export resource. type DatabaseVulnerabilityAssessmentScansExport struct { autorest.Response `json:"-"` @@ -1518,6 +1655,55 @@ func (dvase *DatabaseVulnerabilityAssessmentScansExport) UnmarshalJSON(body []by return nil } +// DatabaseVulnerabilityAssessmentScansInitiateScanFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type DatabaseVulnerabilityAssessmentScansInitiateScanFuture struct { + azure.Future + req *http.Request +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future DatabaseVulnerabilityAssessmentScansInitiateScanFuture) Result(client DatabaseVulnerabilityAssessmentScansClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansInitiateScanFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + return ar, azure.NewAsyncOpIncompleteError("sql.DatabaseVulnerabilityAssessmentScansInitiateScanFuture") + } + if future.PollingMethod() == azure.PollingLocation { + ar, err = client.InitiateScanResponder(future.Response()) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansInitiateScanFuture", "Result", future.Response(), "Failure responding to request") + } + return + } + var req *http.Request + var resp *http.Response + if future.PollingURL() != "" { + req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + if err != nil { + return + } + } else { + req = autorest.ChangeToGet(future.req) + } + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansInitiateScanFuture", "Result", resp, "Failure sending request") + return + } + ar, err = client.InitiateScanResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansInitiateScanFuture", "Result", resp, "Failure responding to request") + } + return +} + // EditionCapability the edition capability. type EditionCapability struct { // Name - The database edition name. @@ -2906,203 +3092,17 @@ type ServiceObjectiveCapability struct { Reason *string `json:"reason,omitempty"` } -// ShortTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ShortTermRetentionPoliciesCreateOrUpdateFuture struct { - azure.Future - req *http.Request -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future ShortTermRetentionPoliciesCreateOrUpdateFuture) Result(client ShortTermRetentionPoliciesClient) (strp ShortTermRetentionPolicy, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - return strp, azure.NewAsyncOpIncompleteError("sql.ShortTermRetentionPoliciesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - strp, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - strp, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") - } - return -} - -// ShortTermRetentionPoliciesUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ShortTermRetentionPoliciesUpdateFuture struct { - azure.Future - req *http.Request -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future ShortTermRetentionPoliciesUpdateFuture) Result(client ShortTermRetentionPoliciesClient) (strp ShortTermRetentionPolicy, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ShortTermRetentionPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - return strp, azure.NewAsyncOpIncompleteError("sql.ShortTermRetentionPoliciesUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - strp, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ShortTermRetentionPoliciesUpdateFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ShortTermRetentionPoliciesUpdateFuture", "Result", resp, "Failure sending request") - return - } - strp, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ShortTermRetentionPoliciesUpdateFuture", "Result", resp, "Failure responding to request") - } - return -} - -// ShortTermRetentionPolicy a short term retention policy resource. -type ShortTermRetentionPolicy struct { - autorest.Response `json:"-"` - // ShortTermRetentionPolicyProperties - Resource properties. - *ShortTermRetentionPolicyProperties `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 ShortTermRetentionPolicy. -func (strp ShortTermRetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if strp.ShortTermRetentionPolicyProperties != nil { - objectMap["properties"] = strp.ShortTermRetentionPolicyProperties - } - if strp.ID != nil { - objectMap["id"] = strp.ID - } - if strp.Name != nil { - objectMap["name"] = strp.Name - } - if strp.Type != nil { - objectMap["type"] = strp.Type - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ShortTermRetentionPolicy struct. -func (strp *ShortTermRetentionPolicy) 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 shortTermRetentionPolicyProperties ShortTermRetentionPolicyProperties - err = json.Unmarshal(*v, &shortTermRetentionPolicyProperties) - if err != nil { - return err - } - strp.ShortTermRetentionPolicyProperties = &shortTermRetentionPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - strp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - strp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - strp.Type = &typeVar - } - } - } - - return nil -} - -// ShortTermRetentionPolicyProperties properties of a short term retention policy -type ShortTermRetentionPolicyProperties struct { - // RetentionDays - The backup retention period in days. This is how many days Point-in-Time Restore will be supported. - RetentionDays *int32 `json:"retentionDays,omitempty"` -} - -// Sku an ARM Resource SKU. +// Sku the resource model definition representing SKU type Sku struct { - // Name - The name of the SKU, typically, a letter + Number code, e.g. P3. + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code Name *string `json:"name,omitempty"` - // Tier - The tier of the particular SKU, e.g. Basic, Premium. + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Tier *string `json:"tier,omitempty"` - // Size - Size of the particular SKU + // 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 - Capacity of the particular SKU. + // 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"` } diff --git a/services/sql/mgmt/2014-04-01/sql/models.go b/services/sql/mgmt/2014-04-01/sql/models.go index 7724c4e41a6d..f2f10b67cd32 100644 --- a/services/sql/mgmt/2014-04-01/sql/models.go +++ b/services/sql/mgmt/2014-04-01/sql/models.go @@ -549,10 +549,10 @@ type Database struct { Kind *string `json:"kind,omitempty"` // DatabaseProperties - The properties representing the resource. *DatabaseProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -570,12 +570,12 @@ func (d Database) MarshalJSON() ([]byte, error) { if d.DatabaseProperties != nil { objectMap["properties"] = d.DatabaseProperties } - if d.Tags != nil { - objectMap["tags"] = d.Tags - } if d.Location != nil { objectMap["location"] = d.Location } + if d.Tags != nil { + objectMap["tags"] = d.Tags + } if d.ID != nil { objectMap["id"] = d.ID } @@ -615,23 +615,23 @@ func (d *Database) UnmarshalJSON(body []byte) error { } d.DatabaseProperties = &databaseProperties } - case "tags": + case "location": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - d.Tags = tags + d.Location = &location } - case "location": + case "tags": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - d.Location = &location + d.Tags = tags } case "id": if v != nil { @@ -1307,10 +1307,10 @@ type ElasticPool struct { *ElasticPoolProperties `json:"properties,omitempty"` // Kind - Kind of elastic pool. This is metadata used for the Azure portal experience. Kind *string `json:"kind,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -1328,12 +1328,12 @@ func (ep ElasticPool) MarshalJSON() ([]byte, error) { if ep.Kind != nil { objectMap["kind"] = ep.Kind } - if ep.Tags != nil { - objectMap["tags"] = ep.Tags - } if ep.Location != nil { objectMap["location"] = ep.Location } + if ep.Tags != nil { + objectMap["tags"] = ep.Tags + } if ep.ID != nil { objectMap["id"] = ep.ID } @@ -1373,23 +1373,23 @@ func (ep *ElasticPool) UnmarshalJSON(body []byte) error { } ep.Kind = &kind } - case "tags": + case "location": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - ep.Tags = tags + ep.Location = &location } - case "location": + case "tags": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - ep.Location = &location + ep.Tags = tags } case "id": if v != nil { @@ -2921,10 +2921,10 @@ type SloUsageMetric struct { // TrackedResource ARM tracked top level resource. type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` // Location - Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - Resource ID. ID *string `json:"id,omitempty"` // Name - Resource name. @@ -2936,12 +2936,12 @@ type TrackedResource struct { // 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 } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } if tr.ID != nil { objectMap["id"] = tr.ID }