Documentation ¶
Overview ¶
Example (PerformServerOperations) ¶
Example_createDatabase creates a MySQL server and database, then creates a table and inserts a record.
config.SetGroupName(groupName) serverName = strings.ToLower(serverName) ctx := context.Background() defer resources.Cleanup(ctx) _, err := resources.CreateGroup(ctx, config.GroupName()) if err != nil { util.LogAndPanic(err) } _, err = CreateServer(ctx, serverName, dbLogin, dbPassword) if err != nil { util.LogAndPanic(fmt.Errorf("cannot create mysql server: %+v", err)) } util.PrintAndLog("mysql server created") _, err = UpdateServerStorageCapacity(ctx, serverName, 1048576) if err != nil { util.LogAndPanic(fmt.Errorf("cannot update mysql server: %+v", err)) } util.PrintAndLog("updated mysql server's storage capacity") err = CreateOrUpdateFirewallRule(ctx, serverName, "FirewallRuleName", "0.0.0.0", "0.0.0.0") if err != nil { util.LogAndPanic(err) } util.PrintAndLog("Firewall rule set") err = CreateOrUpdateFirewallRule(ctx, serverName, "FirewallRuleName", "0.0.0.0", "1.1.1.1") if err != nil { util.LogAndPanic(err) } util.PrintAndLog("Firewall rule updated") var configuration mysql.Configuration configuration, err = GetConfiguration(ctx, serverName, "event_scheduler") if err != nil { util.LogAndPanic(err) } util.PrintAndLog("Got the event_scheduler configuration") // Update the configuration Value. configuration.ConfigurationProperties.Value = to.StringPtr("on") configuration.ConfigurationProperties.Source = to.StringPtr("user-override") _, err = UpdateConfiguration(ctx, serverName, "event_scheduler", configuration) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("Updated the event_scheduler configuration") // Finally delete the server. _, err = DeleteServer(ctx, serverName) if err != nil { util.LogAndPanic(err) } util.PrintAndLog("Successfully deleted the server")
Output: mysql server created updated mysql server's storage capacity Firewall rule set Firewall rule updated Got the event_scheduler configuration Updated the event_scheduler configuration Successfully deleted the server
Index ¶
- func CreateOrUpdateFirewallRule(ctx context.Context, ...) error
- func CreateServer(ctx context.Context, serverName, dbLogin, dbPassword string) (server mysql.Server, err error)
- func DeleteServer(ctx context.Context, serverName string) (resp autorest.Response, err error)
- func GetConfiguration(ctx context.Context, serverName, configurationName string) (mysql.Configuration, error)
- func UpdateConfiguration(ctx context.Context, serverName string, configurationName string, ...) (updatedConfig mysql.Configuration, err error)
- func UpdateServerStorageCapacity(ctx context.Context, serverName string, storageCapacity int32) (server mysql.Server, err error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateOrUpdateFirewallRule ¶
func CreateOrUpdateFirewallRule(ctx context.Context, serverName, firewallRuleName, startIPAddr, endIPAddr string) error
CreateOrUpdateFirewallRule given the firewallname and new properties it updates the firewall rule.
func CreateServer ¶
func CreateServer(ctx context.Context, serverName, dbLogin, dbPassword string) (server mysql.Server, err error)
CreateServer creates a new MySQL Server
func DeleteServer ¶
DeleteServer deletes the MySQL server.
func GetConfiguration ¶
func GetConfiguration(ctx context.Context, serverName, configurationName string) (mysql.Configuration, error)
GetConfiguration given the server name and configuration name it returns the configuration.
func UpdateConfiguration ¶
func UpdateConfiguration(ctx context.Context, serverName string, configurationName string, configuration mysql.Configuration) (updatedConfig mysql.Configuration, err error)
UpdateConfiguration given the name of the configuation and the configuration object it updates the configuration for the given server.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.