provider/google: gofmt
This commit is contained in:
parent
b26a85e5b2
commit
a1676f9eb1
|
@ -16,9 +16,9 @@ import (
|
||||||
"google.golang.org/api/compute/v1"
|
"google.golang.org/api/compute/v1"
|
||||||
"google.golang.org/api/container/v1"
|
"google.golang.org/api/container/v1"
|
||||||
"google.golang.org/api/dns/v1"
|
"google.golang.org/api/dns/v1"
|
||||||
|
"google.golang.org/api/pubsub/v1"
|
||||||
"google.golang.org/api/sqladmin/v1beta4"
|
"google.golang.org/api/sqladmin/v1beta4"
|
||||||
"google.golang.org/api/storage/v1"
|
"google.golang.org/api/storage/v1"
|
||||||
"google.golang.org/api/pubsub/v1"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config is the configuration structure used to instantiate the Google
|
// Config is the configuration structure used to instantiate the Google
|
||||||
|
@ -33,7 +33,7 @@ type Config struct {
|
||||||
clientDns *dns.Service
|
clientDns *dns.Service
|
||||||
clientStorage *storage.Service
|
clientStorage *storage.Service
|
||||||
clientSqlAdmin *sqladmin.Service
|
clientSqlAdmin *sqladmin.Service
|
||||||
clientPubsub *pubsub.Service
|
clientPubsub *pubsub.Service
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) loadAndValidate() error {
|
func (c *Config) loadAndValidate() error {
|
||||||
|
|
|
@ -70,8 +70,8 @@ func Provider() terraform.ResourceProvider {
|
||||||
"google_dns_record_set": resourceDnsRecordSet(),
|
"google_dns_record_set": resourceDnsRecordSet(),
|
||||||
"google_sql_database": resourceSqlDatabase(),
|
"google_sql_database": resourceSqlDatabase(),
|
||||||
"google_sql_database_instance": resourceSqlDatabaseInstance(),
|
"google_sql_database_instance": resourceSqlDatabaseInstance(),
|
||||||
"google_pubsub_topic": resourcePubsubTopic(),
|
"google_pubsub_topic": resourcePubsubTopic(),
|
||||||
"google_pubsub_subscription": resourcePubsubSubscription(),
|
"google_pubsub_subscription": resourcePubsubSubscription(),
|
||||||
"google_storage_bucket": resourceStorageBucket(),
|
"google_storage_bucket": resourceStorageBucket(),
|
||||||
"google_storage_bucket_acl": resourceStorageBucketAcl(),
|
"google_storage_bucket_acl": resourceStorageBucketAcl(),
|
||||||
"google_storage_bucket_object": resourceStorageBucketObject(),
|
"google_storage_bucket_object": resourceStorageBucketObject(),
|
||||||
|
|
|
@ -2,8 +2,8 @@ package google
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"google.golang.org/api/pubsub/v1"
|
|
||||||
"github.com/hashicorp/terraform/helper/schema"
|
"github.com/hashicorp/terraform/helper/schema"
|
||||||
|
"google.golang.org/api/pubsub/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func resourcePubsubSubscription() *schema.Resource {
|
func resourcePubsubSubscription() *schema.Resource {
|
||||||
|
@ -29,7 +29,7 @@ func resourcePubsubSubscription() *schema.Resource {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"attributes": &schema.Schema{
|
"attributes": &schema.Schema{
|
||||||
Type: schema.TypeMap,
|
Type: schema.TypeMap,
|
||||||
|
@ -52,14 +52,13 @@ func resourcePubsubSubscription() *schema.Resource {
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanAdditionalArgs(args map[string]interface{}) map[string]string {
|
func cleanAdditionalArgs(args map[string]interface{}) map[string]string {
|
||||||
cleaned_args := make(map[string]string)
|
cleaned_args := make(map[string]string)
|
||||||
for k,v := range args {
|
for k, v := range args {
|
||||||
cleaned_args[k] = v.(string)
|
cleaned_args[k] = v.(string)
|
||||||
}
|
}
|
||||||
return cleaned_args
|
return cleaned_args
|
||||||
|
@ -91,7 +90,7 @@ func resourcePubsubSubscriptionCreate(d *schema.ResourceData, meta interface{})
|
||||||
attributesClean := cleanAdditionalArgs(attributes)
|
attributesClean := cleanAdditionalArgs(attributes)
|
||||||
pushConfig := &pubsub.PushConfig{Attributes: attributesClean, PushEndpoint: push_config["push_endpoint"].(string)}
|
pushConfig := &pubsub.PushConfig{Attributes: attributesClean, PushEndpoint: push_config["push_endpoint"].(string)}
|
||||||
subscription = &pubsub.Subscription{AckDeadlineSeconds: ackDeadlineSeconds, Topic: computed_topic_name, PushConfig: pushConfig}
|
subscription = &pubsub.Subscription{AckDeadlineSeconds: ackDeadlineSeconds, Topic: computed_topic_name, PushConfig: pushConfig}
|
||||||
} else {
|
} else {
|
||||||
subscription = &pubsub.Subscription{AckDeadlineSeconds: ackDeadlineSeconds, Topic: computed_topic_name}
|
subscription = &pubsub.Subscription{AckDeadlineSeconds: ackDeadlineSeconds, Topic: computed_topic_name}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +99,7 @@ func resourcePubsubSubscriptionCreate(d *schema.ResourceData, meta interface{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
d.SetId(res.Name)
|
d.SetId(res.Name)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -108,7 +107,7 @@ func resourcePubsubSubscriptionCreate(d *schema.ResourceData, meta interface{})
|
||||||
|
|
||||||
func resourcePubsubSubscriptionRead(d *schema.ResourceData, meta interface{}) error {
|
func resourcePubsubSubscriptionRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
config := meta.(*Config)
|
config := meta.(*Config)
|
||||||
|
|
||||||
name := d.Id()
|
name := d.Id()
|
||||||
call := config.clientPubsub.Projects.Subscriptions.Get(name)
|
call := config.clientPubsub.Projects.Subscriptions.Get(name)
|
||||||
_, err := call.Do()
|
_, err := call.Do()
|
||||||
|
@ -119,7 +118,6 @@ func resourcePubsubSubscriptionRead(d *schema.ResourceData, meta interface{}) er
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func resourcePubsubSubscriptionDelete(d *schema.ResourceData, meta interface{}) error {
|
func resourcePubsubSubscriptionDelete(d *schema.ResourceData, meta interface{}) error {
|
||||||
config := meta.(*Config)
|
config := meta.(*Config)
|
||||||
|
|
||||||
|
@ -127,8 +125,8 @@ func resourcePubsubSubscriptionDelete(d *schema.ResourceData, meta interface{})
|
||||||
call := config.clientPubsub.Projects.Subscriptions.Delete(name)
|
call := config.clientPubsub.Projects.Subscriptions.Delete(name)
|
||||||
_, err := call.Do()
|
_, err := call.Do()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,4 +71,3 @@ resource "google_pubsub_subscription" "foobar_sub" {
|
||||||
name = "foobar_sub"
|
name = "foobar_sub"
|
||||||
topic = "${google_pubsub_topic.foobar_sub.name}"
|
topic = "${google_pubsub_topic.foobar_sub.name}"
|
||||||
}`
|
}`
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ package google
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"google.golang.org/api/pubsub/v1"
|
|
||||||
"github.com/hashicorp/terraform/helper/schema"
|
"github.com/hashicorp/terraform/helper/schema"
|
||||||
|
"google.golang.org/api/pubsub/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func resourcePubsubTopic() *schema.Resource {
|
func resourcePubsubTopic() *schema.Resource {
|
||||||
|
@ -18,7 +18,6 @@ func resourcePubsubTopic() *schema.Resource {
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +33,7 @@ func resourcePubsubTopicCreate(d *schema.ResourceData, meta interface{}) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
d.SetId(res.Name)
|
d.SetId(res.Name)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -42,7 +41,7 @@ func resourcePubsubTopicCreate(d *schema.ResourceData, meta interface{}) error {
|
||||||
|
|
||||||
func resourcePubsubTopicRead(d *schema.ResourceData, meta interface{}) error {
|
func resourcePubsubTopicRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
config := meta.(*Config)
|
config := meta.(*Config)
|
||||||
|
|
||||||
name := d.Id()
|
name := d.Id()
|
||||||
call := config.clientPubsub.Projects.Topics.Get(name)
|
call := config.clientPubsub.Projects.Topics.Get(name)
|
||||||
_, err := call.Do()
|
_, err := call.Do()
|
||||||
|
@ -53,7 +52,6 @@ func resourcePubsubTopicRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func resourcePubsubTopicDelete(d *schema.ResourceData, meta interface{}) error {
|
func resourcePubsubTopicDelete(d *schema.ResourceData, meta interface{}) error {
|
||||||
config := meta.(*Config)
|
config := meta.(*Config)
|
||||||
|
|
||||||
|
@ -61,8 +59,8 @@ func resourcePubsubTopicDelete(d *schema.ResourceData, meta interface{}) error {
|
||||||
call := config.clientPubsub.Projects.Topics.Delete(name)
|
call := config.clientPubsub.Projects.Topics.Delete(name)
|
||||||
_, err := call.Do()
|
_, err := call.Do()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue