diff --git a/services/mysql/mgmt/2017-12-01/mysql/models.go b/services/mysql/mgmt/2017-12-01/mysql/models.go index 0fa40b5e784a..323ed83609df 100644 --- a/services/mysql/mgmt/2017-12-01/mysql/models.go +++ b/services/mysql/mgmt/2017-12-01/mysql/models.go @@ -25,6 +25,7 @@ import ( "github.com/Azure/go-autorest/autorest/date" "github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/tracing" + "github.com/satori/go.uuid" "net/http" ) @@ -67,6 +68,53 @@ func PossibleGeoRedundantBackupValues() []GeoRedundantBackup { return []GeoRedundantBackup{Disabled, Enabled} } +// IdentityType enumerates the values for identity type. +type IdentityType string + +const ( + // SystemAssigned ... + SystemAssigned IdentityType = "SystemAssigned" +) + +// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{SystemAssigned} +} + +// InfrastructureEncryption enumerates the values for infrastructure encryption. +type InfrastructureEncryption string + +const ( + // InfrastructureEncryptionDisabled ... + InfrastructureEncryptionDisabled InfrastructureEncryption = "Disabled" + // InfrastructureEncryptionEnabled ... + InfrastructureEncryptionEnabled InfrastructureEncryption = "Enabled" +) + +// PossibleInfrastructureEncryptionValues returns an array of possible values for the InfrastructureEncryption const type. +func PossibleInfrastructureEncryptionValues() []InfrastructureEncryption { + return []InfrastructureEncryption{InfrastructureEncryptionDisabled, InfrastructureEncryptionEnabled} +} + +// MinimalTLSVersionEnum enumerates the values for minimal tls version enum. +type MinimalTLSVersionEnum string + +const ( + // TLS10 ... + TLS10 MinimalTLSVersionEnum = "TLS1_0" + // TLS11 ... + TLS11 MinimalTLSVersionEnum = "TLS1_1" + // TLS12 ... + TLS12 MinimalTLSVersionEnum = "TLS1_2" + // TLSEnforcementDisabled ... + TLSEnforcementDisabled MinimalTLSVersionEnum = "TLSEnforcementDisabled" +) + +// PossibleMinimalTLSVersionEnumValues returns an array of possible values for the MinimalTLSVersionEnum const type. +func PossibleMinimalTLSVersionEnumValues() []MinimalTLSVersionEnum { + return []MinimalTLSVersionEnum{TLS10, TLS11, TLS12, TLSEnforcementDisabled} +} + // OperationOrigin enumerates the values for operation origin. type OperationOrigin string @@ -84,6 +132,76 @@ func PossibleOperationOriginValues() []OperationOrigin { return []OperationOrigin{NotSpecified, System, User} } +// PrivateEndpointProvisioningState enumerates the values for private endpoint provisioning state. +type PrivateEndpointProvisioningState string + +const ( + // Approving ... + Approving PrivateEndpointProvisioningState = "Approving" + // Dropping ... + Dropping PrivateEndpointProvisioningState = "Dropping" + // Failed ... + Failed PrivateEndpointProvisioningState = "Failed" + // Ready ... + Ready PrivateEndpointProvisioningState = "Ready" + // Rejecting ... + Rejecting PrivateEndpointProvisioningState = "Rejecting" +) + +// PossiblePrivateEndpointProvisioningStateValues returns an array of possible values for the PrivateEndpointProvisioningState const type. +func PossiblePrivateEndpointProvisioningStateValues() []PrivateEndpointProvisioningState { + return []PrivateEndpointProvisioningState{Approving, Dropping, Failed, Ready, Rejecting} +} + +// PrivateLinkServiceConnectionStateActionsRequire enumerates the values for private link service connection +// state actions require. +type PrivateLinkServiceConnectionStateActionsRequire string + +const ( + // None ... + None PrivateLinkServiceConnectionStateActionsRequire = "None" +) + +// PossiblePrivateLinkServiceConnectionStateActionsRequireValues returns an array of possible values for the PrivateLinkServiceConnectionStateActionsRequire const type. +func PossiblePrivateLinkServiceConnectionStateActionsRequireValues() []PrivateLinkServiceConnectionStateActionsRequire { + return []PrivateLinkServiceConnectionStateActionsRequire{None} +} + +// PrivateLinkServiceConnectionStateStatus enumerates the values for private link service connection state +// status. +type PrivateLinkServiceConnectionStateStatus string + +const ( + // Approved ... + Approved PrivateLinkServiceConnectionStateStatus = "Approved" + // Disconnected ... + Disconnected PrivateLinkServiceConnectionStateStatus = "Disconnected" + // Pending ... + Pending PrivateLinkServiceConnectionStateStatus = "Pending" + // Rejected ... + Rejected PrivateLinkServiceConnectionStateStatus = "Rejected" +) + +// PossiblePrivateLinkServiceConnectionStateStatusValues returns an array of possible values for the PrivateLinkServiceConnectionStateStatus const type. +func PossiblePrivateLinkServiceConnectionStateStatusValues() []PrivateLinkServiceConnectionStateStatus { + return []PrivateLinkServiceConnectionStateStatus{Approved, Disconnected, Pending, Rejected} +} + +// PublicNetworkAccessEnum enumerates the values for public network access enum. +type PublicNetworkAccessEnum string + +const ( + // PublicNetworkAccessEnumDisabled ... + PublicNetworkAccessEnumDisabled PublicNetworkAccessEnum = "Disabled" + // PublicNetworkAccessEnumEnabled ... + PublicNetworkAccessEnumEnabled PublicNetworkAccessEnum = "Enabled" +) + +// PossiblePublicNetworkAccessEnumValues returns an array of possible values for the PublicNetworkAccessEnum const type. +func PossiblePublicNetworkAccessEnumValues() []PublicNetworkAccessEnum { + return []PublicNetworkAccessEnum{PublicNetworkAccessEnumDisabled, PublicNetworkAccessEnumEnabled} +} + // ServerSecurityAlertPolicyState enumerates the values for server security alert policy state. type ServerSecurityAlertPolicyState string @@ -107,13 +225,15 @@ const ( ServerStateDisabled ServerState = "Disabled" // ServerStateDropping ... ServerStateDropping ServerState = "Dropping" + // ServerStateInaccessible ... + ServerStateInaccessible ServerState = "Inaccessible" // ServerStateReady ... ServerStateReady ServerState = "Ready" ) // PossibleServerStateValues returns an array of possible values for the ServerState const type. func PossibleServerStateValues() []ServerState { - return []ServerState{ServerStateDisabled, ServerStateDropping, ServerStateReady} + return []ServerState{ServerStateDisabled, ServerStateDropping, ServerStateInaccessible, ServerStateReady} } // ServerVersion enumerates the values for server version. @@ -184,21 +304,21 @@ func PossibleStorageAutogrowValues() []StorageAutogrow { type VirtualNetworkRuleState string const ( - // Deleting ... - Deleting VirtualNetworkRuleState = "Deleting" - // Initializing ... - Initializing VirtualNetworkRuleState = "Initializing" - // InProgress ... - InProgress VirtualNetworkRuleState = "InProgress" - // Ready ... - Ready VirtualNetworkRuleState = "Ready" - // Unknown ... - Unknown VirtualNetworkRuleState = "Unknown" + // VirtualNetworkRuleStateDeleting ... + VirtualNetworkRuleStateDeleting VirtualNetworkRuleState = "Deleting" + // VirtualNetworkRuleStateInitializing ... + VirtualNetworkRuleStateInitializing VirtualNetworkRuleState = "Initializing" + // VirtualNetworkRuleStateInProgress ... + VirtualNetworkRuleStateInProgress VirtualNetworkRuleState = "InProgress" + // VirtualNetworkRuleStateReady ... + VirtualNetworkRuleStateReady VirtualNetworkRuleState = "Ready" + // VirtualNetworkRuleStateUnknown ... + VirtualNetworkRuleStateUnknown VirtualNetworkRuleState = "Unknown" ) // PossibleVirtualNetworkRuleStateValues returns an array of possible values for the VirtualNetworkRuleState const type. func PossibleVirtualNetworkRuleStateValues() []VirtualNetworkRuleState { - return []VirtualNetworkRuleState{Deleting, Initializing, InProgress, Ready, Unknown} + return []VirtualNetworkRuleState{VirtualNetworkRuleStateDeleting, VirtualNetworkRuleStateInitializing, VirtualNetworkRuleStateInProgress, VirtualNetworkRuleStateReady, VirtualNetworkRuleStateUnknown} } // AzureEntityResource the resource model definition for a Azure Resource Manager resource with an etag. @@ -829,6 +949,12 @@ type PerformanceTierServiceLevelObjectives struct { MinStorageMB *int32 `json:"minStorageMB,omitempty"` } +// PrivateEndpointProperty ... +type PrivateEndpointProperty struct { + // ID - Resource id of the private endpoint. + ID *string `json:"id,omitempty"` +} + // ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than // required location and tags type ProxyResource struct { @@ -850,6 +976,16 @@ type Resource struct { Type *string `json:"type,omitempty"` } +// ResourceIdentity azure Active Directory identity configuration for a resource. +type ResourceIdentity struct { + // PrincipalID - READ-ONLY; The Azure Active Directory principal id. + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + // Type - The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. Possible values include: 'SystemAssigned' + Type IdentityType `json:"type,omitempty"` + // TenantID - READ-ONLY; The Azure Active Directory tenant id. + TenantID *uuid.UUID `json:"tenantId,omitempty"` +} + // SecurityAlertPolicyProperties properties of a security alert policy. type SecurityAlertPolicyProperties struct { // State - Specifies the state of the policy, whether it is enabled or disabled. Possible values include: 'ServerSecurityAlertPolicyStateEnabled', 'ServerSecurityAlertPolicyStateDisabled' @@ -871,6 +1007,8 @@ type SecurityAlertPolicyProperties struct { // Server represents a server. type Server struct { autorest.Response `json:"-"` + // Identity - The Azure Active Directory identity of the server. + Identity *ResourceIdentity `json:"identity,omitempty"` // Sku - The SKU (pricing tier) of the server. Sku *Sku `json:"sku,omitempty"` // ServerProperties - Properties of the server. @@ -890,6 +1028,9 @@ type Server struct { // MarshalJSON is the custom marshaler for Server. func (s Server) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if s.Identity != nil { + objectMap["identity"] = s.Identity + } if s.Sku != nil { objectMap["sku"] = s.Sku } @@ -914,6 +1055,15 @@ func (s *Server) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "identity": + if v != nil { + var identity ResourceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + s.Identity = &identity + } case "sku": if v != nil { var sku Sku @@ -983,8 +1133,154 @@ func (s *Server) UnmarshalJSON(body []byte) error { return nil } +// ServerAdministratorProperties the properties of an server Administrator. +type ServerAdministratorProperties struct { + // AdministratorType - The type of administrator. + AdministratorType *string `json:"administratorType,omitempty"` + // Login - The server administrator login account name. + Login *string `json:"login,omitempty"` + // Sid - The server administrator Sid (Secure ID). + Sid *uuid.UUID `json:"sid,omitempty"` + // TenantID - The server Active Directory Administrator tenant id. + TenantID *uuid.UUID `json:"tenantId,omitempty"` +} + +// ServerAdministratorResource represents a and external administrator to be created. +type ServerAdministratorResource struct { + autorest.Response `json:"-"` + // ServerAdministratorProperties - Properties of the server AAD administrator. + *ServerAdministratorProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServerAdministratorResource. +func (sar ServerAdministratorResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sar.ServerAdministratorProperties != nil { + objectMap["properties"] = sar.ServerAdministratorProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ServerAdministratorResource struct. +func (sar *ServerAdministratorResource) 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 serverAdministratorProperties ServerAdministratorProperties + err = json.Unmarshal(*v, &serverAdministratorProperties) + if err != nil { + return err + } + sar.ServerAdministratorProperties = &serverAdministratorProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sar.Type = &typeVar + } + } + } + + return nil +} + +// ServerAdministratorResourceListResult the response to a list Active Directory Administrators request. +type ServerAdministratorResourceListResult struct { + autorest.Response `json:"-"` + // Value - The list of server Active Directory Administrators for the server. + Value *[]ServerAdministratorResource `json:"value,omitempty"` +} + +// ServerAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ServerAdministratorsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ServerAdministratorsCreateOrUpdateFuture) Result(client ServerAdministratorsClient) (sar ServerAdministratorResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("mysql.ServerAdministratorsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sar.Response.Response, err = future.GetResult(sender); err == nil && sar.Response.Response.StatusCode != http.StatusNoContent { + sar, err = client.CreateOrUpdateResponder(sar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsCreateOrUpdateFuture", "Result", sar.Response.Response, "Failure responding to request") + } + } + return +} + +// ServerAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ServerAdministratorsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ServerAdministratorsDeleteFuture) Result(client ServerAdministratorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("mysql.ServerAdministratorsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + // ServerForCreate represents a server to be created. type ServerForCreate struct { + // Identity - The Azure Active Directory identity of the server. + Identity *ResourceIdentity `json:"identity,omitempty"` // Sku - The SKU (pricing tier) of the server. Sku *Sku `json:"sku,omitempty"` // Properties - Properties of the server. @@ -998,6 +1294,9 @@ type ServerForCreate struct { // MarshalJSON is the custom marshaler for ServerForCreate. func (sfc ServerForCreate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if sfc.Identity != nil { + objectMap["identity"] = sfc.Identity + } if sfc.Sku != nil { objectMap["sku"] = sfc.Sku } @@ -1020,6 +1319,15 @@ func (sfc *ServerForCreate) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "identity": + if v != nil { + var identity ResourceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + sfc.Identity = &identity + } case "sku": if v != nil { var sku Sku @@ -1068,6 +1376,34 @@ type ServerListResult struct { Value *[]Server `json:"value,omitempty"` } +// ServerPrivateEndpointConnection a private endpoint connection under a server +type ServerPrivateEndpointConnection struct { + // ID - READ-ONLY; Resource Id of the private endpoint connection. + ID *string `json:"id,omitempty"` + // Properties - READ-ONLY; Private endpoint connection properties + Properties *ServerPrivateEndpointConnectionProperties `json:"properties,omitempty"` +} + +// ServerPrivateEndpointConnectionProperties properties of a private endpoint connection. +type ServerPrivateEndpointConnectionProperties struct { + // PrivateEndpoint - Private endpoint which the connection belongs to. + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. + PrivateLinkServiceConnectionState *ServerPrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - READ-ONLY; State of the private endpoint connection. Possible values include: 'Approving', 'Ready', 'Dropping', 'Failed', 'Rejecting' + ProvisioningState PrivateEndpointProvisioningState `json:"provisioningState,omitempty"` +} + +// ServerPrivateLinkServiceConnectionStateProperty ... +type ServerPrivateLinkServiceConnectionStateProperty struct { + // Status - The private link service connection status. Possible values include: 'Approved', 'Pending', 'Rejected', 'Disconnected' + Status PrivateLinkServiceConnectionStateStatus `json:"status,omitempty"` + // Description - The private link service connection description. + Description *string `json:"description,omitempty"` + // ActionsRequired - READ-ONLY; The actions required for private link service connection. Possible values include: 'None' + ActionsRequired PrivateLinkServiceConnectionStateActionsRequire `json:"actionsRequired,omitempty"` +} + // ServerProperties the properties of a server. type ServerProperties struct { // AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). @@ -1076,7 +1412,13 @@ type ServerProperties struct { Version ServerVersion `json:"version,omitempty"` // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // UserVisibleState - A state of a server that is visible to user. Possible values include: 'ServerStateReady', 'ServerStateDropping', 'ServerStateDisabled' + // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' + MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` + // ByokEnforcement - READ-ONLY; Status showing whether the server data encryption is enabled with customer-managed keys. + ByokEnforcement *string `json:"byokEnforcement,omitempty"` + // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' + InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + // UserVisibleState - A state of a server that is visible to user. Possible values include: 'ServerStateReady', 'ServerStateDropping', 'ServerStateDisabled', 'ServerStateInaccessible' UserVisibleState ServerState `json:"userVisibleState,omitempty"` // FullyQualifiedDomainName - The fully qualified domain name of a server. FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` @@ -1090,6 +1432,10 @@ type ServerProperties struct { MasterServerID *string `json:"masterServerId,omitempty"` // ReplicaCapacity - The maximum number of replicas that a master server can have. ReplicaCapacity *int32 `json:"replicaCapacity,omitempty"` + // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' + PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections on a server + PrivateEndpointConnections *[]ServerPrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` } // BasicServerPropertiesForCreate the properties used to create a new server. @@ -1107,6 +1453,12 @@ type ServerPropertiesForCreate struct { Version ServerVersion `json:"version,omitempty"` // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` + // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' + MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` + // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' + InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' + PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` // StorageProfile - Storage profile of a server. StorageProfile *StorageProfile `json:"storageProfile,omitempty"` // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' @@ -1172,6 +1524,15 @@ func (spfc ServerPropertiesForCreate) MarshalJSON() ([]byte, error) { if spfc.SslEnforcement != "" { objectMap["sslEnforcement"] = spfc.SslEnforcement } + if spfc.MinimalTLSVersion != "" { + objectMap["minimalTlsVersion"] = spfc.MinimalTLSVersion + } + if spfc.InfrastructureEncryption != "" { + objectMap["infrastructureEncryption"] = spfc.InfrastructureEncryption + } + if spfc.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = spfc.PublicNetworkAccess + } if spfc.StorageProfile != nil { objectMap["storageProfile"] = spfc.StorageProfile } @@ -1221,6 +1582,12 @@ type ServerPropertiesForDefaultCreate struct { Version ServerVersion `json:"version,omitempty"` // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` + // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' + MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` + // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' + InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' + PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` // StorageProfile - Storage profile of a server. StorageProfile *StorageProfile `json:"storageProfile,omitempty"` // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' @@ -1243,6 +1610,15 @@ func (spfdc ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) { if spfdc.SslEnforcement != "" { objectMap["sslEnforcement"] = spfdc.SslEnforcement } + if spfdc.MinimalTLSVersion != "" { + objectMap["minimalTlsVersion"] = spfdc.MinimalTLSVersion + } + if spfdc.InfrastructureEncryption != "" { + objectMap["infrastructureEncryption"] = spfdc.InfrastructureEncryption + } + if spfdc.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = spfdc.PublicNetworkAccess + } if spfdc.StorageProfile != nil { objectMap["storageProfile"] = spfdc.StorageProfile } @@ -1291,6 +1667,12 @@ type ServerPropertiesForGeoRestore struct { Version ServerVersion `json:"version,omitempty"` // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` + // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' + MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` + // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' + InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' + PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` // StorageProfile - Storage profile of a server. StorageProfile *StorageProfile `json:"storageProfile,omitempty"` // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' @@ -1310,6 +1692,15 @@ func (spfgr ServerPropertiesForGeoRestore) MarshalJSON() ([]byte, error) { if spfgr.SslEnforcement != "" { objectMap["sslEnforcement"] = spfgr.SslEnforcement } + if spfgr.MinimalTLSVersion != "" { + objectMap["minimalTlsVersion"] = spfgr.MinimalTLSVersion + } + if spfgr.InfrastructureEncryption != "" { + objectMap["infrastructureEncryption"] = spfgr.InfrastructureEncryption + } + if spfgr.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = spfgr.PublicNetworkAccess + } if spfgr.StorageProfile != nil { objectMap["storageProfile"] = spfgr.StorageProfile } @@ -1357,6 +1748,12 @@ type ServerPropertiesForReplica struct { Version ServerVersion `json:"version,omitempty"` // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` + // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' + MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` + // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' + InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' + PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` // StorageProfile - Storage profile of a server. StorageProfile *StorageProfile `json:"storageProfile,omitempty"` // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' @@ -1376,6 +1773,15 @@ func (spfr ServerPropertiesForReplica) MarshalJSON() ([]byte, error) { if spfr.SslEnforcement != "" { objectMap["sslEnforcement"] = spfr.SslEnforcement } + if spfr.MinimalTLSVersion != "" { + objectMap["minimalTlsVersion"] = spfr.MinimalTLSVersion + } + if spfr.InfrastructureEncryption != "" { + objectMap["infrastructureEncryption"] = spfr.InfrastructureEncryption + } + if spfr.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = spfr.PublicNetworkAccess + } if spfr.StorageProfile != nil { objectMap["storageProfile"] = spfr.StorageProfile } @@ -1425,6 +1831,12 @@ type ServerPropertiesForRestore struct { Version ServerVersion `json:"version,omitempty"` // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` + // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' + MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` + // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' + InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' + PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` // StorageProfile - Storage profile of a server. StorageProfile *StorageProfile `json:"storageProfile,omitempty"` // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' @@ -1447,6 +1859,15 @@ func (spfr ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { if spfr.SslEnforcement != "" { objectMap["sslEnforcement"] = spfr.SslEnforcement } + if spfr.MinimalTLSVersion != "" { + objectMap["minimalTlsVersion"] = spfr.MinimalTLSVersion + } + if spfr.InfrastructureEncryption != "" { + objectMap["infrastructureEncryption"] = spfr.InfrastructureEncryption + } + if spfr.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = spfr.PublicNetworkAccess + } if spfr.StorageProfile != nil { objectMap["storageProfile"] = spfr.StorageProfile } @@ -1694,6 +2115,8 @@ func (future *ServersUpdateFuture) Result(client ServersClient) (s Server, err e // ServerUpdateParameters parameters allowed to update for a server. type ServerUpdateParameters struct { + // Identity - The Azure Active Directory identity of the server. + Identity *ResourceIdentity `json:"identity,omitempty"` // Sku - The SKU (pricing tier) of the server. Sku *Sku `json:"sku,omitempty"` // ServerUpdateParametersProperties - The properties that can be updated for a server. @@ -1705,6 +2128,9 @@ type ServerUpdateParameters struct { // MarshalJSON is the custom marshaler for ServerUpdateParameters. func (sup ServerUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if sup.Identity != nil { + objectMap["identity"] = sup.Identity + } if sup.Sku != nil { objectMap["sku"] = sup.Sku } @@ -1726,6 +2152,15 @@ func (sup *ServerUpdateParameters) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "identity": + if v != nil { + var identity ResourceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + sup.Identity = &identity + } case "sku": if v != nil { var sku Sku @@ -1769,6 +2204,10 @@ type ServerUpdateParametersProperties struct { Version ServerVersion `json:"version,omitempty"` // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` + // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' + MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` + // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' + PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` // ReplicationRole - The replication role of the server. ReplicationRole *string `json:"replicationRole,omitempty"` } @@ -2050,7 +2489,7 @@ type VirtualNetworkRuleProperties struct { VirtualNetworkSubnetID *string `json:"virtualNetworkSubnetId,omitempty"` // IgnoreMissingVnetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` - // State - READ-ONLY; Virtual Network Rule State. Possible values include: 'Initializing', 'InProgress', 'Ready', 'Deleting', 'Unknown' + // State - READ-ONLY; Virtual Network Rule State. Possible values include: 'VirtualNetworkRuleStateInitializing', 'VirtualNetworkRuleStateInProgress', 'VirtualNetworkRuleStateReady', 'VirtualNetworkRuleStateDeleting', 'VirtualNetworkRuleStateUnknown' State VirtualNetworkRuleState `json:"state,omitempty"` } diff --git a/services/mysql/mgmt/2017-12-01/mysql/mysqlapi/interfaces.go b/services/mysql/mgmt/2017-12-01/mysql/mysqlapi/interfaces.go index e8e44bccb758..256923e15e73 100644 --- a/services/mysql/mgmt/2017-12-01/mysql/mysqlapi/interfaces.go +++ b/services/mysql/mgmt/2017-12-01/mysql/mysqlapi/interfaces.go @@ -89,6 +89,16 @@ type LogFilesClientAPI interface { var _ LogFilesClientAPI = (*mysql.LogFilesClient)(nil) +// ServerAdministratorsClientAPI contains the set of methods on the ServerAdministratorsClient type. +type ServerAdministratorsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, properties mysql.ServerAdministratorResource) (result mysql.ServerAdministratorsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serverName string) (result mysql.ServerAdministratorsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serverName string) (result mysql.ServerAdministratorResource, err error) + List(ctx context.Context, resourceGroupName string, serverName string) (result mysql.ServerAdministratorResourceListResult, err error) +} + +var _ ServerAdministratorsClientAPI = (*mysql.ServerAdministratorsClient)(nil) + // LocationBasedPerformanceTierClientAPI contains the set of methods on the LocationBasedPerformanceTierClient type. type LocationBasedPerformanceTierClientAPI interface { List(ctx context.Context, locationName string) (result mysql.PerformanceTierListResult, err error) diff --git a/services/mysql/mgmt/2017-12-01/mysql/serveradministrators.go b/services/mysql/mgmt/2017-12-01/mysql/serveradministrators.go new file mode 100644 index 000000000000..2e283734496d --- /dev/null +++ b/services/mysql/mgmt/2017-12-01/mysql/serveradministrators.go @@ -0,0 +1,400 @@ +package mysql + +// 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" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ServerAdministratorsClient is the the Microsoft Azure management API provides create, read, update, and delete +// functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and +// configurations with new business model. +type ServerAdministratorsClient struct { + BaseClient +} + +// NewServerAdministratorsClient creates an instance of the ServerAdministratorsClient client. +func NewServerAdministratorsClient(subscriptionID string) ServerAdministratorsClient { + return NewServerAdministratorsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServerAdministratorsClientWithBaseURI creates an instance of the ServerAdministratorsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewServerAdministratorsClientWithBaseURI(baseURI string, subscriptionID string) ServerAdministratorsClient { + return ServerAdministratorsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or update active directory administrator on an existing server. The update action will +// overwrite the existing administrator. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// serverName - the name of the server. +// properties - the required parameters for creating or updating an AAD server administrator. +func (client ServerAdministratorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, properties ServerAdministratorResource) (result ServerAdministratorsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerAdministratorsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: properties, + Constraints: []validation.Constraint{{Target: "properties.ServerAdministratorProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "properties.ServerAdministratorProperties.AdministratorType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "properties.ServerAdministratorProperties.Login", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "properties.ServerAdministratorProperties.Sid", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "properties.ServerAdministratorProperties.TenantID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("mysql.ServerAdministratorsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, properties) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServerAdministratorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, properties ServerAdministratorResource) (*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-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/Administrators/activeDirectory", pathParameters), + autorest.WithJSON(properties), + 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 ServerAdministratorsClient) CreateOrUpdateSender(req *http.Request) (future ServerAdministratorsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + 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 ServerAdministratorsClient) CreateOrUpdateResponder(resp *http.Response) (result ServerAdministratorResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes server active directory administrator. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// serverName - the name of the server. +func (client ServerAdministratorsClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServerAdministratorsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerAdministratorsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("mysql.ServerAdministratorsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServerAdministratorsClient) DeletePreparer(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-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/Administrators/activeDirectory", 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 ServerAdministratorsClient) DeleteSender(req *http.Request) (future ServerAdministratorsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + 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 ServerAdministratorsClient) 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 information about a AAD server administrator. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// serverName - the name of the server. +func (client ServerAdministratorsClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerAdministratorResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerAdministratorsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("mysql.ServerAdministratorsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServerAdministratorsClient) GetPreparer(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-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/Administrators/activeDirectory", 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 ServerAdministratorsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServerAdministratorsClient) GetResponder(resp *http.Response) (result ServerAdministratorResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List returns a list of server Administrators. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// serverName - the name of the server. +func (client ServerAdministratorsClient) List(ctx context.Context, resourceGroupName string, serverName string) (result ServerAdministratorResourceListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerAdministratorsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("mysql.ServerAdministratorsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ServerAdministratorsClient) ListPreparer(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-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/administrators", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ServerAdministratorsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ServerAdministratorsClient) ListResponder(resp *http.Response) (result ServerAdministratorResourceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/mysql/mgmt/2017-12-01/mysql/version.go b/services/mysql/mgmt/2017-12-01/mysql/version.go index c59c0a27bf6d..c58430341702 100644 --- a/services/mysql/mgmt/2017-12-01/mysql/version.go +++ b/services/mysql/mgmt/2017-12-01/mysql/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " mysql/2017-12-01" + return "Azure-SDK-For-Go/" + Version() + " mysql/2017-12-01" } // Version returns the semantic version (see http://semver.org) of the client.