Skip to content

Commit

Permalink
provider/azurerm: Loadbalancer => LoadBalancer
Browse files Browse the repository at this point in the history
  • Loading branch information
jen20 committed Oct 7, 2016
1 parent 5444c27 commit 7d3d707
Show file tree
Hide file tree
Showing 15 changed files with 200 additions and 200 deletions.
4 changes: 2 additions & 2 deletions builtin/providers/azurerm/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func resourceGroupAndLBNameFromId(loadBalancerId string) (string, string, error)
return resGroup, name, nil
}

func retrieveLoadbalancerById(loadBalancerId string, meta interface{}) (*network.LoadBalancer, bool, error) {
func retrieveLoadBalancerById(loadBalancerId string, meta interface{}) (*network.LoadBalancer, bool, error) {
loadBalancerClient := meta.(*ArmClient).loadBalancerClient

resGroup, name, err := resourceGroupAndLBNameFromId(loadBalancerId)
Expand Down Expand Up @@ -135,7 +135,7 @@ func loadbalancerStateRefreshFunc(client *ArmClient, resourceGroupName string, l
}
}

func validateLoadbalancerPrivateIpAddressAllocation(v interface{}, k string) (ws []string, errors []error) {
func validateLoadBalancerPrivateIpAddressAllocation(v interface{}, k string) (ws []string, errors []error) {
value := strings.ToLower(v.(string))
if value != "static" && value != "dynamic" {
errors = append(errors, fmt.Errorf("LoadBalancer Allocations can only be Static or Dynamic"))
Expand Down
12 changes: 6 additions & 6 deletions builtin/providers/azurerm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ func Provider() terraform.ResourceProvider {
"azurerm_cdn_endpoint": resourceArmCdnEndpoint(),
"azurerm_cdn_profile": resourceArmCdnProfile(),

"azurerm_lb": resourceArmLoadbalancer(),
"azurerm_lb_backend_address_pool": resourceArmLoadbalancerBackendAddressPool(),
"azurerm_lb_nat_rule": resourceArmLoadbalancerNatRule(),
"azurerm_lb_nat_pool": resourceArmLoadbalancerNatPool(),
"azurerm_lb_probe": resourceArmLoadbalancerProbe(),
"azurerm_lb_rule": resourceArmLoadbalancerRule(),
"azurerm_lb": resourceArmLoadBalancer(),
"azurerm_lb_backend_address_pool": resourceArmLoadBalancerBackendAddressPool(),
"azurerm_lb_nat_rule": resourceArmLoadBalancerNatRule(),
"azurerm_lb_nat_pool": resourceArmLoadBalancerNatPool(),
"azurerm_lb_probe": resourceArmLoadBalancerProbe(),
"azurerm_lb_rule": resourceArmLoadBalancerRule(),

"azurerm_local_network_gateway": resourceArmLocalNetworkGateway(),
"azurerm_network_interface": resourceArmNetworkInterface(),
Expand Down
26 changes: 13 additions & 13 deletions builtin/providers/azurerm/resource_arm_loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import (
"github.com/jen20/riviera/azure"
)

func resourceArmLoadbalancer() *schema.Resource {
func resourceArmLoadBalancer() *schema.Resource {
return &schema.Resource{
Create: resourceArmLoadbalancerCreate,
Read: resourceArmLoadbalancerRead,
Update: resourceArmLoadbalancerCreate,
Delete: resourceArmLoadbalancerDelete,
Create: resourceArmLoadBalancerCreate,
Read: resourecArmLoadBalancerRead,
Update: resourceArmLoadBalancerCreate,
Delete: resourceArmLoadBalancerDelete,

Schema: map[string]*schema.Schema{
"name": {
Expand Down Expand Up @@ -72,7 +72,7 @@ func resourceArmLoadbalancer() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validateLoadbalancerPrivateIpAddressAllocation,
ValidateFunc: validateLoadBalancerPrivateIpAddressAllocation,
},

"load_balancer_rules": {
Expand All @@ -97,7 +97,7 @@ func resourceArmLoadbalancer() *schema.Resource {
}
}

func resourceArmLoadbalancerCreate(d *schema.ResourceData, meta interface{}) error {
func resourceArmLoadBalancerCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ArmClient)
loadBalancerClient := client.loadBalancerClient

Expand All @@ -112,7 +112,7 @@ func resourceArmLoadbalancerCreate(d *schema.ResourceData, meta interface{}) err
properties := network.LoadBalancerPropertiesFormat{}

if _, ok := d.GetOk("frontend_ip_configuration"); ok {
properties.FrontendIPConfigurations = expandAzureRmLoadbalancerFrontendIpConfigurations(d)
properties.FrontendIPConfigurations = expandAzureRmLoadBalancerFrontendIpConfigurations(d)
}

loadbalancer := network.LoadBalancer{
Expand Down Expand Up @@ -148,11 +148,11 @@ func resourceArmLoadbalancerCreate(d *schema.ResourceData, meta interface{}) err
return fmt.Errorf("Error waiting for LoadBalancer (%s) to become available: %s", name, err)
}

return resourceArmLoadbalancerRead(d, meta)
return resourecArmLoadBalancerRead(d, meta)
}

func resourceArmLoadbalancerRead(d *schema.ResourceData, meta interface{}) error {
loadBalancer, exists, err := retrieveLoadbalancerById(d.Id(), meta)
func resourecArmLoadBalancerRead(d *schema.ResourceData, meta interface{}) error {
loadBalancer, exists, err := retrieveLoadBalancerById(d.Id(), meta)
if err != nil {
return errwrap.Wrapf("Error Getting LoadBalancer By ID {{err}}", err)
}
Expand All @@ -171,7 +171,7 @@ func resourceArmLoadbalancerRead(d *schema.ResourceData, meta interface{}) error
return nil
}

func resourceArmLoadbalancerDelete(d *schema.ResourceData, meta interface{}) error {
func resourceArmLoadBalancerDelete(d *schema.ResourceData, meta interface{}) error {
loadBalancerClient := meta.(*ArmClient).loadBalancerClient

id, err := parseAzureResourceID(d.Id())
Expand All @@ -190,7 +190,7 @@ func resourceArmLoadbalancerDelete(d *schema.ResourceData, meta interface{}) err
return nil
}

func expandAzureRmLoadbalancerFrontendIpConfigurations(d *schema.ResourceData) *[]network.FrontendIPConfiguration {
func expandAzureRmLoadBalancerFrontendIpConfigurations(d *schema.ResourceData) *[]network.FrontendIPConfiguration {
configs := d.Get("frontend_ip_configuration").([]interface{})
frontEndConfigs := make([]network.FrontendIPConfiguration, 0, len(configs))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (
"github.com/jen20/riviera/azure"
)

func resourceArmLoadbalancerBackendAddressPool() *schema.Resource {
func resourceArmLoadBalancerBackendAddressPool() *schema.Resource {
return &schema.Resource{
Create: resourceArmLoadbalancerBackendAddressPoolCreate,
Read: resourceArmLoadbalancerBackendAddressPoolRead,
Delete: resourceArmLoadbalancerBackendAddressPoolDelete,
Create: resourceArmLoadBalancerBackendAddressPoolCreate,
Read: resourceArmLoadBalancerBackendAddressPoolRead,
Delete: resourceArmLoadBalancerBackendAddressPoolDelete,

Schema: map[string]*schema.Schema{
"name": {
Expand Down Expand Up @@ -61,11 +61,11 @@ func resourceArmLoadbalancerBackendAddressPool() *schema.Resource {
}
}

func resourceArmLoadbalancerBackendAddressPoolCreate(d *schema.ResourceData, meta interface{}) error {
func resourceArmLoadBalancerBackendAddressPoolCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ArmClient)
lbClient := client.loadBalancerClient

loadBalancer, exists, err := retrieveLoadbalancerById(d.Get("loadbalancer_id").(string), meta)
loadBalancer, exists, err := retrieveLoadBalancerById(d.Get("loadbalancer_id").(string), meta)
if err != nil {
return errwrap.Wrapf("Error Getting LoadBalancer By ID {{err}}", err)
}
Expand All @@ -80,7 +80,7 @@ func resourceArmLoadbalancerBackendAddressPoolCreate(d *schema.ResourceData, met
return fmt.Errorf("A BackEnd Address Pool with name %q already exists.", d.Get("name").(string))
}

backendAddressPools := append(*loadBalancer.Properties.BackendAddressPools, expandAzureRmLoadbalancerBackendAddressPools(d))
backendAddressPools := append(*loadBalancer.Properties.BackendAddressPools, expandAzureRmLoadBalancerBackendAddressPools(d))
loadBalancer.Properties.BackendAddressPools = &backendAddressPools
resGroup, loadBalancerName, err := resourceGroupAndLBNameFromId(d.Get("loadbalancer_id").(string))
if err != nil {
Expand Down Expand Up @@ -113,11 +113,11 @@ func resourceArmLoadbalancerBackendAddressPoolCreate(d *schema.ResourceData, met
return fmt.Errorf("Error waiting for LoadBalancer (%s) to become available: %s", loadBalancerName, err)
}

return resourceArmLoadbalancerBackendAddressPoolRead(d, meta)
return resourceArmLoadBalancerBackendAddressPoolRead(d, meta)
}

func resourceArmLoadbalancerBackendAddressPoolRead(d *schema.ResourceData, meta interface{}) error {
loadBalancer, exists, err := retrieveLoadbalancerById(d.Id(), meta)
func resourceArmLoadBalancerBackendAddressPoolRead(d *schema.ResourceData, meta interface{}) error {
loadBalancer, exists, err := retrieveLoadBalancerById(d.Id(), meta)
if err != nil {
return errwrap.Wrapf("Error Getting LoadBalancer By ID {{err}}", err)
}
Expand Down Expand Up @@ -157,11 +157,11 @@ func resourceArmLoadbalancerBackendAddressPoolRead(d *schema.ResourceData, meta
return nil
}

func resourceArmLoadbalancerBackendAddressPoolDelete(d *schema.ResourceData, meta interface{}) error {
func resourceArmLoadBalancerBackendAddressPoolDelete(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ArmClient)
lbClient := client.loadBalancerClient

loadBalancer, exists, err := retrieveLoadbalancerById(d.Get("loadbalancer_id").(string), meta)
loadBalancer, exists, err := retrieveLoadBalancerById(d.Get("loadbalancer_id").(string), meta)
if err != nil {
return errwrap.Wrapf("Error Getting LoadBalancer By ID {{err}}", err)
}
Expand Down Expand Up @@ -200,7 +200,7 @@ func resourceArmLoadbalancerBackendAddressPoolDelete(d *schema.ResourceData, met
return nil
}

func expandAzureRmLoadbalancerBackendAddressPools(d *schema.ResourceData) network.BackendAddressPool {
func expandAzureRmLoadBalancerBackendAddressPools(d *schema.ResourceData) network.BackendAddressPool {
return network.BackendAddressPool{
Name: azure.String(d.Get("name").(string)),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,49 @@ import (
"github.com/hashicorp/terraform/terraform"
)

func TestAccAzureRMLoadbalancerBackEndAddressPool_basic(t *testing.T) {
func TestAccAzureRMLoadBalancerBackEndAddressPool_basic(t *testing.T) {
var lb network.LoadBalancer
ri := acctest.RandInt()
addressPoolName := fmt.Sprintf("%d-address-pool", ri)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMLoadbalancerDestroy,
CheckDestroy: testCheckAzureRMLoadBalancerDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMLoadbalancerBackEndAddressPool_basic(ri, addressPoolName),
Config: testAccAzureRMLoadBalancerBackEndAddressPool_basic(ri, addressPoolName),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMLoadbalancerExists("azurerm_lb.test", &lb),
testCheckAzureRMLoadbalancerBackEndAddressPoolExists(addressPoolName, &lb),
testCheckAzureRMLoadBalancerExists("azurerm_lb.test", &lb),
testCheckAzureRMLoadBalancerBackEndAddressPoolExists(addressPoolName, &lb),
),
},
},
})
}

func TestAccAzureRMLoadbalancerBackEndAddressPool_removal(t *testing.T) {
func TestAccAzureRMLoadBalancerBackEndAddressPool_removal(t *testing.T) {
var lb network.LoadBalancer
ri := acctest.RandInt()
addressPoolName := fmt.Sprintf("%d-address-pool", ri)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMLoadbalancerDestroy,
CheckDestroy: testCheckAzureRMLoadBalancerDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMLoadbalancerBackEndAddressPool_removal(ri),
Config: testAccAzureRMLoadBalancerBackEndAddressPool_removal(ri),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMLoadbalancerExists("azurerm_lb.test", &lb),
testCheckAzureRMLoadbalancerBackEndAddressPoolNotExists(addressPoolName, &lb),
testCheckAzureRMLoadBalancerExists("azurerm_lb.test", &lb),
testCheckAzureRMLoadBalancerBackEndAddressPoolNotExists(addressPoolName, &lb),
),
},
},
})
}

func testCheckAzureRMLoadbalancerBackEndAddressPoolExists(addressPoolName string, lb *network.LoadBalancer) resource.TestCheckFunc {
func testCheckAzureRMLoadBalancerBackEndAddressPoolExists(addressPoolName string, lb *network.LoadBalancer) resource.TestCheckFunc {
return func(s *terraform.State) error {
_, _, exists := findLoadBalancerBackEndAddressPoolByName(lb, addressPoolName)
if !exists {
Expand All @@ -63,7 +63,7 @@ func testCheckAzureRMLoadbalancerBackEndAddressPoolExists(addressPoolName string
}
}

func testCheckAzureRMLoadbalancerBackEndAddressPoolNotExists(addressPoolName string, lb *network.LoadBalancer) resource.TestCheckFunc {
func testCheckAzureRMLoadBalancerBackEndAddressPoolNotExists(addressPoolName string, lb *network.LoadBalancer) resource.TestCheckFunc {
return func(s *terraform.State) error {
_, _, exists := findLoadBalancerBackEndAddressPoolByName(lb, addressPoolName)
if exists {
Expand All @@ -74,7 +74,7 @@ func testCheckAzureRMLoadbalancerBackEndAddressPoolNotExists(addressPoolName str
}
}

func testAccAzureRMLoadbalancerBackEndAddressPool_basic(rInt int, addressPoolName string) string {
func testAccAzureRMLoadBalancerBackEndAddressPool_basic(rInt int, addressPoolName string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
Expand Down Expand Up @@ -109,7 +109,7 @@ resource "azurerm_lb_backend_address_pool" "test" {
`, rInt, rInt, rInt, rInt, addressPoolName)
}

func testAccAzureRMLoadbalancerBackEndAddressPool_removal(rInt int) string {
func testAccAzureRMLoadBalancerBackEndAddressPool_removal(rInt int) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
Expand Down
28 changes: 14 additions & 14 deletions builtin/providers/azurerm/resource_arm_loadbalancer_nat_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import (
"github.com/jen20/riviera/azure"
)

func resourceArmLoadbalancerNatPool() *schema.Resource {
func resourceArmLoadBalancerNatPool() *schema.Resource {
return &schema.Resource{
Create: resourceArmLoadbalancerNatPoolCreate,
Read: resourceArmLoadbalancerNatPoolRead,
Update: resourceArmLoadbalancerNatPoolCreate,
Delete: resourceArmLoadbalancerNatPoolDelete,
Create: resourceArmLoadBalancerNatPoolCreate,
Read: resourceArmLoadBalancerNatPoolRead,
Update: resourceArmLoadBalancerNatPoolCreate,
Delete: resourceArmLoadBalancerNatPoolDelete,

Schema: map[string]*schema.Schema{
"name": {
Expand Down Expand Up @@ -78,11 +78,11 @@ func resourceArmLoadbalancerNatPool() *schema.Resource {
}
}

func resourceArmLoadbalancerNatPoolCreate(d *schema.ResourceData, meta interface{}) error {
func resourceArmLoadBalancerNatPoolCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ArmClient)
lbClient := client.loadBalancerClient

loadBalancer, exists, err := retrieveLoadbalancerById(d.Get("loadbalancer_id").(string), meta)
loadBalancer, exists, err := retrieveLoadBalancerById(d.Get("loadbalancer_id").(string), meta)
if err != nil {
return errwrap.Wrapf("Error Getting LoadBalancer By ID {{err}}", err)
}
Expand All @@ -97,7 +97,7 @@ func resourceArmLoadbalancerNatPoolCreate(d *schema.ResourceData, meta interface
return fmt.Errorf("A NAT Pool with name %q already exists.", d.Get("name").(string))
}

newNatPool, err := expandAzureRmLoadbalancerNatPool(d, loadBalancer)
newNatPool, err := expandAzureRmLoadBalancerNatPool(d, loadBalancer)
if err != nil {
return errwrap.Wrapf("Error Expanding NAT Pool {{err}}", err)
}
Expand Down Expand Up @@ -135,11 +135,11 @@ func resourceArmLoadbalancerNatPoolCreate(d *schema.ResourceData, meta interface
return fmt.Errorf("Error waiting for LoadBalancer (%s) to become available: %s", loadBalancerName, err)
}

return resourceArmLoadbalancerNatPoolRead(d, meta)
return resourceArmLoadBalancerNatPoolRead(d, meta)
}

func resourceArmLoadbalancerNatPoolRead(d *schema.ResourceData, meta interface{}) error {
loadBalancer, exists, err := retrieveLoadbalancerById(d.Id(), meta)
func resourceArmLoadBalancerNatPoolRead(d *schema.ResourceData, meta interface{}) error {
loadBalancer, exists, err := retrieveLoadBalancerById(d.Id(), meta)
if err != nil {
return errwrap.Wrapf("Error Getting LoadBalancer By ID {{err}}", err)
}
Expand Down Expand Up @@ -170,11 +170,11 @@ func resourceArmLoadbalancerNatPoolRead(d *schema.ResourceData, meta interface{}
return nil
}

func resourceArmLoadbalancerNatPoolDelete(d *schema.ResourceData, meta interface{}) error {
func resourceArmLoadBalancerNatPoolDelete(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ArmClient)
lbClient := client.loadBalancerClient

loadBalancer, exists, err := retrieveLoadbalancerById(d.Get("loadbalancer_id").(string), meta)
loadBalancer, exists, err := retrieveLoadBalancerById(d.Get("loadbalancer_id").(string), meta)
if err != nil {
return errwrap.Wrapf("Error Getting LoadBalancer By ID {{err}}", err)
}
Expand Down Expand Up @@ -213,7 +213,7 @@ func resourceArmLoadbalancerNatPoolDelete(d *schema.ResourceData, meta interface
return nil
}

func expandAzureRmLoadbalancerNatPool(d *schema.ResourceData, lb *network.LoadBalancer) (*network.InboundNatPool, error) {
func expandAzureRmLoadBalancerNatPool(d *schema.ResourceData, lb *network.LoadBalancer) (*network.InboundNatPool, error) {

properties := network.InboundNatPoolPropertiesFormat{
Protocol: network.TransportProtocol(d.Get("protocol").(string)),
Expand Down
Loading

0 comments on commit 7d3d707

Please sign in to comment.