Skip to content
Permalink
Fetching contributors…
Cannot retrieve contributors at this time
2081 lines (1896 sloc) 74.4 KB
package postgresql
// 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"
"encoding/json"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/tracing"
"net/http"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2017-12-01-preview/postgresql"
// CreateMode enumerates the values for create mode.
type CreateMode string
const (
// CreateModeDefault ...
CreateModeDefault CreateMode = "Default"
// CreateModeGeoRestore ...
CreateModeGeoRestore CreateMode = "GeoRestore"
// CreateModePointInTimeRestore ...
CreateModePointInTimeRestore CreateMode = "PointInTimeRestore"
// CreateModeReplica ...
CreateModeReplica CreateMode = "Replica"
// CreateModeServerPropertiesForCreate ...
CreateModeServerPropertiesForCreate CreateMode = "ServerPropertiesForCreate"
)
// PossibleCreateModeValues returns an array of possible values for the CreateMode const type.
func PossibleCreateModeValues() []CreateMode {
return []CreateMode{CreateModeDefault, CreateModeGeoRestore, CreateModePointInTimeRestore, CreateModeReplica, CreateModeServerPropertiesForCreate}
}
// GeoRedundantBackup enumerates the values for geo redundant backup.
type GeoRedundantBackup string
const (
// Disabled ...
Disabled GeoRedundantBackup = "Disabled"
// Enabled ...
Enabled GeoRedundantBackup = "Enabled"
)
// PossibleGeoRedundantBackupValues returns an array of possible values for the GeoRedundantBackup const type.
func PossibleGeoRedundantBackupValues() []GeoRedundantBackup {
return []GeoRedundantBackup{Disabled, Enabled}
}
// OperationOrigin enumerates the values for operation origin.
type OperationOrigin string
const (
// NotSpecified ...
NotSpecified OperationOrigin = "NotSpecified"
// System ...
System OperationOrigin = "system"
// User ...
User OperationOrigin = "user"
)
// PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type.
func PossibleOperationOriginValues() []OperationOrigin {
return []OperationOrigin{NotSpecified, System, User}
}
// ServerSecurityAlertPolicyState enumerates the values for server security alert policy state.
type ServerSecurityAlertPolicyState string
const (
// ServerSecurityAlertPolicyStateDisabled ...
ServerSecurityAlertPolicyStateDisabled ServerSecurityAlertPolicyState = "Disabled"
// ServerSecurityAlertPolicyStateEnabled ...
ServerSecurityAlertPolicyStateEnabled ServerSecurityAlertPolicyState = "Enabled"
)
// PossibleServerSecurityAlertPolicyStateValues returns an array of possible values for the ServerSecurityAlertPolicyState const type.
func PossibleServerSecurityAlertPolicyStateValues() []ServerSecurityAlertPolicyState {
return []ServerSecurityAlertPolicyState{ServerSecurityAlertPolicyStateDisabled, ServerSecurityAlertPolicyStateEnabled}
}
// ServerState enumerates the values for server state.
type ServerState string
const (
// ServerStateDisabled ...
ServerStateDisabled ServerState = "Disabled"
// ServerStateDropping ...
ServerStateDropping ServerState = "Dropping"
// ServerStateReady ...
ServerStateReady ServerState = "Ready"
)
// PossibleServerStateValues returns an array of possible values for the ServerState const type.
func PossibleServerStateValues() []ServerState {
return []ServerState{ServerStateDisabled, ServerStateDropping, ServerStateReady}
}
// ServerVersion enumerates the values for server version.
type ServerVersion string
const (
// NineFullStopFive ...
NineFullStopFive ServerVersion = "9.5"
// NineFullStopSix ...
NineFullStopSix ServerVersion = "9.6"
// OneOne ...
OneOne ServerVersion = "11"
// OneZero ...
OneZero ServerVersion = "10"
// OneZeroFullStopTwo ...
OneZeroFullStopTwo ServerVersion = "10.2"
// OneZeroFullStopZero ...
OneZeroFullStopZero ServerVersion = "10.0"
)
// PossibleServerVersionValues returns an array of possible values for the ServerVersion const type.
func PossibleServerVersionValues() []ServerVersion {
return []ServerVersion{NineFullStopFive, NineFullStopSix, OneOne, OneZero, OneZeroFullStopTwo, OneZeroFullStopZero}
}
// SkuTier enumerates the values for sku tier.
type SkuTier string
const (
// Basic ...
Basic SkuTier = "Basic"
// GeneralPurpose ...
GeneralPurpose SkuTier = "GeneralPurpose"
// MemoryOptimized ...
MemoryOptimized SkuTier = "MemoryOptimized"
)
// PossibleSkuTierValues returns an array of possible values for the SkuTier const type.
func PossibleSkuTierValues() []SkuTier {
return []SkuTier{Basic, GeneralPurpose, MemoryOptimized}
}
// SslEnforcementEnum enumerates the values for ssl enforcement enum.
type SslEnforcementEnum string
const (
// SslEnforcementEnumDisabled ...
SslEnforcementEnumDisabled SslEnforcementEnum = "Disabled"
// SslEnforcementEnumEnabled ...
SslEnforcementEnumEnabled SslEnforcementEnum = "Enabled"
)
// PossibleSslEnforcementEnumValues returns an array of possible values for the SslEnforcementEnum const type.
func PossibleSslEnforcementEnumValues() []SslEnforcementEnum {
return []SslEnforcementEnum{SslEnforcementEnumDisabled, SslEnforcementEnumEnabled}
}
// StorageAutogrow enumerates the values for storage autogrow.
type StorageAutogrow string
const (
// StorageAutogrowDisabled ...
StorageAutogrowDisabled StorageAutogrow = "Disabled"
// StorageAutogrowEnabled ...
StorageAutogrowEnabled StorageAutogrow = "Enabled"
)
// PossibleStorageAutogrowValues returns an array of possible values for the StorageAutogrow const type.
func PossibleStorageAutogrowValues() []StorageAutogrow {
return []StorageAutogrow{StorageAutogrowDisabled, StorageAutogrowEnabled}
}
// VirtualNetworkRuleState enumerates the values for virtual network rule state.
type VirtualNetworkRuleState string
const (
// Deleting ...
Deleting VirtualNetworkRuleState = "Deleting"
// Initializing ...
Initializing VirtualNetworkRuleState = "Initializing"
// InProgress ...
InProgress VirtualNetworkRuleState = "InProgress"
// Ready ...
Ready VirtualNetworkRuleState = "Ready"
// Unknown ...
Unknown VirtualNetworkRuleState = "Unknown"
)
// PossibleVirtualNetworkRuleStateValues returns an array of possible values for the VirtualNetworkRuleState const type.
func PossibleVirtualNetworkRuleStateValues() []VirtualNetworkRuleState {
return []VirtualNetworkRuleState{Deleting, Initializing, InProgress, Ready, Unknown}
}
// CloudError an error response from the Batch service.
type CloudError struct {
Error *CloudErrorBody `json:"error,omitempty"`
}
// CloudErrorBody an error response from the Batch service.
type CloudErrorBody struct {
// Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically.
Code *string `json:"code,omitempty"`
// Message - A message describing the error, intended to be suitable for display in a user interface.
Message *string `json:"message,omitempty"`
// Target - The target of the particular error. For example, the name of the property in error.
Target *string `json:"target,omitempty"`
// Details - A list of additional details about the error.
Details *[]CloudErrorBody `json:"details,omitempty"`
}
// Configuration represents a Configuration.
type Configuration struct {
autorest.Response `json:"-"`
// ConfigurationProperties - The properties of a configuration.
*ConfigurationProperties `json:"properties,omitempty"`
// ID - READ-ONLY; Resource ID
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for Configuration.
func (c Configuration) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if c.ConfigurationProperties != nil {
objectMap["properties"] = c.ConfigurationProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Configuration struct.
func (c *Configuration) 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 configurationProperties ConfigurationProperties
err = json.Unmarshal(*v, &configurationProperties)
if err != nil {
return err
}
c.ConfigurationProperties = &configurationProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
c.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
c.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
c.Type = &typeVar
}
}
}
return nil
}
// ConfigurationListResult a list of server configurations.
type ConfigurationListResult struct {
autorest.Response `json:"-"`
// Value - The list of server configurations.
Value *[]Configuration `json:"value,omitempty"`
}
// ConfigurationProperties the properties of a configuration.
type ConfigurationProperties struct {
// Value - Value of the configuration.
Value *string `json:"value,omitempty"`
// Description - READ-ONLY; Description of the configuration.
Description *string `json:"description,omitempty"`
// DefaultValue - READ-ONLY; Default value of the configuration.
DefaultValue *string `json:"defaultValue,omitempty"`
// DataType - READ-ONLY; Data type of the configuration.
DataType *string `json:"dataType,omitempty"`
// AllowedValues - READ-ONLY; Allowed values of the configuration.
AllowedValues *string `json:"allowedValues,omitempty"`
// Source - Source of the configuration.
Source *string `json:"source,omitempty"`
}
// ConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
// long-running operation.
type ConfigurationsCreateOrUpdateFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *ConfigurationsCreateOrUpdateFuture) Result(client ConfigurationsClient) (c Configuration, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("postgresql.ConfigurationsCreateOrUpdateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent {
c, err = client.CreateOrUpdateResponder(c.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request")
}
}
return
}
// Database represents a Database.
type Database struct {
autorest.Response `json:"-"`
// DatabaseProperties - The properties of a database.
*DatabaseProperties `json:"properties,omitempty"`
// ID - READ-ONLY; Resource ID
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for Database.
func (d Database) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if d.DatabaseProperties != nil {
objectMap["properties"] = d.DatabaseProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Database struct.
func (d *Database) 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 databaseProperties DatabaseProperties
err = json.Unmarshal(*v, &databaseProperties)
if err != nil {
return err
}
d.DatabaseProperties = &databaseProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
d.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
d.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
d.Type = &typeVar
}
}
}
return nil
}
// DatabaseListResult a List of databases.
type DatabaseListResult struct {
autorest.Response `json:"-"`
// Value - The list of databases housed in a server
Value *[]Database `json:"value,omitempty"`
}
// DatabaseProperties the properties of a database.
type DatabaseProperties struct {
// Charset - The charset of the database.
Charset *string `json:"charset,omitempty"`
// Collation - The collation of the database.
Collation *string `json:"collation,omitempty"`
}
// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type DatabasesCreateOrUpdateFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Database, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("postgresql.DatabasesCreateOrUpdateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent {
d, err = client.CreateOrUpdateResponder(d.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request")
}
}
return
}
// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type DatabasesDeleteFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *DatabasesDeleteFuture) Result(client DatabasesClient) (ar autorest.Response, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("postgresql.DatabasesDeleteFuture")
return
}
ar.Response = future.Response()
return
}
// FirewallRule represents a server firewall rule.
type FirewallRule struct {
autorest.Response `json:"-"`
// FirewallRuleProperties - The properties of a firewall rule.
*FirewallRuleProperties `json:"properties,omitempty"`
// ID - READ-ONLY; Resource ID
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for FirewallRule.
func (fr FirewallRule) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if fr.FirewallRuleProperties != nil {
objectMap["properties"] = fr.FirewallRuleProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for FirewallRule struct.
func (fr *FirewallRule) 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 firewallRuleProperties FirewallRuleProperties
err = json.Unmarshal(*v, &firewallRuleProperties)
if err != nil {
return err
}
fr.FirewallRuleProperties = &firewallRuleProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
fr.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
fr.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
fr.Type = &typeVar
}
}
}
return nil
}
// FirewallRuleListResult a list of firewall rules.
type FirewallRuleListResult struct {
autorest.Response `json:"-"`
// Value - The list of firewall rules in a server.
Value *[]FirewallRule `json:"value,omitempty"`
}
// FirewallRuleProperties the properties of a server firewall rule.
type FirewallRuleProperties struct {
// StartIPAddress - The start IP address of the server firewall rule. Must be IPv4 format.
StartIPAddress *string `json:"startIpAddress,omitempty"`
// EndIPAddress - The end IP address of the server firewall rule. Must be IPv4 format.
EndIPAddress *string `json:"endIpAddress,omitempty"`
}
// FirewallRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
// long-running operation.
type FirewallRulesCreateOrUpdateFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *FirewallRulesCreateOrUpdateFuture) Result(client FirewallRulesClient) (fr FirewallRule, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("postgresql.FirewallRulesCreateOrUpdateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if fr.Response.Response, err = future.GetResult(sender); err == nil && fr.Response.Response.StatusCode != http.StatusNoContent {
fr, err = client.CreateOrUpdateResponder(fr.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesCreateOrUpdateFuture", "Result", fr.Response.Response, "Failure responding to request")
}
}
return
}
// FirewallRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type FirewallRulesDeleteFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *FirewallRulesDeleteFuture) Result(client FirewallRulesClient) (ar autorest.Response, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesDeleteFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("postgresql.FirewallRulesDeleteFuture")
return
}
ar.Response = future.Response()
return
}
// LogFile represents a log file.
type LogFile struct {
// LogFileProperties - The properties of the log file.
*LogFileProperties `json:"properties,omitempty"`
// ID - READ-ONLY; Resource ID
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for LogFile.
func (lf LogFile) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if lf.LogFileProperties != nil {
objectMap["properties"] = lf.LogFileProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for LogFile struct.
func (lf *LogFile) 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 logFileProperties LogFileProperties
err = json.Unmarshal(*v, &logFileProperties)
if err != nil {
return err
}
lf.LogFileProperties = &logFileProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
lf.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
lf.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
lf.Type = &typeVar
}
}
}
return nil
}
// LogFileListResult a list of log files.
type LogFileListResult struct {
autorest.Response `json:"-"`
// Value - The list of log files.
Value *[]LogFile `json:"value,omitempty"`
}
// LogFileProperties the properties of a log file.
type LogFileProperties struct {
// SizeInKB - Size of the log file.
SizeInKB *int64 `json:"sizeInKB,omitempty"`
// CreatedTime - READ-ONLY; Creation timestamp of the log file.
CreatedTime *date.Time `json:"createdTime,omitempty"`
// LastModifiedTime - READ-ONLY; Last modified timestamp of the log file.
LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"`
// Type - Type of the log file.
Type *string `json:"type,omitempty"`
// URL - The url to download the log file from.
URL *string `json:"url,omitempty"`
}
// NameAvailability represents a resource name availability.
type NameAvailability struct {
autorest.Response `json:"-"`
// Message - Error Message.
Message *string `json:"message,omitempty"`
// NameAvailable - Indicates whether the resource name is available.
NameAvailable *bool `json:"nameAvailable,omitempty"`
// Reason - Reason for name being unavailable.
Reason *string `json:"reason,omitempty"`
}
// NameAvailabilityRequest request from client to check resource name availability.
type NameAvailabilityRequest struct {
// Name - Resource name to verify.
Name *string `json:"name,omitempty"`
// Type - Resource type used for verification.
Type *string `json:"type,omitempty"`
}
// Operation REST API operation definition.
type Operation struct {
// Name - READ-ONLY; The name of the operation being performed on this particular object.
Name *string `json:"name,omitempty"`
// Display - READ-ONLY; The localized display information for this particular operation or action.
Display *OperationDisplay `json:"display,omitempty"`
// Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'NotSpecified', 'User', 'System'
Origin OperationOrigin `json:"origin,omitempty"`
// Properties - READ-ONLY; Additional descriptions for the operation.
Properties map[string]interface{} `json:"properties"`
}
// MarshalJSON is the custom marshaler for Operation.
func (o Operation) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// OperationDisplay display metadata associated with the operation.
type OperationDisplay struct {
// Provider - READ-ONLY; Operation resource provider name.
Provider *string `json:"provider,omitempty"`
// Resource - READ-ONLY; Resource on which the operation is performed.
Resource *string `json:"resource,omitempty"`
// Operation - READ-ONLY; Localized friendly name for the operation.
Operation *string `json:"operation,omitempty"`
// Description - READ-ONLY; Operation description.
Description *string `json:"description,omitempty"`
}
// OperationListResult a list of resource provider operations.
type OperationListResult struct {
autorest.Response `json:"-"`
// Value - The list of resource provider operations.
Value *[]Operation `json:"value,omitempty"`
}
// PerformanceTierListResult a list of performance tiers.
type PerformanceTierListResult struct {
autorest.Response `json:"-"`
// Value - The list of performance tiers
Value *[]PerformanceTierProperties `json:"value,omitempty"`
}
// PerformanceTierProperties performance tier properties
type PerformanceTierProperties struct {
// ID - ID of the performance tier.
ID *string `json:"id,omitempty"`
// ServiceLevelObjectives - Service level objectives associated with the performance tier
ServiceLevelObjectives *[]PerformanceTierServiceLevelObjectives `json:"serviceLevelObjectives,omitempty"`
}
// PerformanceTierServiceLevelObjectives service level objectives for performance tier.
type PerformanceTierServiceLevelObjectives struct {
// ID - ID for the service level objective.
ID *string `json:"id,omitempty"`
// Edition - Edition of the performance tier.
Edition *string `json:"edition,omitempty"`
// VCore - vCore associated with the service level objective
VCore *int32 `json:"vCore,omitempty"`
// HardwareGeneration - Hardware generation associated with the service level objective
HardwareGeneration *string `json:"hardwareGeneration,omitempty"`
// MaxBackupRetentionDays - Maximum Backup retention in days for the performance tier edition
MaxBackupRetentionDays *int32 `json:"maxBackupRetentionDays,omitempty"`
// MinBackupRetentionDays - Minimum Backup retention in days for the performance tier edition
MinBackupRetentionDays *int32 `json:"minBackupRetentionDays,omitempty"`
// MaxStorageMB - Max storage allowed for a server.
MaxStorageMB *int32 `json:"maxStorageMB,omitempty"`
// MinStorageMB - Max storage allowed for a server.
MinStorageMB *int32 `json:"minStorageMB,omitempty"`
}
// ProxyResource resource properties.
type ProxyResource struct {
// ID - READ-ONLY; Resource ID
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,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'
State ServerSecurityAlertPolicyState `json:"state,omitempty"`
// DisabledAlerts - Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly
DisabledAlerts *[]string `json:"disabledAlerts,omitempty"`
// EmailAddresses - Specifies an array of e-mail addresses to which the alert is sent.
EmailAddresses *[]string `json:"emailAddresses,omitempty"`
// EmailAccountAdmins - Specifies that the alert is sent to the account administrators.
EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"`
// StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.
StorageEndpoint *string `json:"storageEndpoint,omitempty"`
// StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account.
StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"`
// RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs.
RetentionDays *int32 `json:"retentionDays,omitempty"`
}
// Server represents a server.
type Server struct {
autorest.Response `json:"-"`
// Sku - The SKU (pricing tier) of the server.
Sku *Sku `json:"sku,omitempty"`
// ServerProperties - Properties of the server.
*ServerProperties `json:"properties,omitempty"`
// Location - The location the resource resides in.
Location *string `json:"location,omitempty"`
// Tags - Application-specific metadata in the form of key-value pairs.
Tags map[string]*string `json:"tags"`
// ID - READ-ONLY; Resource ID
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for Server.
func (s Server) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if s.Sku != nil {
objectMap["sku"] = s.Sku
}
if s.ServerProperties != nil {
objectMap["properties"] = s.ServerProperties
}
if s.Location != nil {
objectMap["location"] = s.Location
}
if s.Tags != nil {
objectMap["tags"] = s.Tags
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Server struct.
func (s *Server) 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 "sku":
if v != nil {
var sku Sku
err = json.Unmarshal(*v, &sku)
if err != nil {
return err
}
s.Sku = &sku
}
case "properties":
if v != nil {
var serverProperties ServerProperties
err = json.Unmarshal(*v, &serverProperties)
if err != nil {
return err
}
s.ServerProperties = &serverProperties
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
s.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
s.Tags = tags
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
s.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
s.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
s.Type = &typeVar
}
}
}
return nil
}
// ServerForCreate represents a server to be created.
type ServerForCreate struct {
// Sku - The SKU (pricing tier) of the server.
Sku *Sku `json:"sku,omitempty"`
// Properties - Properties of the server.
Properties BasicServerPropertiesForCreate `json:"properties,omitempty"`
// Location - The location the resource resides in.
Location *string `json:"location,omitempty"`
// Tags - Application-specific metadata in the form of key-value pairs.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for ServerForCreate.
func (sfc ServerForCreate) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if sfc.Sku != nil {
objectMap["sku"] = sfc.Sku
}
objectMap["properties"] = sfc.Properties
if sfc.Location != nil {
objectMap["location"] = sfc.Location
}
if sfc.Tags != nil {
objectMap["tags"] = sfc.Tags
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ServerForCreate struct.
func (sfc *ServerForCreate) 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 "sku":
if v != nil {
var sku Sku
err = json.Unmarshal(*v, &sku)
if err != nil {
return err
}
sfc.Sku = &sku
}
case "properties":
if v != nil {
properties, err := unmarshalBasicServerPropertiesForCreate(*v)
if err != nil {
return err
}
sfc.Properties = properties
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
sfc.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
sfc.Tags = tags
}
}
}
return nil
}
// ServerListResult a list of servers.
type ServerListResult struct {
autorest.Response `json:"-"`
// Value - The list of servers
Value *[]Server `json:"value,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).
AdministratorLogin *string `json:"administratorLogin,omitempty"`
// Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix', 'OneZero', 'OneZeroFullStopZero', 'OneZeroFullStopTwo', 'OneOne'
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'
UserVisibleState ServerState `json:"userVisibleState,omitempty"`
// FullyQualifiedDomainName - The fully qualified domain name of a server.
FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`
// EarliestRestoreDate - Earliest restore point creation time (ISO8601 format)
EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"`
// StorageProfile - Storage profile of a server.
StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
// ReplicationRole - The replication role of the server.
ReplicationRole *string `json:"replicationRole,omitempty"`
// MasterServerID - The master server id of a replica server.
MasterServerID *string `json:"masterServerId,omitempty"`
// ReplicaCapacity - The maximum number of replicas that a master server can have.
ReplicaCapacity *int32 `json:"replicaCapacity,omitempty"`
}
// BasicServerPropertiesForCreate the properties used to create a new server.
type BasicServerPropertiesForCreate interface {
AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool)
AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool)
AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool)
AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool)
AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool)
}
// ServerPropertiesForCreate the properties used to create a new server.
type ServerPropertiesForCreate struct {
// Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix', 'OneZero', 'OneZeroFullStopZero', 'OneZeroFullStopTwo', 'OneOne'
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"`
// StorageProfile - Storage profile of a server.
StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
// CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica'
CreateMode CreateMode `json:"createMode,omitempty"`
}
func unmarshalBasicServerPropertiesForCreate(body []byte) (BasicServerPropertiesForCreate, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["createMode"] {
case string(CreateModeDefault):
var spfdc ServerPropertiesForDefaultCreate
err := json.Unmarshal(body, &spfdc)
return spfdc, err
case string(CreateModePointInTimeRestore):
var spfr ServerPropertiesForRestore
err := json.Unmarshal(body, &spfr)
return spfr, err
case string(CreateModeGeoRestore):
var spfgr ServerPropertiesForGeoRestore
err := json.Unmarshal(body, &spfgr)
return spfgr, err
case string(CreateModeReplica):
var spfr ServerPropertiesForReplica
err := json.Unmarshal(body, &spfr)
return spfr, err
default:
var spfc ServerPropertiesForCreate
err := json.Unmarshal(body, &spfc)
return spfc, err
}
}
func unmarshalBasicServerPropertiesForCreateArray(body []byte) ([]BasicServerPropertiesForCreate, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
spfcArray := make([]BasicServerPropertiesForCreate, len(rawMessages))
for index, rawMessage := range rawMessages {
spfc, err := unmarshalBasicServerPropertiesForCreate(*rawMessage)
if err != nil {
return nil, err
}
spfcArray[index] = spfc
}
return spfcArray, nil
}
// MarshalJSON is the custom marshaler for ServerPropertiesForCreate.
func (spfc ServerPropertiesForCreate) MarshalJSON() ([]byte, error) {
spfc.CreateMode = CreateModeServerPropertiesForCreate
objectMap := make(map[string]interface{})
if spfc.Version != "" {
objectMap["version"] = spfc.Version
}
if spfc.SslEnforcement != "" {
objectMap["sslEnforcement"] = spfc.SslEnforcement
}
if spfc.StorageProfile != nil {
objectMap["storageProfile"] = spfc.StorageProfile
}
if spfc.CreateMode != "" {
objectMap["createMode"] = spfc.CreateMode
}
return json.Marshal(objectMap)
}
// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate.
func (spfc ServerPropertiesForCreate) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) {
return nil, false
}
// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate.
func (spfc ServerPropertiesForCreate) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) {
return nil, false
}
// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate.
func (spfc ServerPropertiesForCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) {
return nil, false
}
// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate.
func (spfc ServerPropertiesForCreate) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) {
return nil, false
}
// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate.
func (spfc ServerPropertiesForCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) {
return &spfc, true
}
// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate.
func (spfc ServerPropertiesForCreate) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) {
return &spfc, true
}
// ServerPropertiesForDefaultCreate the properties used to create a new server.
type ServerPropertiesForDefaultCreate 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).
AdministratorLogin *string `json:"administratorLogin,omitempty"`
// AdministratorLoginPassword - The password of the administrator login.
AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
// Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix', 'OneZero', 'OneZeroFullStopZero', 'OneZeroFullStopTwo', 'OneOne'
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"`
// StorageProfile - Storage profile of a server.
StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
// CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica'
CreateMode CreateMode `json:"createMode,omitempty"`
}
// MarshalJSON is the custom marshaler for ServerPropertiesForDefaultCreate.
func (spfdc ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) {
spfdc.CreateMode = CreateModeDefault
objectMap := make(map[string]interface{})
if spfdc.AdministratorLogin != nil {
objectMap["administratorLogin"] = spfdc.AdministratorLogin
}
if spfdc.AdministratorLoginPassword != nil {
objectMap["administratorLoginPassword"] = spfdc.AdministratorLoginPassword
}
if spfdc.Version != "" {
objectMap["version"] = spfdc.Version
}
if spfdc.SslEnforcement != "" {
objectMap["sslEnforcement"] = spfdc.SslEnforcement
}
if spfdc.StorageProfile != nil {
objectMap["storageProfile"] = spfdc.StorageProfile
}
if spfdc.CreateMode != "" {
objectMap["createMode"] = spfdc.CreateMode
}
return json.Marshal(objectMap)
}
// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate.
func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) {
return &spfdc, true
}
// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate.
func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) {
return nil, false
}
// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate.
func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) {
return nil, false
}
// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate.
func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) {
return nil, false
}
// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate.
func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) {
return nil, false
}
// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate.
func (spfdc ServerPropertiesForDefaultCreate) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) {
return &spfdc, true
}
// ServerPropertiesForGeoRestore the properties used to create a new server by restoring to a different
// region from a geo replicated backup.
type ServerPropertiesForGeoRestore struct {
// SourceServerID - The source server id to restore from.
SourceServerID *string `json:"sourceServerId,omitempty"`
// Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix', 'OneZero', 'OneZeroFullStopZero', 'OneZeroFullStopTwo', 'OneOne'
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"`
// StorageProfile - Storage profile of a server.
StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
// CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica'
CreateMode CreateMode `json:"createMode,omitempty"`
}
// MarshalJSON is the custom marshaler for ServerPropertiesForGeoRestore.
func (spfgr ServerPropertiesForGeoRestore) MarshalJSON() ([]byte, error) {
spfgr.CreateMode = CreateModeGeoRestore
objectMap := make(map[string]interface{})
if spfgr.SourceServerID != nil {
objectMap["sourceServerId"] = spfgr.SourceServerID
}
if spfgr.Version != "" {
objectMap["version"] = spfgr.Version
}
if spfgr.SslEnforcement != "" {
objectMap["sslEnforcement"] = spfgr.SslEnforcement
}
if spfgr.StorageProfile != nil {
objectMap["storageProfile"] = spfgr.StorageProfile
}
if spfgr.CreateMode != "" {
objectMap["createMode"] = spfgr.CreateMode
}
return json.Marshal(objectMap)
}
// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore.
func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) {
return nil, false
}
// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore.
func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) {
return nil, false
}
// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore.
func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) {
return &spfgr, true
}
// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore.
func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) {
return nil, false
}
// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore.
func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) {
return nil, false
}
// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore.
func (spfgr ServerPropertiesForGeoRestore) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) {
return &spfgr, true
}
// ServerPropertiesForReplica the properties to create a new replica.
type ServerPropertiesForReplica struct {
// SourceServerID - The master server id to create replica from.
SourceServerID *string `json:"sourceServerId,omitempty"`
// Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix', 'OneZero', 'OneZeroFullStopZero', 'OneZeroFullStopTwo', 'OneOne'
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"`
// StorageProfile - Storage profile of a server.
StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
// CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica'
CreateMode CreateMode `json:"createMode,omitempty"`
}
// MarshalJSON is the custom marshaler for ServerPropertiesForReplica.
func (spfr ServerPropertiesForReplica) MarshalJSON() ([]byte, error) {
spfr.CreateMode = CreateModeReplica
objectMap := make(map[string]interface{})
if spfr.SourceServerID != nil {
objectMap["sourceServerId"] = spfr.SourceServerID
}
if spfr.Version != "" {
objectMap["version"] = spfr.Version
}
if spfr.SslEnforcement != "" {
objectMap["sslEnforcement"] = spfr.SslEnforcement
}
if spfr.StorageProfile != nil {
objectMap["storageProfile"] = spfr.StorageProfile
}
if spfr.CreateMode != "" {
objectMap["createMode"] = spfr.CreateMode
}
return json.Marshal(objectMap)
}
// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica.
func (spfr ServerPropertiesForReplica) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) {
return nil, false
}
// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica.
func (spfr ServerPropertiesForReplica) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) {
return nil, false
}
// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica.
func (spfr ServerPropertiesForReplica) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) {
return nil, false
}
// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica.
func (spfr ServerPropertiesForReplica) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) {
return &spfr, true
}
// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica.
func (spfr ServerPropertiesForReplica) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) {
return nil, false
}
// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica.
func (spfr ServerPropertiesForReplica) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) {
return &spfr, true
}
// ServerPropertiesForRestore the properties used to create a new server by restoring from a backup.
type ServerPropertiesForRestore struct {
// SourceServerID - The source server id to restore from.
SourceServerID *string `json:"sourceServerId,omitempty"`
// RestorePointInTime - Restore point creation time (ISO8601 format), specifying the time to restore from.
RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"`
// Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix', 'OneZero', 'OneZeroFullStopZero', 'OneZeroFullStopTwo', 'OneOne'
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"`
// StorageProfile - Storage profile of a server.
StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
// CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica'
CreateMode CreateMode `json:"createMode,omitempty"`
}
// MarshalJSON is the custom marshaler for ServerPropertiesForRestore.
func (spfr ServerPropertiesForRestore) MarshalJSON() ([]byte, error) {
spfr.CreateMode = CreateModePointInTimeRestore
objectMap := make(map[string]interface{})
if spfr.SourceServerID != nil {
objectMap["sourceServerId"] = spfr.SourceServerID
}
if spfr.RestorePointInTime != nil {
objectMap["restorePointInTime"] = spfr.RestorePointInTime
}
if spfr.Version != "" {
objectMap["version"] = spfr.Version
}
if spfr.SslEnforcement != "" {
objectMap["sslEnforcement"] = spfr.SslEnforcement
}
if spfr.StorageProfile != nil {
objectMap["storageProfile"] = spfr.StorageProfile
}
if spfr.CreateMode != "" {
objectMap["createMode"] = spfr.CreateMode
}
return json.Marshal(objectMap)
}
// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore.
func (spfr ServerPropertiesForRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) {
return nil, false
}
// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore.
func (spfr ServerPropertiesForRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) {
return &spfr, true
}
// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore.
func (spfr ServerPropertiesForRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) {
return nil, false
}
// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore.
func (spfr ServerPropertiesForRestore) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) {
return nil, false
}
// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore.
func (spfr ServerPropertiesForRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) {
return nil, false
}
// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore.
func (spfr ServerPropertiesForRestore) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) {
return &spfr, true
}
// ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type ServersCreateFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *ServersCreateFuture) Result(client ServersClient) (s Server, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.ServersCreateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("postgresql.ServersCreateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
s, err = client.CreateResponder(s.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request")
}
}
return
}
// ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type ServersDeleteFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *ServersDeleteFuture) Result(client ServersClient) (ar autorest.Response, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.ServersDeleteFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("postgresql.ServersDeleteFuture")
return
}
ar.Response = future.Response()
return
}
// ServerSecurityAlertPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results
// of a long-running operation.
type ServerSecurityAlertPoliciesCreateOrUpdateFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) Result(client ServerSecurityAlertPoliciesClient) (ssap ServerSecurityAlertPolicy, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("postgresql.ServerSecurityAlertPoliciesCreateOrUpdateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if ssap.Response.Response, err = future.GetResult(sender); err == nil && ssap.Response.Response.StatusCode != http.StatusNoContent {
ssap, err = client.CreateOrUpdateResponder(ssap.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", ssap.Response.Response, "Failure responding to request")
}
}
return
}
// ServerSecurityAlertPolicy a server security alert policy.
type ServerSecurityAlertPolicy struct {
autorest.Response `json:"-"`
// SecurityAlertPolicyProperties - Resource properties.
*SecurityAlertPolicyProperties `json:"properties,omitempty"`
// ID - READ-ONLY; Resource ID
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicy.
func (ssap ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ssap.SecurityAlertPolicyProperties != nil {
objectMap["properties"] = ssap.SecurityAlertPolicyProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ServerSecurityAlertPolicy struct.
func (ssap *ServerSecurityAlertPolicy) 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 securityAlertPolicyProperties SecurityAlertPolicyProperties
err = json.Unmarshal(*v, &securityAlertPolicyProperties)
if err != nil {
return err
}
ssap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
ssap.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
ssap.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
ssap.Type = &typeVar
}
}
}
return nil
}
// ServersRestartFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type ServersRestartFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *ServersRestartFuture) Result(client ServersClient) (ar autorest.Response, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.ServersRestartFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("postgresql.ServersRestartFuture")
return
}
ar.Response = future.Response()
return
}
// ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type ServersUpdateFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *ServersUpdateFuture) Result(client ServersClient) (s Server, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.ServersUpdateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("postgresql.ServersUpdateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
s, err = client.UpdateResponder(s.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request")
}
}
return
}
// ServerUpdateParameters parameters allowed to update for a server.
type ServerUpdateParameters struct {
// Sku - The SKU (pricing tier) of the server.
Sku *Sku `json:"sku,omitempty"`
// ServerUpdateParametersProperties - The properties that can be updated for a server.
*ServerUpdateParametersProperties `json:"properties,omitempty"`
// Tags - Application-specific metadata in the form of key-value pairs.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for ServerUpdateParameters.
func (sup ServerUpdateParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if sup.Sku != nil {
objectMap["sku"] = sup.Sku
}
if sup.ServerUpdateParametersProperties != nil {
objectMap["properties"] = sup.ServerUpdateParametersProperties
}
if sup.Tags != nil {
objectMap["tags"] = sup.Tags
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ServerUpdateParameters struct.
func (sup *ServerUpdateParameters) 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 "sku":
if v != nil {
var sku Sku
err = json.Unmarshal(*v, &sku)
if err != nil {
return err
}
sup.Sku = &sku
}
case "properties":
if v != nil {
var serverUpdateParametersProperties ServerUpdateParametersProperties
err = json.Unmarshal(*v, &serverUpdateParametersProperties)
if err != nil {
return err
}
sup.ServerUpdateParametersProperties = &serverUpdateParametersProperties
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
sup.Tags = tags
}
}
}
return nil
}
// ServerUpdateParametersProperties the properties that can be updated for a server.
type ServerUpdateParametersProperties struct {
// StorageProfile - Storage profile of a server.
StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
// AdministratorLoginPassword - The password of the administrator login.
AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
// Version - The version of a server. Possible values include: 'NineFullStopFive', 'NineFullStopSix', 'OneZero', 'OneZeroFullStopZero', 'OneZeroFullStopTwo', 'OneOne'
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"`
// ReplicationRole - The replication role of the server.
ReplicationRole *string `json:"replicationRole,omitempty"`
}
// Sku billing information related properties of a server.
type Sku struct {
// Name - The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8.
Name *string `json:"name,omitempty"`
// Tier - The tier of the particular SKU, e.g. Basic. Possible values include: 'Basic', 'GeneralPurpose', 'MemoryOptimized'
Tier SkuTier `json:"tier,omitempty"`
// Capacity - The scale up/out capacity, representing server's compute units.
Capacity *int32 `json:"capacity,omitempty"`
// Size - The size code, to be interpreted by resource as appropriate.
Size *string `json:"size,omitempty"`
// Family - The family of hardware.
Family *string `json:"family,omitempty"`
}
// StorageProfile storage Profile properties of a server
type StorageProfile struct {
// BackupRetentionDays - Backup retention days for the server.
BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"`
// GeoRedundantBackup - Enable Geo-redundant or not for server backup. Possible values include: 'Enabled', 'Disabled'
GeoRedundantBackup GeoRedundantBackup `json:"geoRedundantBackup,omitempty"`
// StorageMB - Max storage allowed for a server.
StorageMB *int32 `json:"storageMB,omitempty"`
// StorageAutogrow - Enable Storage Auto Grow. Possible values include: 'StorageAutogrowEnabled', 'StorageAutogrowDisabled'
StorageAutogrow StorageAutogrow `json:"storageAutogrow,omitempty"`
}
// TrackedResource resource properties including location and tags for track resources.
type TrackedResource struct {
// Location - The location the resource resides in.
Location *string `json:"location,omitempty"`
// Tags - Application-specific metadata in the form of key-value pairs.
Tags map[string]*string `json:"tags"`
// ID - READ-ONLY; Resource ID
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for TrackedResource.
func (tr TrackedResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if tr.Location != nil {
objectMap["location"] = tr.Location
}
if tr.Tags != nil {
objectMap["tags"] = tr.Tags
}
return json.Marshal(objectMap)
}
// VirtualNetworkRule a virtual network rule.
type VirtualNetworkRule struct {
autorest.Response `json:"-"`
// VirtualNetworkRuleProperties - Resource properties.
*VirtualNetworkRuleProperties `json:"properties,omitempty"`
// ID - READ-ONLY; Resource ID
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type.
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for VirtualNetworkRule.
func (vnr VirtualNetworkRule) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if vnr.VirtualNetworkRuleProperties != nil {
objectMap["properties"] = vnr.VirtualNetworkRuleProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for VirtualNetworkRule struct.
func (vnr *VirtualNetworkRule) 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 virtualNetworkRuleProperties VirtualNetworkRuleProperties
err = json.Unmarshal(*v, &virtualNetworkRuleProperties)
if err != nil {
return err
}
vnr.VirtualNetworkRuleProperties = &virtualNetworkRuleProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
vnr.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
vnr.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
vnr.Type = &typeVar
}
}
}
return nil
}
// VirtualNetworkRuleListResult a list of virtual network rules.
type VirtualNetworkRuleListResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; Array of results.
Value *[]VirtualNetworkRule `json:"value,omitempty"`
// NextLink - READ-ONLY; Link to retrieve next page of results.
NextLink *string `json:"nextLink,omitempty"`
}
// VirtualNetworkRuleListResultIterator provides access to a complete listing of VirtualNetworkRule values.
type VirtualNetworkRuleListResultIterator struct {
i int
page VirtualNetworkRuleListResultPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *VirtualNetworkRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *VirtualNetworkRuleListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter VirtualNetworkRuleListResultIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter VirtualNetworkRuleListResultIterator) Response() VirtualNetworkRuleListResult {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter VirtualNetworkRuleListResultIterator) Value() VirtualNetworkRule {
if !iter.page.NotDone() {
return VirtualNetworkRule{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the VirtualNetworkRuleListResultIterator type.
func NewVirtualNetworkRuleListResultIterator(page VirtualNetworkRuleListResultPage) VirtualNetworkRuleListResultIterator {
return VirtualNetworkRuleListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (vnrlr VirtualNetworkRuleListResult) IsEmpty() bool {
return vnrlr.Value == nil || len(*vnrlr.Value) == 0
}
// virtualNetworkRuleListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (vnrlr VirtualNetworkRuleListResult) virtualNetworkRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
if vnrlr.NextLink == nil || len(to.String(vnrlr.NextLink)) < 1 {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(vnrlr.NextLink)))
}
// VirtualNetworkRuleListResultPage contains a page of VirtualNetworkRule values.
type VirtualNetworkRuleListResultPage struct {
fn func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error)
vnrlr VirtualNetworkRuleListResult
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *VirtualNetworkRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.vnrlr)
if err != nil {
return err
}
page.vnrlr = next
return nil
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (page *VirtualNetworkRuleListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page VirtualNetworkRuleListResultPage) NotDone() bool {
return !page.vnrlr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page VirtualNetworkRuleListResultPage) Response() VirtualNetworkRuleListResult {
return page.vnrlr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page VirtualNetworkRuleListResultPage) Values() []VirtualNetworkRule {
if page.vnrlr.IsEmpty() {
return nil
}
return *page.vnrlr.Value
}
// Creates a new instance of the VirtualNetworkRuleListResultPage type.
func NewVirtualNetworkRuleListResultPage(getNextPage func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error)) VirtualNetworkRuleListResultPage {
return VirtualNetworkRuleListResultPage{fn: getNextPage}
}
// VirtualNetworkRuleProperties properties of a virtual network rule.
type VirtualNetworkRuleProperties struct {
// VirtualNetworkSubnetID - The ARM resource id of the virtual network subnet.
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 VirtualNetworkRuleState `json:"state,omitempty"`
}
// VirtualNetworkRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
// long-running operation.
type VirtualNetworkRulesCreateOrUpdateFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *VirtualNetworkRulesCreateOrUpdateFuture) Result(client VirtualNetworkRulesClient) (vnr VirtualNetworkRule, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("postgresql.VirtualNetworkRulesCreateOrUpdateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if vnr.Response.Response, err = future.GetResult(sender); err == nil && vnr.Response.Response.StatusCode != http.StatusNoContent {
vnr, err = client.CreateOrUpdateResponder(vnr.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", vnr.Response.Response, "Failure responding to request")
}
}
return
}
// VirtualNetworkRulesDeleteFuture an abstraction for monitoring and retrieving the results of a
// long-running operation.
type VirtualNetworkRulesDeleteFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *VirtualNetworkRulesDeleteFuture) Result(client VirtualNetworkRulesClient) (ar autorest.Response, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesDeleteFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("postgresql.VirtualNetworkRulesDeleteFuture")
return
}
ar.Response = future.Response()
return
}
You can’t perform that action at this time.