bump vendored sdk, remove extra fields
This commit is contained in:
parent
c4b23223ab
commit
4c4be8124a
|
@ -152,48 +152,48 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk",
|
||||||
"Comment": "0.0.2-17-gb0c6106",
|
"Comment": "0.0.2-19-gbe16cca",
|
||||||
"Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258"
|
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/aa",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/aa",
|
||||||
"Comment": "0.0.2-17-gb0c6106",
|
"Comment": "0.0.2-19-gbe16cca",
|
||||||
"Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258"
|
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/alert",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/alert",
|
||||||
"Comment": "0.0.2-17-gb0c6106",
|
"Comment": "0.0.2-19-gbe16cca",
|
||||||
"Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258"
|
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/api",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/api",
|
||||||
"Comment": "0.0.2-17-gb0c6106",
|
"Comment": "0.0.2-19-gbe16cca",
|
||||||
"Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258"
|
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/dc",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/dc",
|
||||||
"Comment": "0.0.2-17-gb0c6106",
|
"Comment": "0.0.2-19-gbe16cca",
|
||||||
"Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258"
|
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/group",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/group",
|
||||||
"Comment": "0.0.2-17-gb0c6106",
|
"Comment": "0.0.2-19-gbe16cca",
|
||||||
"Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258"
|
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/lb",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/lb",
|
||||||
"Comment": "0.0.2-17-gb0c6106",
|
"Comment": "0.0.2-19-gbe16cca",
|
||||||
"Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258"
|
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/server",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/server",
|
||||||
"Comment": "0.0.2-17-gb0c6106",
|
"Comment": "0.0.2-19-gbe16cca",
|
||||||
"Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258"
|
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/status",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/status",
|
||||||
"Comment": "0.0.2-17-gb0c6106",
|
"Comment": "0.0.2-19-gbe16cca",
|
||||||
"Rev": "b0c610652394ae6cac087e1e5d6de187c5f3f258"
|
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/DreamItGetIT/statuscake",
|
"ImportPath": "github.com/DreamItGetIT/statuscake",
|
||||||
|
@ -859,10 +859,6 @@
|
||||||
"ImportPath": "github.com/mattn/go-isatty",
|
"ImportPath": "github.com/mattn/go-isatty",
|
||||||
"Rev": "56b76bdf51f7708750eac80fa38b952bb9f32639"
|
"Rev": "56b76bdf51f7708750eac80fa38b952bb9f32639"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"ImportPath": "github.com/mikebeyer/env",
|
|
||||||
"Rev": "b6ce30ccdcad3ed9d5ca80329829f5aeaa856e99"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/mitchellh/cli",
|
"ImportPath": "github.com/mitchellh/cli",
|
||||||
"Rev": "cb6853d606ea4a12a15ac83cc43503df99fd28fb"
|
"Rev": "cb6853d606ea4a12a15ac83cc43503df99fd28fb"
|
||||||
|
|
|
@ -3,7 +3,6 @@ package clc
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/url"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
clc "github.com/CenturyLinkCloud/clc-sdk"
|
clc "github.com/CenturyLinkCloud/clc-sdk"
|
||||||
|
@ -31,18 +30,6 @@ func Provider() terraform.ResourceProvider {
|
||||||
DefaultFunc: schema.EnvDefaultFunc("CLC_PASSWORD", nil),
|
DefaultFunc: schema.EnvDefaultFunc("CLC_PASSWORD", nil),
|
||||||
Description: "Your CLC password",
|
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{
|
ResourcesMap: map[string]*schema.Resource{
|
||||||
|
@ -65,12 +52,6 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Failed to create CLC config with provided details: %v", err)
|
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)
|
config.UserAgent = fmt.Sprintf("terraform-clc terraform/%s", terraform.Version)
|
||||||
|
|
||||||
client := clc.New(config)
|
client := clc.New(config)
|
||||||
|
|
|
@ -11,8 +11,6 @@ import (
|
||||||
"net/http/httputil"
|
"net/http/httputil"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/mikebeyer/env"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var debug = os.Getenv("DEBUG") != ""
|
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.
|
// Defaults for Alias, BaseURL, and UserAgent will be taken from respective env vars.
|
||||||
func NewConfig(username, password string) (Config, error) {
|
func NewConfig(username, password string) (Config, error) {
|
||||||
alias := os.Getenv("CLC_ALIAS")
|
alias := os.Getenv("CLC_ALIAS")
|
||||||
agent := env.String("CLC_USER_AGENT", userAgentDefault)
|
agent := userAgentDefault
|
||||||
base := env.String("CLC_BASE_URL", baseUriDefault)
|
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)
|
uri, err := url.Parse(base)
|
||||||
return Config{
|
return Config{
|
||||||
User: User{
|
User: User{
|
||||||
|
|
|
@ -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.
|
|
|
@ -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)
|
|
||||||
}
|
|
||||||
~~~
|
|
|
@ -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
|
|
||||||
}
|
|
Loading…
Reference in New Issue