From 048bfe5857bdbcbe9935bfc0a5922e45a8375bcd Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Mon, 26 Jun 2017 13:34:33 -0700 Subject: [PATCH] Renamed ClientFactoryBigtable to BigtableClientFactory --- ...lient_factory_bigtable.go => bigtable_client_factory.go} | 6 +++--- google/config.go | 4 ++-- google/resource_bigtable_instance.go | 6 +++--- google/resource_bigtable_instance_test.go | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) rename google/{client_factory_bigtable.go => bigtable_client_factory.go} (77%) diff --git a/google/client_factory_bigtable.go b/google/bigtable_client_factory.go similarity index 77% rename from google/client_factory_bigtable.go rename to google/bigtable_client_factory.go index f616788e..1c159788 100644 --- a/google/client_factory_bigtable.go +++ b/google/bigtable_client_factory.go @@ -8,15 +8,15 @@ import ( "google.golang.org/api/option" ) -type ClientFactoryBigtable struct { +type BigtableClientFactory struct { UserAgent string TokenSource oauth2.TokenSource } -func (s *ClientFactoryBigtable) NewInstanceAdminClient(project string) (*bigtable.InstanceAdminClient, error) { +func (s *BigtableClientFactory) NewInstanceAdminClient(project string) (*bigtable.InstanceAdminClient, error) { return bigtable.NewInstanceAdminClient(context.Background(), project, option.WithTokenSource(s.TokenSource), option.WithUserAgent(s.UserAgent)) } -func (s *ClientFactoryBigtable) NewAdminClient(project, instance string) (*bigtable.AdminClient, error) { +func (s *BigtableClientFactory) NewAdminClient(project, instance string) (*bigtable.AdminClient, error) { return bigtable.NewAdminClient(context.Background(), project, instance, option.WithTokenSource(s.TokenSource), option.WithUserAgent(s.UserAgent)) } diff --git a/google/config.go b/google/config.go index 22aef767..5b534ef2 100644 --- a/google/config.go +++ b/google/config.go @@ -48,7 +48,7 @@ type Config struct { clientServiceMan *servicemanagement.APIService clientBigQuery *bigquery.Service - clientFactoryBigtable *ClientFactoryBigtable + bigtableClientFactory *BigtableClientFactory } func (c *Config) loadAndValidate() error { @@ -193,7 +193,7 @@ func (c *Config) loadAndValidate() error { c.clientBigQuery.UserAgent = userAgent log.Printf("[INFO] Instantiating Google Cloud Bigtable Client Factory...") - c.clientFactoryBigtable = &ClientFactoryBigtable{ + c.bigtableClientFactory = &BigtableClientFactory{ UserAgent: userAgent, TokenSource: tokenSource, } diff --git a/google/resource_bigtable_instance.go b/google/resource_bigtable_instance.go index 9e635487..309dc5a8 100644 --- a/google/resource_bigtable_instance.go +++ b/google/resource_bigtable_instance.go @@ -99,7 +99,7 @@ func resourceBigtableInstanceCreate(d *schema.ResourceData, meta interface{}) er Zone: d.Get("zone").(string), } - c, err := config.clientFactoryBigtable.NewInstanceAdminClient(project) + c, err := config.bigtableClientFactory.NewInstanceAdminClient(project) if err != nil { return fmt.Errorf("Error starting instance admin client. %s", err) } @@ -125,7 +125,7 @@ func resourceBigtableInstanceRead(d *schema.ResourceData, meta interface{}) erro return err } - c, err := config.clientFactoryBigtable.NewInstanceAdminClient(project) + c, err := config.bigtableClientFactory.NewInstanceAdminClient(project) if err != nil { return fmt.Errorf("Error starting instance admin client. %s", err) } @@ -166,7 +166,7 @@ func resourceBigtableInstanceDestroy(d *schema.ResourceData, meta interface{}) e return err } - c, err := config.clientFactoryBigtable.NewInstanceAdminClient(project) + c, err := config.bigtableClientFactory.NewInstanceAdminClient(project) if err != nil { return fmt.Errorf("Error starting instance admin client. %s", err) } diff --git a/google/resource_bigtable_instance_test.go b/google/resource_bigtable_instance_test.go index 55a8d31f..95ad5a1f 100644 --- a/google/resource_bigtable_instance_test.go +++ b/google/resource_bigtable_instance_test.go @@ -37,7 +37,7 @@ func testAccCheckBigtableInstanceDestroy(s *terraform.State) error { } config := testAccProvider.Meta().(*Config) - c, err := config.clientFactoryBigtable.NewInstanceAdminClient(config.Project) + c, err := config.bigtableClientFactory.NewInstanceAdminClient(config.Project) if err != nil { return fmt.Errorf("Error starting instance admin client. %s", err) } @@ -77,7 +77,7 @@ func testAccBigtableInstanceExists(n string) resource.TestCheckFunc { return fmt.Errorf("No ID is set") } config := testAccProvider.Meta().(*Config) - c, err := config.clientFactoryBigtable.NewInstanceAdminClient(config.Project) + c, err := config.bigtableClientFactory.NewInstanceAdminClient(config.Project) if err != nil { return fmt.Errorf("Error starting instance admin client. %s", err) }