postgresql

package
v0.0.0-...-042701a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2020 License: MIT Imports: 7 Imported by: 0

README


services: postgresql platforms: go author: gechris

Azure PostgreSQL Samples

This package demonstrates how to manage Azure VMs, their disks and container instances with the Go SDK.

The child package "hybrid" demonstrates how to manage Azure VMs using Azure's Hybrid profile.

Contents

  • How to run all samples
  • Management
    • CreateServer - Create a PostgreSQL.
    • UpdateServer - Updates a PostgreSQL server.
    • DeleteServer - Deletes an existing PostgreSQL server.
    • CreateOrUpdateFirewallRules - Creates or updates a firewall rule on the server.
    • GetConfiguration - Get the configuration value that is set on the server.

How to run all samples

  1. Get this package and all dependencies.
export PROJECT=github.com/Azure-Samples/azure-sdk-for-go-samples/postgresql
go get -u $PROJECT
cd ${GOPATH}/src/${PROJECT}
dep ensure
  1. Create an Azure service principal with the [Azure CLI][] command az ad sp create-for-rbac --output json and set the following environment variables per that command's output. You can also copy .env.tpl to .env and fill it in; the configuration system will utilize this.
AZURE_CLIENT_ID=
AZURE_CLIENT_SECRET=
AZURE_TENANT_ID=
AZURE_SUBSCRIPTION_ID=
AZURE_BASE_GROUP_NAME=
AZURE_LOCATION_DEFAULT=westus2
  1. TODO(joshgav): grant this principal all-powerful rights to your AAD tenant to faciliate identity-related operations.
  2. Run the tests: go test -v -timeout 12h

The timeout is optional, but some tests take longer than then default 10m to complete.

More information

Please refer to Azure SDK for Go for more information.


This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOrUpdateFirewallRule

func CreateOrUpdateFirewallRule(ctx context.Context, fwrClient pg.FirewallRulesClient, 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, serversClient pg.ServersClient, serverName string, dbLogin string, dbPassword string) (server pg.Server, err error)

CreateServer creates a new PostgreSQL Server

func DeleteServer

func DeleteServer(ctx context.Context, serversClient pg.ServersClient, serverName string) (resp autorest.Response, err error)

DeleteServer deletes the PostgreSQL server.

func GetConfiguration

func GetConfiguration(ctx context.Context, configClient pg.ConfigurationsClient, serverName string, configurationName string) (pg.Configuration, error)

GetConfiguration given the server name and configuration name it returns the configuration.

func GetConfigurationsClient

func GetConfigurationsClient() pg.ConfigurationsClient

GetConfigurationsClient creates and returns the configuration client for the server.

func GetFwRulesClient

func GetFwRulesClient() pg.FirewallRulesClient

GetFwRulesClient returns the FirewallClient

func GetServersClient

func GetServersClient() pg.ServersClient

GetServersClient returns

func UpdateConfiguration

func UpdateConfiguration(ctx context.Context, configClient pg.ConfigurationsClient, serverName string, configurationName string, configuration pg.Configuration) (updatedConfig pg.Configuration, err error)

UpdateConfiguration given the name of the configuation and the configuration object it updates the configuration for the given server.

func UpdateServerStorageCapacity

func UpdateServerStorageCapacity(ctx context.Context, serversClient pg.ServersClient, serverName string, storageCapacity int32) (server pg.Server, err error)

UpdateServerStorageCapacity given the server name and the new storage capacity it updates the server's storage capacity.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL