deps: Update jen20/riviera

This commit is contained in:
stack72 2016-02-03 23:40:32 +00:00
parent f6bee13bd4
commit 4ef557bed7
18 changed files with 500 additions and 4 deletions

8
Godeps/Godeps.json generated
View File

@ -526,11 +526,15 @@
},
{
"ImportPath": "github.com/jen20/riviera/azure",
"Rev": "9f0b6c6d5e35780213c3a32976b353faca958699"
"Rev": "478cbee6e83468ab998195f485cf8f62069a8024"
},
{
"ImportPath": "github.com/jen20/riviera/dns",
"Rev": "9f0b6c6d5e35780213c3a32976b353faca958699"
"Rev": "478cbee6e83468ab998195f485cf8f62069a8024"
},
{
"ImportPath": "github.com/jen20/riviera/sql",
"Rev": "478cbee6e83468ab998195f485cf8f62069a8024"
},
{
"ImportPath": "github.com/jmespath/go-jmespath",

View File

@ -129,7 +129,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
func registerAzureResourceProvidersWithSubscription(config *Config, client *ArmClient) error {
providerClient := client.providers
providers := []string{"Microsoft.Network", "Microsoft.Compute", "Microsoft.Cdn", "Microsoft.Storage"}
providers := []string{"Microsoft.Network", "Microsoft.Compute", "Microsoft.Cdn", "Microsoft.Storage", "Microsoft.Sql"}
for _, v := range providers {
res, err := providerClient.Register(v)

View File

@ -66,6 +66,7 @@ func resourceArmSqlServerCreate(d *schema.ResourceData, meta interface{}) error
rivieraClient := client.rivieraClient
tags := d.Get("tags").(map[string]interface{})
expandedTags := expandTags(tags)
createRequest := rivieraClient.NewRequest()
createRequest.Command = &sql.CreateOrUpdateServer{
@ -75,7 +76,7 @@ func resourceArmSqlServerCreate(d *schema.ResourceData, meta interface{}) error
AdministratorLogin: azure.String(d.Get("administrator_login").(string)),
AdministratorLoginPassword: azure.String(d.Get("administrator_login_password").(string)),
Version: azure.String(d.Get("version").(string)),
Tags: expandTags(tags),
Tags: *expandedTags,
}
createResponse, err := createRequest.Execute()

View File

@ -29,6 +29,37 @@ func TestAccAzureRMSqlServer_basic(t *testing.T) {
})
}
func TestAccAzureRMSqlServer_withTags(t *testing.T) {
ri := acctest.RandInt()
preConfig := fmt.Sprintf(testAccAzureRMSqlServer_withTags, ri, ri)
postConfig := fmt.Sprintf(testAccAzureRMSqlServer_withTagsUpdated, ri, ri)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMSqlServerDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: preConfig,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMSqlServerExists("azurerm_sql_server.test"),
resource.TestCheckResourceAttr(
"azurerm_sql_server.test", "tags.#", "2"),
),
},
resource.TestStep{
Config: postConfig,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMSqlServerExists("azurerm_sql_server.test"),
resource.TestCheckResourceAttr(
"azurerm_sql_server.test", "tags.#", "1"),
),
},
},
})
}
func testCheckAzureRMSqlServerExists(name string) resource.TestCheckFunc {
return func(s *terraform.State) error {
@ -92,3 +123,42 @@ resource "azurerm_sql_server" "test" {
administrator_login_password = "thisIsDog11"
}
`
var testAccAzureRMSqlServer_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
location = "West US"
}
resource "azurerm_sql_server" "test" {
name = "acctestsqlserver%d"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "West US"
version = "12.0"
administrator_login = "mradministrator"
administrator_login_password = "thisIsDog11"
tags {
environment = "staging"
database = "test"
}
}
`
var testAccAzureRMSqlServer_withTagsUpdated = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
location = "West US"
}
resource "azurerm_sql_server" "test" {
name = "acctestsqlserver%d"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "West US"
version = "12.0"
administrator_login = "mradministrator"
administrator_login_password = "thisIsDog11"
tags {
environment = "production"
}
}
`

30
vendor/github.com/jen20/riviera/sql/api.go generated vendored Normal file
View File

@ -0,0 +1,30 @@
package sql
import "fmt"
const apiVersion = "2014-04-01-preview"
const apiProvider = "Microsoft.Sql"
func sqlServerDefaultURLPath(resourceGroupName, serverName string) func() string {
return func() string {
return fmt.Sprintf("resourceGroups/%s/providers/%s/servers/%s", resourceGroupName, apiProvider, serverName)
}
}
func sqlElasticPoolDefaultURLPath(resourceGroupName, serverName, elasticPoolName string) func() string {
return func() string {
return fmt.Sprintf("resourceGroups/%s/providers/%s/servers/%s/elasticPools/%s", resourceGroupName, apiProvider, serverName, elasticPoolName)
}
}
func sqlDatabaseDefaultURLPath(resourceGroupName, serverName, databaseName string) func() string {
return func() string {
return fmt.Sprintf("resourceGroups/%s/providers/%s/servers/%s/databases/%s", resourceGroupName, apiProvider, serverName, databaseName)
}
}
func sqlServerFirewallDefaultURLPath(resourceGroupName, serverName, firewallRuleName string) func() string {
return func() string {
return fmt.Sprintf("resourceGroups/%s/providers/%s/servers/%s/firewallRules/%s", resourceGroupName, apiProvider, serverName, firewallRuleName)
}
}

View File

@ -0,0 +1,27 @@
package sql
import "github.com/jen20/riviera/azure"
type CreateElasticDatabasePool struct {
Name string `json:"-"`
ServerName string `json:"-"`
ResourceGroupName string `json:"-"`
Location string `json:"-" riviera:"location"`
Tags map[string]*string `json:"-" riviera:"tags"`
Edition *string `json:"edition,omitempty"`
DTU *string `json:"dtu,omitempty"`
StorageMB *string `json:"storageMB,omitempty"`
DatabaseDTUMin *string `json:"databaseDtuMin,omitempty"`
DatabaseDTUMax *string `json:"databaseDtuMax,omitempty"`
}
func (s CreateElasticDatabasePool) ApiInfo() azure.ApiInfo {
return azure.ApiInfo{
ApiVersion: apiVersion,
Method: "PUT",
URLPathFunc: sqlElasticPoolDefaultURLPath(s.ResourceGroupName, s.ServerName, s.Name),
ResponseTypeFunc: func() interface{} {
return nil
},
}
}

View File

@ -0,0 +1,49 @@
package sql
import "github.com/jen20/riviera/azure"
type CreateOrUpdateDatabaseResponse struct {
ID *string `mapstructure:"id"`
Name *string `mapstructure:"name"`
Location *string `mapstructure:"location"`
Tags *map[string]string `mapstructure:"tags"`
DatabaseID *string `mapstructure:"databaseId"`
DatabaseName *string `mapstructure:"databaseName"`
Edition *string `mapstructure:"edition"`
ServiceLevelObjective *string `mapstructure:"serviceLevelObjective"`
MaxSizeInBytes *string `mapstructure:"maxSizeInBytes"`
CreationDate *string `mapstructure:"creationDate"`
CurrentServiceLevelObjectiveID *string `mapstructure:"currentServiceLevelObjectiveId"`
RequestedServiceObjectiveID *string `mapstructure:"requestedServiceObjectiveId"`
DefaultSecondaryLocation *string `mapstructure:"defaultSecondaryLocation"`
Encryption *string `mapstructure:"encryption"`
}
type CreateOrUpdateDatabase struct {
Name string `json:"-"`
ResourceGroupName string `json:"-"`
ServerName string `json:"-"`
Location string `json:"-" riviera:"location"`
Tags map[string]*string `json:"-" riviera:"tags"`
Edition *string `json:"edition,omitempty"`
Collation *string `json:"collation,omitempty"`
MaxSizeBytes *string `json:"maxSizeBytes,omitempty"`
RequestedServiceObjectiveName *string `json:"requestedServiceObjectiveName,omitempty"`
RequestedServiceObjectiveId *string `json:"requestedServiceObjectiveId,omitempty"`
CreateMode *string `json:"createMode,omitempty"`
SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"`
SourceDatabaseDeletionDate *string `json:"sourceDatabaseDeletionDate,omitempty"`
RestorePointInTime *string `json:"restorePointInTime,omitempty"`
ElasticPoolName *string `json:"elasticPoolName,omitempty"`
}
func (s CreateOrUpdateDatabase) ApiInfo() azure.ApiInfo {
return azure.ApiInfo{
ApiVersion: apiVersion,
Method: "PUT",
URLPathFunc: sqlDatabaseDefaultURLPath(s.ResourceGroupName, s.ServerName, s.Name),
ResponseTypeFunc: func() interface{} {
return &CreateOrUpdateDatabaseResponse{}
},
}
}

View File

@ -0,0 +1,30 @@
package sql
import "github.com/jen20/riviera/azure"
type CreateOrUpdateFirewallRuleResponse struct {
ID *string `mapstructure:"id"`
Name *string `mapstructure:"name"`
Location *string `mapstructure:"location"`
StartIpAddress *string `json:"startIpAddress,omitempty"`
EndIpAddress *string `json:"endIpAddress,omitempty"`
}
type CreateOrUpdateFirewallRule struct {
Name string `json:"-"`
ResourceGroupName string `json:"-"`
ServerName string `json:"-"`
StartIpAddress *string `json:"startIpAddress,omitempty"`
EndIpAddress *string `json:"endIpAddress,omitempty"`
}
func (s CreateOrUpdateFirewallRule) ApiInfo() azure.ApiInfo {
return azure.ApiInfo{
ApiVersion: apiVersion,
Method: "PUT",
URLPathFunc: sqlServerFirewallDefaultURLPath(s.ResourceGroupName, s.ServerName, s.Name),
ResponseTypeFunc: func() interface{} {
return &CreateOrUpdateFirewallRuleResponse{}
},
}
}

View File

@ -0,0 +1,39 @@
package sql
import "github.com/jen20/riviera/azure"
type CreateOrUpdateServerResponse struct {
ID *string `mapstructure:"id"`
Name *string `mapstructure:"name"`
Location *string `mapstructure:"location"`
Tags *map[string]*string `mapstructure:"tags"`
Kind *string `mapstructure:"kind"`
FullyQualifiedDomainName *string `mapstructure:"fullyQualifiedDomainName"`
AdministratorLogin *string `mapstructure:"administratorLogin"`
AdministratorLoginPassword *string `mapstructure:"administratorLoginPassword"`
ExternalAdministratorLogin *string `mapstructure:"externalAdministratorLogin"`
ExternalAdministratorSid *string `mapstructure:"externalAdministratorSid"`
Version *string `mapstructure:"version"`
State *string `mapstructure:"state"`
}
type CreateOrUpdateServer struct {
Name string `json:"-"`
ResourceGroupName string `json:"-"`
Location string `json:"-" riviera:"location"`
Tags map[string]*string `json:"-" riviera:"tags"`
AdministratorLogin *string `json:"administratorLogin,omitempty"`
AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
Version *string `json:"version,omitempty"`
}
func (s CreateOrUpdateServer) ApiInfo() azure.ApiInfo {
return azure.ApiInfo{
ApiVersion: apiVersion,
Method: "PUT",
URLPathFunc: sqlServerDefaultURLPath(s.ResourceGroupName, s.Name),
ResponseTypeFunc: func() interface{} {
return &CreateOrUpdateServerResponse{}
},
}
}

20
vendor/github.com/jen20/riviera/sql/delete_database.go generated vendored Normal file
View File

@ -0,0 +1,20 @@
package sql
import "github.com/jen20/riviera/azure"
type DeleteDatabase struct {
Name string `json:"-"`
ServerName string `json:"-"`
ResourceGroupName string `json:"-"`
}
func (s DeleteDatabase) ApiInfo() azure.ApiInfo {
return azure.ApiInfo{
ApiVersion: apiVersion,
Method: "DELETE",
URLPathFunc: sqlDatabaseDefaultURLPath(s.ResourceGroupName, s.ServerName, s.Name),
ResponseTypeFunc: func() interface{} {
return nil
},
}
}

View File

@ -0,0 +1,20 @@
package sql
import "github.com/jen20/riviera/azure"
type DeleteElasticDatabasePool struct {
Name string `json:"-"`
ServerName string `json:"-"`
ResourceGroupName string `json:"-"`
}
func (s DeleteElasticDatabasePool) ApiInfo() azure.ApiInfo {
return azure.ApiInfo{
ApiVersion: apiVersion,
Method: "DELETE",
URLPathFunc: sqlElasticPoolDefaultURLPath(s.ResourceGroupName, s.ServerName, s.Name),
ResponseTypeFunc: func() interface{} {
return nil
},
}
}

View File

@ -0,0 +1,20 @@
package sql
import "github.com/jen20/riviera/azure"
type DeleteFirewallRule struct {
Name string `json:"-"`
ResourceGroupName string `json:"-"`
ServerName string `json:"-"`
}
func (s DeleteFirewallRule) ApiInfo() azure.ApiInfo {
return azure.ApiInfo{
ApiVersion: apiVersion,
Method: "DELETE",
URLPathFunc: sqlServerFirewallDefaultURLPath(s.ResourceGroupName, s.ServerName, s.Name),
ResponseTypeFunc: func() interface{} {
return nil
},
}
}

19
vendor/github.com/jen20/riviera/sql/delete_server.go generated vendored Normal file
View File

@ -0,0 +1,19 @@
package sql
import "github.com/jen20/riviera/azure"
type DeleteServer struct {
Name string `json:"-"`
ResourceGroupName string `json:"-"`
}
func (s DeleteServer) ApiInfo() azure.ApiInfo {
return azure.ApiInfo{
ApiVersion: apiVersion,
Method: "DELETE",
URLPathFunc: sqlServerDefaultURLPath(s.ResourceGroupName, s.Name),
ResponseTypeFunc: func() interface{} {
return nil
},
}
}

37
vendor/github.com/jen20/riviera/sql/get_database.go generated vendored Normal file
View File

@ -0,0 +1,37 @@
package sql
import "github.com/jen20/riviera/azure"
type GetDatabaseResponse struct {
ID *string `mapstructure:"id"`
Name *string `mapstructure:"name"`
Location *string `mapstructure:"location"`
Tags *map[string]string `mapstructure:"tags"`
DatabaseID *string `mapstructure:"databaseId"`
DatabaseName *string `mapstructure:"databaseName"`
Edition *string `mapstructure:"edition"`
ServiceLevelObjective *string `mapstructure:"serviceLevelObjective"`
MaxSizeInBytes *string `mapstructure:"maxSizeInBytes"`
CreationDate *string `mapstructure:"creationDate"`
CurrentServiceLevelObjectiveID *string `mapstructure:"currentServiceLevelObjectiveId"`
RequestedServiceObjectiveID *string `mapstructure:"requestedServiceObjectiveId"`
DefaultSecondaryLocation *string `mapstructure:"defaultSecondaryLocation"`
Encryption *string `mapstructure:"encryption"`
}
type GetDatabase struct {
Name string `json:"-"`
ServerName string `json:"-"`
ResourceGroupName string `json:"-"`
}
func (s GetDatabase) ApiInfo() azure.ApiInfo {
return azure.ApiInfo{
ApiVersion: apiVersion,
Method: "GET",
URLPathFunc: sqlDatabaseDefaultURLPath(s.ResourceGroupName, s.ServerName, s.Name),
ResponseTypeFunc: func() interface{} {
return &GetDatabaseResponse{}
},
}
}

View File

@ -0,0 +1,28 @@
package sql
import "github.com/jen20/riviera/azure"
type GetFirewallRuleResponse struct {
ID *string `mapstructure:"id"`
Name *string `mapstructure:"name"`
Location *string `mapstructure:"location"`
StartIpAddress *string `json:"startIpAddress,omitempty"`
EndIpAddress *string `json:"endIpAddress,omitempty"`
}
type GetFirewallRule struct {
Name string `json:"-"`
ResourceGroupName string `json:"-"`
ServerName string `json:"-"`
}
func (s GetFirewallRule) ApiInfo() azure.ApiInfo {
return azure.ApiInfo{
ApiVersion: apiVersion,
Method: "GET",
URLPathFunc: sqlServerFirewallDefaultURLPath(s.ResourceGroupName, s.ServerName, s.Name),
ResponseTypeFunc: func() interface{} {
return &GetFirewallRuleResponse{}
},
}
}

34
vendor/github.com/jen20/riviera/sql/get_server.go generated vendored Normal file
View File

@ -0,0 +1,34 @@
package sql
import "github.com/jen20/riviera/azure"
type GetServerResponse struct {
ID *string `mapstructure:"id"`
Name *string `mapstructure:"name"`
Location *string `mapstructure:"location"`
Tags *map[string]*string `mapstructure:"tags"`
Kind *string `mapstructure:"kind"`
FullyQualifiedDomainName *string `mapstructure:"fullyQualifiedDomainName"`
AdministratorLogin *string `mapstructure:"administratorLogin"`
AdministratorLoginPassword *string `mapstructure:"administratorLoginPassword"`
ExternalAdministratorLogin *string `mapstructure:"externalAdministratorLogin"`
ExternalAdministratorSid *string `mapstructure:"externalAdministratorSid"`
Version *string `mapstructure:"version"`
State *string `mapstructure:"state"`
}
type GetServer struct {
Name string `json:"-"`
ResourceGroupName string `json:"-"`
}
func (s GetServer) ApiInfo() azure.ApiInfo {
return azure.ApiInfo{
ApiVersion: apiVersion,
Method: "GET",
URLPathFunc: sqlServerDefaultURLPath(s.ResourceGroupName, s.Name),
ResponseTypeFunc: func() interface{} {
return &GetServerResponse{}
},
}
}

View File

@ -0,0 +1,57 @@
---
layout: "azurerm"
page_title: "Azure Resource Manager: azurerm_sql_server"
sidebar_current: "docs-azurerm-resource-sql-server"
description: |-
Create a SQL Server.
---
# azurerm\_sql\_server
Allows you to manage an Azure SQL Database Server
## Example Usage
```
resource "azurerm_resource_group" "test" {
name = "acceptanceTestResourceGroup1"
location = "West US"
}
resource "azurerm_sql_server" "test" {
name = "MySqlServer"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "West US"
version = "12.0"
administrator_login = "mradministrator"
administrator_login_password = "thisIsDog11"
tags {
environment = "production"
}
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) The name of the SQL Server.
* `resource_group_name` - (Required) The name of the resource group in which to
create the sql server.
* `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
* `version` - (Required) The version for the new server. Valid values are: 2.0 (for v11 server) and 12.0 (for v12 server).
* `administrator_login` - (Required) The administrator login name for the new server.
* `administrator_login_password` - (Required) The password for the new AdministratorLogin. Please following Azures [Password Policy](https://msdn.microsoft.com/library/ms161959.aspx)
* `tags` - (Optional) A mapping of tags to assign to the resource.
## Attributes Reference
The following attributes are exported:
* `id` - The DNS Zone ID.
* `fully_qualified_domain_name` - The fully qualified domain name of the Azure SQL Server (e.g. myServerName.database.windows.net)

View File

@ -83,6 +83,17 @@
</ul>
</li>
<li<%= sidebar_current(/^docs-azurerm-resource-sql/) %>>
<a href="#">SQL Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-azurerm-resource-sql-server") %>>
<a href="/docs/providers/azurerm/r/sql_server.html">azurerm_sql_server</a>
</li>
</ul>
</li>
<li<%= sidebar_current(/^docs-azurerm-resource-storage/) %>>
<a href="#">Storage Resources</a>