From 4c4be8124a1767b02204a0f2e9e0afaeff7c15dd Mon Sep 17 00:00:00 2001 From: Albert Choi Date: Mon, 21 Mar 2016 14:39:39 -0700 Subject: [PATCH] bump vendored sdk, remove extra fields --- Godeps/Godeps.json | 40 +++++----- builtin/providers/clc/provider.go | 19 ----- .../CenturyLinkCloud/clc-sdk/api/api.go | 12 ++- vendor/github.com/mikebeyer/env/LICENSE.md | 22 ------ vendor/github.com/mikebeyer/env/README.md | 18 ----- vendor/github.com/mikebeyer/env/env.go | 73 ------------------- 6 files changed, 26 insertions(+), 158 deletions(-) delete mode 100644 vendor/github.com/mikebeyer/env/LICENSE.md delete mode 100644 vendor/github.com/mikebeyer/env/README.md delete mode 100644 vendor/github.com/mikebeyer/env/env.go diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index a67ad419d..3d5662ed1 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -152,48 +152,48 @@ }, { "ImportPath": "github.com/CenturyLinkCloud/clc-sdk", - "Comment": "0.0.2-17-gb0c6106", - "Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258" + "Comment": "0.0.2-19-gbe16cca", + "Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a" }, { "ImportPath": "github.com/CenturyLinkCloud/clc-sdk/aa", - "Comment": "0.0.2-17-gb0c6106", - "Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258" + "Comment": "0.0.2-19-gbe16cca", + "Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a" }, { "ImportPath": "github.com/CenturyLinkCloud/clc-sdk/alert", - "Comment": "0.0.2-17-gb0c6106", - "Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258" + "Comment": "0.0.2-19-gbe16cca", + "Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a" }, { "ImportPath": "github.com/CenturyLinkCloud/clc-sdk/api", - "Comment": "0.0.2-17-gb0c6106", - "Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258" + "Comment": "0.0.2-19-gbe16cca", + "Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a" }, { "ImportPath": "github.com/CenturyLinkCloud/clc-sdk/dc", - "Comment": "0.0.2-17-gb0c6106", - "Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258" + "Comment": "0.0.2-19-gbe16cca", + "Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a" }, { "ImportPath": "github.com/CenturyLinkCloud/clc-sdk/group", - "Comment": "0.0.2-17-gb0c6106", - "Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258" + "Comment": "0.0.2-19-gbe16cca", + "Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a" }, { "ImportPath": "github.com/CenturyLinkCloud/clc-sdk/lb", - "Comment": "0.0.2-17-gb0c6106", - "Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258" + "Comment": "0.0.2-19-gbe16cca", + "Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a" }, { "ImportPath": "github.com/CenturyLinkCloud/clc-sdk/server", - "Comment": "0.0.2-17-gb0c6106", - "Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258" + "Comment": "0.0.2-19-gbe16cca", + "Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a" }, { "ImportPath": "github.com/CenturyLinkCloud/clc-sdk/status", - "Comment": "0.0.2-17-gb0c6106", - "Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258" + "Comment": "0.0.2-19-gbe16cca", + "Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a" }, { "ImportPath": "github.com/DreamItGetIT/statuscake", @@ -859,10 +859,6 @@ "ImportPath": "github.com/mattn/go-isatty", "Rev": "56b76bdf51f7708750eac80fa38b952bb9f32639" }, - { - "ImportPath": "github.com/mikebeyer/env", - "Rev": "b6ce30ccdcad3ed9d5ca80329829f5aeaa856e99" - }, { "ImportPath": "github.com/mitchellh/cli", "Rev": "cb6853d606ea4a12a15ac83cc43503df99fd28fb" diff --git a/builtin/providers/clc/provider.go b/builtin/providers/clc/provider.go index 0a3142b10..32b1094e7 100644 --- a/builtin/providers/clc/provider.go +++ b/builtin/providers/clc/provider.go @@ -3,7 +3,6 @@ package clc import ( "fmt" "log" - "net/url" "strconv" clc "github.com/CenturyLinkCloud/clc-sdk" @@ -31,18 +30,6 @@ func Provider() terraform.ResourceProvider { DefaultFunc: schema.EnvDefaultFunc("CLC_PASSWORD", nil), Description: "Your CLC password", }, - "account": &schema.Schema{ - Type: schema.TypeString, - Required: true, - DefaultFunc: schema.EnvDefaultFunc("CLC_ACCOUNT", nil), - Description: "Your CLC account alias", - }, - "url": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Description: "Base CLC API url", - DefaultFunc: schema.EnvDefaultFunc("CLC_BASE_URL", nil), - }, }, ResourcesMap: map[string]*schema.Resource{ @@ -65,12 +52,6 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) { if err != nil { return nil, fmt.Errorf("Failed to create CLC config with provided details: %v", err) } - if urlStr := d.Get("url").(string); urlStr != "" { - uri, err := url.Parse(urlStr) - if err == nil { - config.BaseURL = uri - } - } config.UserAgent = fmt.Sprintf("terraform-clc terraform/%s", terraform.Version) client := clc.New(config) diff --git a/vendor/github.com/CenturyLinkCloud/clc-sdk/api/api.go b/vendor/github.com/CenturyLinkCloud/clc-sdk/api/api.go index 2fcefe11e..598609da7 100644 --- a/vendor/github.com/CenturyLinkCloud/clc-sdk/api/api.go +++ b/vendor/github.com/CenturyLinkCloud/clc-sdk/api/api.go @@ -11,8 +11,6 @@ import ( "net/http/httputil" "net/url" "os" - - "github.com/mikebeyer/env" ) var debug = os.Getenv("DEBUG") != "" @@ -182,8 +180,14 @@ func EnvConfig() (Config, error) { // Defaults for Alias, BaseURL, and UserAgent will be taken from respective env vars. func NewConfig(username, password string) (Config, error) { alias := os.Getenv("CLC_ALIAS") - agent := env.String("CLC_USER_AGENT", userAgentDefault) - base := env.String("CLC_BASE_URL", baseUriDefault) + agent := userAgentDefault + if v := os.Getenv("CLC_USER_AGENT"); v != "" { + agent = v + } + base := baseUriDefault + if v := os.Getenv("CLC_BASE_URL"); v != "" { + base = v + } uri, err := url.Parse(base) return Config{ User: User{ diff --git a/vendor/github.com/mikebeyer/env/LICENSE.md b/vendor/github.com/mikebeyer/env/LICENSE.md deleted file mode 100644 index a987eb884..000000000 --- a/vendor/github.com/mikebeyer/env/LICENSE.md +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License -=============== - -Copyright (c) 2015 Mike Beyer - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/mikebeyer/env/README.md b/vendor/github.com/mikebeyer/env/README.md deleted file mode 100644 index e60c7e773..000000000 --- a/vendor/github.com/mikebeyer/env/README.md +++ /dev/null @@ -1,18 +0,0 @@ -env -=== - -[ ![Codeship Status for mikebeyer/env](https://codeship.io/projects/d046ac90-ae6d-0132-79aa-6a5d0765ab36/status)](https://codeship.io/projects/68901) - - -Go implementation for default values for environment variables. - -~~~ go -package main - -import "github.com/mikebeyer/env" - -func main() { - port := env.String("PORT", "8080") - fmt.Printf("port: %s", port) -} -~~~ diff --git a/vendor/github.com/mikebeyer/env/env.go b/vendor/github.com/mikebeyer/env/env.go deleted file mode 100644 index d894a9963..000000000 --- a/vendor/github.com/mikebeyer/env/env.go +++ /dev/null @@ -1,73 +0,0 @@ -// Package env provides convenience wrapper around getting environment variables. -package env - -import ( - "fmt" - "os" - "strconv" -) - -// String gets string variable from the environment and -// returns it if it exists, otherwise it returns the default. -func String(key string, def string) string { - val := os.Getenv(key) - if val == "" { - return def - } - return val -} - -// MustString exits if an environment variable is not present. -func MustString(key string) string { - val := os.Getenv(key) - if val == "" { - fmt.Printf("%s must be provided.", key) - os.Exit(1) - } - return val -} - -// Int gets int variable from the environment and -// returns it if it exists, otherwise it returns the default. -func Int(key string, def int) int { - val := os.Getenv(key) - if val == "" { - return def - } - - i, err := strconv.Atoi(val) - if err != nil { - return def - } - return i -} - -// Bool gets boolean variable from the environment and -// returns it if it exists, otherwise it returns the default. -func Bool(key string, def bool) bool { - val := os.Getenv(key) - if val == "" { - return def - } - - b, err := strconv.ParseBool(val) - if err != nil { - return def - } - return b -} - -// Float gets float variable with a provided bit type from the environment and -// returns it if it exists, otherwise it returns the default. -func Float(key string, def float64, bit int) float64 { - val := os.Getenv(key) - if val == "" { - return def - } - - f, err := strconv.ParseFloat(val, bit) - if err != nil { - return def - } - return f -}