From 53f91ede949771fa9b1705070723c3a611813d90 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 10:45:23 +0000 Subject: [PATCH] Bump github.com/cloudfoundry-community/gautocloud from 1.3.2 to 1.4.0 (#28) --- go.mod | 3 +- go.sum | 14 +- .../gautocloud/README.md | 98 +++---- .../gautocloud/cloudenv/cf_cloudenv.go | 7 +- .../gautocloud/cloudenv/cloudenv.go | 18 +- .../gautocloud/cloudenv/env_var_cloudenv.go | 10 +- .../gautocloud/cloudenv/local_cloudenv.go | 5 +- .../gautocloud/connectors/connector.go | 26 +- .../gautocloud/connectors/generic/config.go | 4 +- .../gautocloud/decoder/decoder.go | 57 ++--- .../gautocloud/decoder/errors.go | 2 +- .../gautocloud/default_loader.go | 1 + .../gautocloud/interceptor/intercepter.go | 14 +- .../gautocloud/interceptor/overwrite.go | 2 +- .../gautocloud/interceptor/schema.go | 14 +- .../gautocloud/loader/errors.go | 6 +- .../gautocloud/loader/fake/fake_loader.go | 4 +- .../gautocloud/loader/loader.go | 71 +++--- .../cloudfoundry-community/gautocloud/main.go | 60 +++-- .../gautocloud/mocked_loader.go | 1 + vendor/github.com/satori/go.uuid/.travis.yml | 23 -- vendor/github.com/satori/go.uuid/LICENSE | 20 -- vendor/github.com/satori/go.uuid/README.md | 65 ----- vendor/github.com/satori/go.uuid/codec.go | 206 --------------- vendor/github.com/satori/go.uuid/generator.go | 239 ------------------ vendor/github.com/satori/go.uuid/sql.go | 78 ------ vendor/github.com/satori/go.uuid/uuid.go | 161 ------------ vendor/modules.txt | 7 +- 28 files changed, 210 insertions(+), 1006 deletions(-) delete mode 100644 vendor/github.com/satori/go.uuid/.travis.yml delete mode 100644 vendor/github.com/satori/go.uuid/LICENSE delete mode 100644 vendor/github.com/satori/go.uuid/README.md delete mode 100644 vendor/github.com/satori/go.uuid/codec.go delete mode 100644 vendor/github.com/satori/go.uuid/generator.go delete mode 100644 vendor/github.com/satori/go.uuid/sql.go delete mode 100644 vendor/github.com/satori/go.uuid/uuid.go diff --git a/go.mod b/go.mod index 31d6c96..b21fc7f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22.3 require ( code.cloudfoundry.org/lager v2.0.0+incompatible - github.com/cloudfoundry-community/gautocloud v1.3.2 + github.com/cloudfoundry-community/gautocloud v1.4.0 github.com/google/uuid v1.6.0 github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e github.com/pivotal-cf/brokerapi v6.4.2+incompatible @@ -25,7 +25,6 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/satori/go.uuid v1.2.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect diff --git a/go.sum b/go.sum index 2fd6f1f..e6327ee 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/azer/snakecase v1.0.0 h1:Gr9hfYVh6U96aUoGEbJK400H9KTiz6yCIYk3EN8n9hY= github.com/azer/snakecase v1.0.0/go.mod h1:iApMeoHF0YlMPzCwqH/d59E3w2s8SeO4rGK+iGClS8Y= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/cloudfoundry-community/gautocloud v1.3.2 h1:tWdGyiDc5lLlst/UxfEozGF+tUI7o07SDG7C6TVREOk= -github.com/cloudfoundry-community/gautocloud v1.3.2/go.mod h1:wCqg+daoyJ16++yT6ouXSrixE5NA74h9UaeRRKSelEA= +github.com/cloudfoundry-community/gautocloud v1.4.0 h1:S1GIAcpnENpFD2GgcOMmBMobD48V8FFTmOyOgh3IDl8= +github.com/cloudfoundry-community/gautocloud v1.4.0/go.mod h1:FBVUvBSBVLw6IOefb9Zokhr5VHFFglFQdoOr+UebwBE= github.com/cloudfoundry-community/go-cfenv v1.18.0 h1:dOIRSHUSaj4r6Q9Cx+nzz2OytHt+QNKqtOuKTQsa+zw= github.com/cloudfoundry-community/go-cfenv v1.18.0/go.mod h1:qGMSI6lygPzqugFs9M1NFjJBtEPgl0MgT6drMFZGUoU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -54,8 +54,8 @@ github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= -github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= +github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw= github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= @@ -73,8 +73,6 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sclevine/spec v1.2.0 h1:1Jwdf9jSfDl9NVmt8ndHqbTZ7XCCPbh1jI3hkDBHVYA= github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= @@ -114,8 +112,8 @@ golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/README.md b/vendor/github.com/cloudfoundry-community/gautocloud/README.md index 4035999..f9bac2b 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/README.md +++ b/vendor/github.com/cloudfoundry-community/gautocloud/README.md @@ -1,14 +1,14 @@ # Gautocloud [![Build Status](https://travis-ci.org/cloudfoundry-community/gautocloud.svg?branch=master)](https://travis-ci.org/cloudfoundry-community/gautocloud) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![GoDoc](https://godoc.org/github.com/cloudfoundry-community/gautocloud?status.svg)](https://godoc.org/github.com/cloudfoundry-community/gautocloud) -Gautocloud provides a simple abstraction that golang based applications can use -to discover information about the cloud environment on which they are running, -to connect to services automatically with ease of use in mind. It provides out-of-the-box support -for discovering common services on Heroku, Cloud Foundry and kubernetes cloud platforms, +Gautocloud provides a simple abstraction that golang based applications can use +to discover information about the cloud environment on which they are running, +to connect to services automatically with ease of use in mind. It provides out-of-the-box support +for discovering common services on Heroku, Cloud Foundry and kubernetes cloud platforms, and it supports custom automatic connectors. This project can be assimilated to the [spring-cloud-connector](https://github.com/spring-cloud/spring-cloud-connectors) project - but for golang (and with is own concepts). + but for golang (and with its own concepts). ## Summary @@ -34,7 +34,7 @@ This project can be assimilated to the [spring-cloud-connector](https://github.c ## Usage by example -Let's define a context: We are in a Cloud Foundry environment where we connect a MySql service on our +Let's define a context: We are in a Cloud Foundry environment where we connect a MySql service on our application. We now wants to use this service without parsing a json or anything else to have a MySql client to use our service. @@ -43,7 +43,7 @@ Gautocloud is here to help for this kind of use case. This software will retrieve all services found in your environment and will pass informations from service to what we call a connector. A connector is responsible to create, in our context, a MySql client which make it available in your program. -You only needs to import a connector to make it useable by gautocloud. +You only needs to import a connector to make it usable by gautocloud. This system of import let you have only what you need to run your app (=do not create a huge binary) and let the possibility to create custom connector. Example (provide a `*net/sql.DB` struct): @@ -61,7 +61,7 @@ import ( func init(){ // Gautocloud use logrus as logger, see: https://github.com/sirupsen/logrus // When using facade, first log messages are emitted with default level from logrus (INFO) and debug message cannot be seen. - // To be able to see log message on load simply add the env var `GAUTOCLOUD_DEBUG` to `true`, you will be able to + // To be able to see log message on load simply add the env var `GAUTOCLOUD_DEBUG` to `true`, you will be able to // see debug message from gautocloud (you can also set `json` instead of `true` to see logs as json). log.SetLevel(log.DebugLevel) } @@ -69,7 +69,7 @@ func init(){ func main() { appInfo := gautocloud.GetAppInfo() // retrieve all informations about your application instance fmt.Println(appInfo.Name) // give the app name - // by injection + // by injection var c *dbtype.MysqlDB // this is just a wrapper of *net/sql.DB you can use as normal sql.DB client err := gautocloud.Inject(&c) // you can also use gautocloud.InjectFromId("mysql", &c) where "mysql" is the id of the connector to use if err != nil { @@ -78,14 +78,14 @@ func main() { defer c.Close() // c is now useable as a *sql.DB // e.g.: err = c.Ping() - + // or you can also do by return // data, err := gautocloud.GetFirst("mysql") // if err != nil { // panic(err) // } // c = data.(*dbtype.MysqlDB) - + } ``` @@ -98,21 +98,21 @@ import ( "github.com/cloudfoundry-community/gautocloud/connectors/databases/dbtype" ) func main() { - // by injection + // by injection var cs []*dbtype.MysqlDB // this is just a wrapper of *net/sql.DB you can use as normal sql.DB client err := gautocloud.Inject(&cs) // you can also use gautocloud.InjectFromId("mysql", &cs) where "mysql" is the id of the connector to use if err != nil { panic(err) } // you have now a slice containing all mysql client you can have - + // or you can also do by return // data, err := gautocloud.GetAll("mysql") // a connector may give you different types that's why GetAll return a slice of interface{} // cs = make([]*dbtype.MysqlDB,0) // for _, elt := range data { // svcSlice = append(cs, elt.(*dbtype.MysqlDB)) // } - + } ``` @@ -148,7 +148,7 @@ You can see connectors made by the community on the dedicated wiki page: https:/ ### Heroku -**Tip**: you can also use in local but settings the env var `DYNO` and create env var corresponding +**Tip**: you can also use in local but settings the env var `DYNO` and create env var corresponding to a service you want to connect. (see: [/test-integration/test_integration_test.go](/test-integration/test_integration_test.go) as an example) - **Cloud Detection**: if the `DYNO` env var exists @@ -160,7 +160,7 @@ you have env var: - `MY_SVC_HOST=localhost` Connector required name `SVC`. -CloudEnv decode `MY_SVC_NAME` to [MY, SVC, NAME] and [MY, SVC, VALUE] +CloudEnv decode `MY_SVC_NAME` to [MY, SVC, NAME] and [MY, SVC, VALUE] and detect that there is SVC in those two env var. It returns a service with credentials: { @@ -168,8 +168,8 @@ It returns a service with credentials: "host": "localhost" } ``` -**Note**: -- if a env var key doesn't contains `_` (e.g.: `SVC=localhost`) it will give those credentials: `{"svc": "localhost", "uri": "localhost"}`. +**Note**: +- if a env var key doesn't contain `_` (e.g.: `SVC=localhost`) it will give those credentials: `{"svc": "localhost", "uri": "localhost"}`. - If the value of an env var is in json it will be decode the json and pass content as credentials **Retrieves**: @@ -190,7 +190,7 @@ you have env var: - `MY_SVC_SERVICE_HOST=localhost` Connector required name `SVC`. -CloudEnv remove `_SERVICE` from the key and decode `MY_SVC_NAME` to [MY, SVC, NAME] and [MY, SVC, VALUE] +CloudEnv remove `_SERVICE` from the key and decode `MY_SVC_NAME` to [MY, SVC, NAME] and [MY, SVC, VALUE] and detect that there is SVC in those two env var. It returns a service with credentials: { @@ -209,7 +209,7 @@ It returns a service with credentials: - **App information properties**: - `host`: (type: *string*) host of the app. - All values starting by `KUBERNETES` in env vars key. - + ### Local This is a special *CloudEnv* and can be considered as a fake one. This is cloud env is always triggered if none cloud env was found. @@ -218,13 +218,13 @@ You can also use it to be able to use a config file directly without pain (but i You can set the env var `CLOUD_FILE` which contains the path of a configuration files containing services. -You can create a `config file` called `config.yml` in your current working directory or set the env var `CONFIG_FILE` -which contains the path of your config file. It can contains anything you wants, this will register by itself a service +You can create a `config file` called `config.yml` in your current working directory or set the env var `CONFIG_FILE` +which contains the path of your config file. It can contain anything you want, this will register by itself a service named `config` with tag `config` which contains you configuration from the file. A `config file` or a `cloud file` can be a `yml`, `json`, `toml` or `hcl` file. -A `config file` can contains anything you wants, this will register by itself a service named `config` with tag `config` +A `config file` can contains anything you want, this will register by itself a service named `config` with tag `config` which contains you configuration from the file. A `cloud file` must follow this pattern (example in yml): @@ -248,7 +248,7 @@ You can see how to follow the same pattern with other format here: [/cloudenv/lo - **App information name**: The name given in the config file, if not set it will be `` - **App information properties**: *None* -**NOTE**: A `config` service is always created which permit to use [ConfigFileInterceptor](https://godoc.org/github.com/cloudfoundry-community/gautocloud/interceptor/configfile#ConfigFileInterceptor) +**NOTE**: A `config` service is always created which permit to use [ConfigFileInterceptor](https://godoc.org/github.com/cloudfoundry-community/gautocloud/interceptor/configfile#ConfigFileInterceptor) this is a great interceptor to use with a [generic config connector](https://github.com/cloudfoundry-community/gautocloud/blob/master/docs/connectors.md#config). ## Concept @@ -259,16 +259,16 @@ Gautocloud have a lot of black magics but in fact the concept is quite simple. ![Architecture](/docs/arch.png) -- **Loader**: It has the responsibility to find the *CloudEnv* where your program run, store *Connector*s and retrieve -services from *CloudEnv* which corresponds to one or many *Connector* and finally it will pass to *Connector* the service +- **Loader**: It has the responsibility to find the *CloudEnv* where your program run, store *Connector*s and retrieve +services from *CloudEnv* which corresponds to one or many *Connector*, and finally it will pass to *Connector* the service and store the result from connector. -- **Gautocloud *facade***: This facade was made to make things easier for users. It store one instance of a *Loader* - and give the ability to make lazy loading (this is why to register a *Connector* you only need to do `import _ "a/connector"`) -- **CloudEnv**: Each *CloudEnv* correspond to a real cloud. It manages the detection of the environment but +- **Gautocloud *facade***: This facade was made to make things easier for users. It stores one instance of a *Loader* + and give the ability to make lazy loading (this is why to register a *Connector* you only need to do `import _ "a/connector"`) +- **CloudEnv**: Each *CloudEnv* correspond to a real cloud. It manages the detection of the environment but also the detections of services asked by the *Loader*. -- **Connector**: A connector register itself on the loader when using *Gautocloud Facade*. It handles the conversion of +- **Connector**: A connector register itself on the loader when using *Gautocloud Facade*. It handles the conversion of a service to a real client or structure which can be manipulated after by user. -- **CloudDecoder**: This decoder do the conversion of a service to an expected schema. +- **CloudDecoder**: This decoder do the conversion of a service to an expected schema. In *Gautocloud* context this decoder is used to convert a given service to an expected schema given by a connector. This decoder can be used in other context. (see: [/decoder/decoder.go](/decoder/decoder.go) to know about it) @@ -286,8 +286,8 @@ The best way is to look at an example here: [/connectors/connector_example_test. You can also want to see how to create connector with interceptor here: [/connectors/intercepter_example_test.go](/connectors/intercepter_example_test.go). -**Note**: -- An interceptor work like a http middleware. +**Note**: +- An interceptor work like a http middleware. This permit to intercept data which will be given back by gautocloud and modified it before giving back to user. Interceptor should be used in a connector, to do so, connector have to implement ConnectorIntercepter: ```go @@ -299,14 +299,14 @@ type ConnectorIntercepter interface { ## Create your own Cloud Environment -The best way to implement yourself a cloud environment is too look at interface here [/cloudenv/cloudenv.go](/cloudenv/cloudenv.go). +The best way to implement yourself a cloud environment, is to look at the following interface: [/cloudenv/cloudenv.go](/cloudenv/cloudenv.go). -You will need to load you cloud env after by [use gautocloud without facade](#use-it-without-the-facade), +You will need to load you cloud env after by [use gautocloud without facade](#use-it-without-the-facade), you can either do a pull request to had your cloud environment as builtin by doing a pull request. ## Use it without the facade -We will take the same example as we see in [Usage by example](#usage-by-example) but we will not use the facade this time: +We will take the same example as we see in [Usage by example](#usage-by-example), but we will not use the facade this time: ```go package main @@ -333,18 +333,18 @@ func main() { }, ) ld.RegisterConnector(mysql.NewMysqlConnector()) // you need to manually register connectors - + appInfo := ld.GetAppInfo() // retrieve all informations about your application instance fmt.Println(appInfo.Name) // give the app name fmt.Println(appInfo.Port) // give the port to listen to - // by injection + // by injection var c *dbtype.MysqlDB // this is just a wrapper of *net/sql.DB you can use as normal sql.DB client err := ld.Inject(&c) // you can also use gautocloud.InjectFromId("mysql", &c) where "mysql" is the id of the connector to use if err != nil { panic(err) } defer c.Close() - + } ``` @@ -354,8 +354,8 @@ If you need to write your tests with a mocked gautocloud (and use the facade), y To perform this, simply run your test with the tags `gautocloud_mock` (e.g.: `go test -tags gautocloud_mock`). -The facade will load a [gomock](https://github.com/golang/mock) version of the loader. -You can find, for example, how to perform injection with this mocked version here: +The facade will load a [gomock](https://github.com/golang/mock) version of the loader. +You can find, for example, how to perform injection with this mocked version here: [/test-mock/test_mock_test.go](/test-mock/test_mock_test.go) (see also [gomock documentation](https://github.com/golang/mock) to learn more) ## Run tests @@ -381,18 +381,18 @@ Don't be shy to send a PR to add another cloud environment as a builtin one. **Why do I need to import a connector even if it's a builtin one ?** -You need to import it because if you didn't have to it, it will requires to load all default connectors with -associated dependencies to the connector which can make a huge binary. +You need to import it because if you didn't have to it, it will require to load all default connectors with +associated dependencies to the connector which can make a huge binary. In our case, it will compile only what you need by importing the connector. - + **Why the *CloudEnv* interface works with a concept of tags and name?** - -This concept comes directly from Cloud Foundry and the way it gives services. Cloud Foundry has a api called -[service brokers](https://docs.cloudfoundry.org/services/api.html) this api return services with tags and name. -This concept will now be used in the future by a lot of cloud environment (PaaS and CaaS) because this api have now -a dedicated governance managed by people from Google (Kubernetes in mind), Pivotal (Cloud Foundry), Red Hat (Openshift) ... +This concept comes directly from Cloud Foundry and the way it gives services. Cloud Foundry has an API called +[service brokers](https://docs.cloudfoundry.org/services/api.html) this api return services with tags and name. + +This concept will now be used in the future by a lot of cloud environment (PaaS and CaaS) because this api have now +a dedicated governance managed by people from Google (Kubernetes in mind), Pivotal (Cloud Foundry), Red Hat (Openshift) ... You can found their website here: https://www.openservicebrokerapi.org/ diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/cloudenv/cf_cloudenv.go b/vendor/github.com/cloudfoundry-community/gautocloud/cloudenv/cf_cloudenv.go index 9d9dfce..456affb 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/cloudenv/cf_cloudenv.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/cloudenv/cf_cloudenv.go @@ -44,6 +44,8 @@ func (c CfCloudEnv) convertCfServices(cfServices []cfenv.Service) []Service { } return services } + +// nolint:unused func (c CfCloudEnv) initAppEnv() error { if !c.IsInCloudEnv() { return nil @@ -77,10 +79,7 @@ func (c CfCloudEnv) GetServicesFromName(name string) []Service { return c.convertCfServices(servicesFound) } func (c CfCloudEnv) IsInCloudEnv() bool { - if os.Getenv("VCAP_APPLICATION") != "" { - return true - } - return false + return os.Getenv("VCAP_APPLICATION") != "" } func (c CfCloudEnv) GetAppInfo() AppInfo { return AppInfo{ diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/cloudenv/cloudenv.go b/vendor/github.com/cloudfoundry-community/gautocloud/cloudenv/cloudenv.go index 97b3dfc..81eecf1 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/cloudenv/cloudenv.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/cloudenv/cloudenv.go @@ -1,26 +1,26 @@ -// It manages the detection of the environment but also the detections of services asked by a Loader. +// Package cloudenv It manages the detection of the environment but also the detections of services asked by a Loader. package cloudenv import "regexp" -// You must implement this interface if you want to add another cloud environment +// CloudEnv You must implement this interface if you want to add another cloud environment // See the cf_cloudenv or heroku_cloudenv or local_cloudenv to have an example of implementation type CloudEnv interface { - // name of your cloud environment (e.g.: cloud foundry, heroku, local ...) + // Name The name of your cloud environment (e.g.: cloud foundry, heroku, local ...) Name() string - // The loader will call this function and pass a list of tags + // GetServicesFromTags The loader will call this function and pass a list of tags // You will need to give services which match with those tags - // NOTE: tag can be an regex, better to take this in consideration + // Note: tag can be an regex, better to take this in consideration GetServicesFromTags(tags []string) []Service - // the loader will call this function and pass a service name as a regex + // GetServicesFromName The loader will call this function and pass a service name as a regex // You will need to give services which match with this name GetServicesFromName(name string) []Service - // The loader will call this function to see if this cloud envionment can be use + // IsInCloudEnv The loader will call this function to see if this cloud environment can be use // This function should detect the targeted environment IsInCloudEnv() bool - // The loader will call this method to load the environment + // Load The loader will call this method to load the environment Load() error - // This need to return information about application instance information + // GetAppInfo This need to return information about application instance information GetAppInfo() AppInfo } type AppInfo struct { diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/cloudenv/env_var_cloudenv.go b/vendor/github.com/cloudfoundry-community/gautocloud/cloudenv/env_var_cloudenv.go index 2ada446..079f78d 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/cloudenv/env_var_cloudenv.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/cloudenv/env_var_cloudenv.go @@ -1,10 +1,10 @@ package cloudenv import ( + "bytes" + "encoding/json" "os" "strings" - "encoding/json" - "bytes" ) type EnvVarCloudEnv struct { @@ -33,20 +33,20 @@ func (c *EnvVarCloudEnv) InitEnv(environ []string) { for _, envVar := range environ { splitEnv := strings.Split(envVar, "=") envVars = append(envVars, EnvVar{ - Key: strings.ToLower(splitEnv[0]), + Key: strings.ToLower(splitEnv[0]), Value: strings.TrimSpace(strings.Join(splitEnv[1:], "=")), }) } c.envVars = envVars } -func (c EnvVarCloudEnv) GetServicesFromTags(tags []string) ([]Service) { +func (c EnvVarCloudEnv) GetServicesFromTags(tags []string) []Service { services := make([]Service, 0) for _, tag := range tags { services = append(services, c.getServicesFromPrefix(tag)...) } return services } -func (c EnvVarCloudEnv) GetServicesFromName(name string) ([]Service) { +func (c EnvVarCloudEnv) GetServicesFromName(name string) []Service { return c.getServicesFromPrefix(name) } func (c EnvVarCloudEnv) getServicesFromPrefix(prefix string) []Service { diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/cloudenv/local_cloudenv.go b/vendor/github.com/cloudfoundry-community/gautocloud/cloudenv/local_cloudenv.go index f1470d8..1ea19fe 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/cloudenv/local_cloudenv.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/cloudenv/local_cloudenv.go @@ -6,7 +6,7 @@ import ( "encoding/json" "errors" - "github.com/satori/go.uuid" + "github.com/google/uuid" "github.com/spf13/viper" "io" "path/filepath" @@ -225,6 +225,7 @@ func (c LocalCloudEnv) configPath() string { return confPath } +// nolint:unused func (c LocalCloudEnv) hasConfigFile() bool { return os.Getenv(LOCAL_CONFIG_ENV_KEY) != "" } @@ -237,7 +238,7 @@ func (c LocalCloudEnv) IsInCloudEnv() bool { func (c *LocalCloudEnv) GetAppInfo() AppInfo { id := c.id if id == "" { - id = uuid.NewV4().String() + id = uuid.NewString() c.id = id } return AppInfo{ diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/connectors/connector.go b/vendor/github.com/cloudfoundry-community/gautocloud/connectors/connector.go index d441698..8954bd9 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/connectors/connector.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/connectors/connector.go @@ -1,31 +1,33 @@ -// It handles the conversion of a service to a real client or structure which can be manipulated after by user. +// Package connectors It handles the conversion of a service to a real client or structure which can be manipulated after by user. package connectors import "github.com/cloudfoundry-community/gautocloud/interceptor" -// this is the interface to be implemented to create a new connector +// Connector This is the interface to be implemented to create a new connector // You should add an init function in the same package of your connector and register it automatically in gautocloud when importing your connector // Example of init function: -// func init() { -// gautocloud.RegisterConnector(NewMyConnector()) -// } +// +// func init() { +// gautocloud.RegisterConnector(NewMyConnector()) +// } +// // see implementation of any raw connectors to see how to implement a connector type Connector interface { - // This is the id of your connector and it must be unique and not have the same id of another connector - // Note: if a connector id is already taken gautocloud will complain + // Id This is the ID of your connector, and it must be unique and not have the same id of another connector + // Note: if a connector ID is already taken gautocloud will complain Id() string // Name is the name of a service to lookup in the cloud environment // Note: a regex can be passed Name() string - // This should return a list of tags which designed what kind of service you want + // Tags This should return a list of tags which designed what kind of service you want // example: mysql, database, rmdb ... // Note: a regex can be passed on each tag Tags() []string - // The parameter is a filled schema you gave in the function Schema - // The first value to return is what you want and you have no obligation to give always the same type. gautocloud is interface agnostic + // Load The parameter is a filled schema you gave in the function Schema + // The first value to return is what you want, and you have no obligation to give always the same type. gautocloud is interface agnostic // You can give an error if an error occurred, this error will appear in logs Load(interface{}) (interface{}, error) - // It must return a structure + // Schema It must return a structure // this structure will be used by the decoder to create a structure of the same type and filled with service's credentials found by a cloud environment // Here an example of what kind of structure you can return: // type MyStruct struct { @@ -38,7 +40,7 @@ type Connector interface { Schema() interface{} } -// If a connector want to intercept +// ConnectorIntercepter If a connector want to intercept type ConnectorIntercepter interface { Intercepter() interceptor.Intercepter } diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/connectors/generic/config.go b/vendor/github.com/cloudfoundry-community/gautocloud/connectors/generic/config.go index 6c63f6b..0310aae 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/connectors/generic/config.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/connectors/generic/config.go @@ -3,7 +3,7 @@ package generic import ( "github.com/cloudfoundry-community/gautocloud/connectors" "github.com/cloudfoundry-community/gautocloud/interceptor" - "github.com/satori/go.uuid" + "github.com/google/uuid" ) type ConfigGenericConnector struct { @@ -14,7 +14,7 @@ func NewConfigGenericConnector(config interface{}, interceptors ...interceptor.I return &ConfigGenericConnector{ SchemaBasedGenericConnector{ schema: config, - id: uuid.NewV4().String() + ":config", + id: uuid.NewString() + ":config", name: ".*config.*", tags: []string{"config.*"}, interceptors: interceptors, diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/decoder/decoder.go b/vendor/github.com/cloudfoundry-community/gautocloud/decoder/decoder.go index 29c5843..ebff166 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/decoder/decoder.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/decoder/decoder.go @@ -1,19 +1,19 @@ // Package decoder provide a way to decode credentials from a service to a structure -// It provide a cloud tag to help user match the correct credentials +// It provides a cloud tag to help user match the correct credentials // // This is what you can pass as a structure: -// // Name is key of a service credentials, decoder will look at any matching credentials which have the key name and will pass the value of this credentials -// Name string `cloud:"name"` // note: by default if you don't provide a cloud tag the key will be the field name in snake_case -// Uri decoder.ServiceUri // ServiceUri is a special type. Decoder will expect an uri as a value and will give a ServiceUri -// User string `cloud:".*user.*,regex"` // by passing `regex` in cloud tag it will say to decoder that the expected key must be match the regex -// Password string `cloud:".*user.*,regex" cloud-default:"apassword"` // by passing a tag named `cloud-default` decoder will understand that if the key is not found it must fill the field with this value -// Aslice []string `cloud:"aslice" cloud-default:"value1,value2"` // you can also pass a slice -// } +// +// // Name is key of a service credentials, decoder will look at any matching credentials which have the key name and will pass the value of this credentials +// Name string `cloud:"name"` // note: by default if you don't provide a cloud tag the key will be the field name in snake_case +// Uri decoder.ServiceUri // ServiceUri is a special type. Decoder will expect an uri as a value and will give a ServiceUri +// User string `cloud:".*user.*,regex"` // by passing `regex` in cloud tag it will say to decoder that the expected key must be match the regex +// Password string `cloud:".*user.*,regex" cloud-default:"apassword"` // by passing a tag named `cloud-default` decoder will understand that if the key is not found it must fill the field with this value +// Aslice []string `cloud:"aslice" cloud-default:"value1,value2"` // you can also pass a slice +// } package decoder import ( "encoding/json" - "errors" "fmt" "github.com/azer/snakecase" "net/url" @@ -52,8 +52,8 @@ type QueryUri struct { Value string } -// The Unmarshaler interface may be implemented by types to customize their -// behavior when being unmarshaled from a Map cloud. The UnmarshalCloud +// Unmarshaler This interface may be implemented by types to customize their +// behavior when being unmarshalled from a Map cloud. The UnmarshalCloud // method receives a function that may be called to unmarshal the original // value into a field or variable. It is safe to call the unmarshal // function parameter more than once if necessary. @@ -61,7 +61,7 @@ type Unmarshaler interface { UnmarshalCloud(data interface{}) error } -// Decode a map of credentials into a reflected Value +// UnmarshalToValue Decode a map of credentials into a reflected Value func UnmarshalToValue(serviceCredentials map[string]interface{}, ps reflect.Value, noDefaultVal bool) error { v := ps if ps.Kind() == reflect.Ptr { @@ -116,13 +116,13 @@ func UnmarshalToValue(serviceCredentials map[string]interface{}, ps reflect.Valu return nil } -// Decode a map of credentials into a structure +// Unmarshal Decode a map of credentials into a structure func Unmarshal(serviceCredentials map[string]interface{}, obj interface{}) error { ps := reflect.ValueOf(obj) return UnmarshalToValue(serviceCredentials, ps, false) } -// Decode a map of credentials into a structure without default values +// UnmarshalNoDefault Decode a map of credentials into a structure without default values func UnmarshalNoDefault(serviceCredentials map[string]interface{}, obj interface{}) error { ps := reflect.ValueOf(obj) return UnmarshalToValue(serviceCredentials, ps, true) @@ -179,43 +179,32 @@ func affect(data interface{}, vField reflect.Value, noDefaultVal bool) error { switch vField.Kind() { case reflect.String: vField.SetString(data.(string)) - break case reflect.Int: vField.SetInt(int64(parseForInt(data, vField).(int))) - break case reflect.Int8: vField.SetInt(int64(parseForInt(data, vField).(int8))) - break case reflect.Int16: vField.SetInt(int64(parseForInt(data, vField).(int16))) - break case reflect.Int32: vField.SetInt(int64(parseForInt(data, vField).(int32))) - break case reflect.Int64: vField.SetInt(parseForInt(data, vField).(int64)) - break case reflect.Uint: vField.SetUint(uint64(parseForInt(data, vField).(uint))) - break case reflect.Uint8: vField.SetUint(uint64(parseForInt(data, vField).(uint8))) - break case reflect.Uint16: vField.SetUint(uint64(parseForInt(data, vField).(uint16))) - break case reflect.Uint32: vField.SetUint(uint64(parseForInt(data, vField).(uint32))) - break case reflect.Uint64: vField.SetUint(parseForInt(data, vField).(uint64)) - break case reflect.Slice: if vField.IsNil() { vField.Set(reflect.MakeSlice(reflect.SliceOf(vField.Type().Elem()), 0, 0)) } if reflect.ValueOf(data).Kind() != reflect.Slice { - return errors.New(fmt.Sprintf("Type '%s' have not receive a slice.", vField.String())) + return fmt.Errorf("type '%s' have not receive a slice", vField.String()) } dataValue := reflect.ValueOf(data) @@ -252,19 +241,14 @@ func affect(data interface{}, vField reflect.Value, noDefaultVal bool) error { } vField.Set(reflect.Append(vField, newElem)) } - break case reflect.Interface: vField.Set(reflect.ValueOf(data)) - break case reflect.Bool: vField.SetBool(data.(bool)) - break case reflect.Float32: vField.SetFloat(parseForFloat(data, vField)) - break case reflect.Float64: vField.SetFloat(parseForFloat(data, vField)) - break case reflect.Ptr: if vField.IsNil() { vField.Set(reflect.New(vField.Type().Elem())) @@ -280,7 +264,6 @@ func affect(data interface{}, vField reflect.Value, noDefaultVal bool) error { if err != nil { return err } - break default: servUriType := reflect.TypeOf(ServiceUri{}) if vField.Type() != servUriType && reflect.TypeOf(data) != reflect.TypeOf(make(map[string]interface{})) { @@ -299,7 +282,6 @@ func affect(data interface{}, vField reflect.Value, noDefaultVal bool) error { } serviceUri := urlToServiceUri(serviceUrl) vField.Set(reflect.ValueOf(serviceUri)) - break } return nil } @@ -411,7 +393,7 @@ func match(matcher, content string) bool { return regex.MatchString(content) } func getKeyFromRegex(serviceCredentials map[string]interface{}, regexKey string) string { - for key, _ := range serviceCredentials { + for key := range serviceCredentials { if match(regexKey, key) { return key } @@ -487,9 +469,9 @@ func convertStringValue(defVal string, vField reflect.Value) (interface{}, error if err != nil { return "", err } - return int64(val), nil + return val, nil case reflect.Uint: - val, err := strconv.ParseUint(defVal, 10, int(strconv.IntSize)) + val, err := strconv.ParseUint(defVal, 10, strconv.IntSize) if err != nil { return "", err } @@ -517,7 +499,7 @@ func convertStringValue(defVal string, vField reflect.Value) (interface{}, error if err != nil { return "", err } - return uint64(val), nil + return val, nil case reflect.Bool: return strconv.ParseBool(defVal) case reflect.Float32: @@ -558,5 +540,4 @@ func convertStringValue(defVal string, vField reflect.Value) (interface{}, error } return defVal, nil } - return "", NewErrTypeNotSupported(vField) } diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/decoder/errors.go b/vendor/github.com/cloudfoundry-community/gautocloud/decoder/errors.go index 024dd00..0d53bbd 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/decoder/errors.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/decoder/errors.go @@ -1,8 +1,8 @@ package decoder import ( - "reflect" "fmt" + "reflect" ) type ErrTypeNotSupported struct { diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/default_loader.go b/vendor/github.com/cloudfoundry-community/gautocloud/default_loader.go index c445f8d..28b87d7 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/default_loader.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/default_loader.go @@ -1,3 +1,4 @@ +//go:build !gautocloud_mock // +build !gautocloud_mock package gautocloud diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/interceptor/intercepter.go b/vendor/github.com/cloudfoundry-community/gautocloud/interceptor/intercepter.go index b99579c..444ba6d 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/interceptor/intercepter.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/interceptor/intercepter.go @@ -1,12 +1,14 @@ -// This permit to intercept data which will be given back by gautocloud and modified it before giving back to user. +// Package interceptor This permit to intercept data which will be given back by gautocloud and modified it before giving back to user. // Interceptor should be used in a connector, to do so, connector have to implement ConnectorIntercepter: -// type ConnectorIntercepter interface { -// Intercepter() interceptor.Intercepter -// } +// +// type ConnectorIntercepter interface { +// Intercepter() interceptor.Intercepter +// } +// // An interceptor work like a http middleware. package interceptor -// This is the interface to implement to create an interceptor +// Intercepter This is the interface to implement to create an interceptor type Intercepter interface { // Current is interface given by user when using gautocloud.Inject(interfaceFromUser{}), // this can be nil if user doesn't use Inject functions from gautocloud. @@ -18,7 +20,7 @@ type Intercepter interface { Intercept(current, found interface{}) (interface{}, error) } -// The IntercepterFunc type is an adapter to allow the use of +// IntercepterFunc The IntercepterFunc type is an adapter to allow the use of // ordinary functions as Intercepter. If f is a function // with the appropriate signature, IntercepterFunc(f) is a // Intercepter that calls f. diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/interceptor/overwrite.go b/vendor/github.com/cloudfoundry-community/gautocloud/interceptor/overwrite.go index a120888..e3403c8 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/interceptor/overwrite.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/interceptor/overwrite.go @@ -4,7 +4,7 @@ import ( "reflect" ) -// This interceptor function let the user pre filled values inside is config structure to be used instead of use values +// NewOverwrite This interceptor function let the user pre-filled values inside is config structure to be used instead of use values // found by gautocloud. // This is useful for schema used in connector generic Config to let user write some values from config // before fill the rest by gautocloud. diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/interceptor/schema.go b/vendor/github.com/cloudfoundry-community/gautocloud/interceptor/schema.go index 6ae63ee..6362d51 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/interceptor/schema.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/interceptor/schema.go @@ -5,15 +5,15 @@ import ( "reflect" ) -// User must implement this interface on his struct/schema to be able to intercept injected value from gautocloud. -// User could now modified his own schema, gautocloud will use user schema as injection. +// SchemaIntercepter User must implement this interface on his struct/schema to be able to intercept injected value from gautocloud. +// User could now modify his own schema, gautocloud will use user schema as injection. type SchemaIntercepter interface { - // Found is the interface found by gautocloud. It has the exactly same type than the struct/schema which implements + // "Found" is the interface found by gautocloud. It has the exactly same type than the struct/schema which implements // this interface. Intercept(found interface{}) error } -// Interceptor to let user implements himself write an interception on his struct/schema. +// NewSchema Interceptor to let user implements himself write an interception on his struct/schema. // This interceptor will call function Intercept if schema/struct implements SchemaIntercepter from current. // It will return an error from intercept function if there is or the current interface after modification. // Tips: If current not found (user doesn't use inject functions from gautocloud) this is schema found which will be used @@ -27,7 +27,7 @@ func schema(current, found interface{}) (interface{}, error) { schema = found } if currentIntercept, ok := schema.(SchemaIntercepter); ok { - err := currentIntercept.(SchemaIntercepter).Intercept(found) + err := currentIntercept.Intercept(found) return schema, err } currentType := reflect.TypeOf(schema) @@ -37,7 +37,7 @@ func schema(current, found interface{}) (interface{}, error) { currentCopyElem := currentValue.Elem() currentCopy := currentCopyElem.Interface() if _, ok := currentCopy.(SchemaIntercepter); !ok { - return nil, fmt.Errorf("schema does not implement SchemaIntercepter.") + return nil, fmt.Errorf("schema does not implement SchemaIntercepter") } err := currentCopy.(SchemaIntercepter).Intercept(found) if err != nil { @@ -51,7 +51,7 @@ func schema(current, found interface{}) (interface{}, error) { currentCopyPtr.Elem().Set(currentValue) currentCopy := currentCopyPtr.Interface() if _, ok := currentCopy.(SchemaIntercepter); !ok { - return nil, fmt.Errorf("schema does not implement SchemaIntercepter.") + return nil, fmt.Errorf("schema does not implement SchemaIntercepter") } err := currentCopy.(SchemaIntercepter).Intercept(found) if err != nil { diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/loader/errors.go b/vendor/github.com/cloudfoundry-community/gautocloud/loader/errors.go index 5b67af2..88e1168 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/loader/errors.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/loader/errors.go @@ -1,17 +1,15 @@ package loader import ( - "strings" "fmt" + "strings" ) type ErrPtrNotGiven struct { } func NewErrPtrNotGiven() error { - return ErrPtrNotGiven{ - - } + return ErrPtrNotGiven{} } func (e ErrPtrNotGiven) Error() string { return "You must pass a pointer." diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/loader/fake/fake_loader.go b/vendor/github.com/cloudfoundry-community/gautocloud/loader/fake/fake_loader.go index 88053cd..96750f2 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/loader/fake/fake_loader.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/loader/fake/fake_loader.go @@ -8,13 +8,13 @@ import ( "log" ) -// Mock of Loader interface +// MockLoader Mock of Loader interface type MockLoader struct { ctrl *gomock.Controller recorder *_MockLoaderRecorder } -// Recorder for MockLoader (not exported) +// _MockLoaderRecorder Recorder for MockLoader (not exported) type _MockLoaderRecorder struct { mock *MockLoader } diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/loader/loader.go b/vendor/github.com/cloudfoundry-community/gautocloud/loader/loader.go index 9c05a14..033a5a0 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/loader/loader.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/loader/loader.go @@ -1,4 +1,4 @@ -// It has the responsibility to find the *CloudEnv* where your program run, store *Connector*s and retrieve +// Package loader It has the responsibility to find the *CloudEnv* where your program run, store *Connector*s and retrieve // services from *CloudEnv* which corresponds to one or many *Connector* and finally it will pass to *Connector* the service // and store the result from connector. package loader @@ -60,7 +60,7 @@ func newLoader(cloudEnvs []cloudenv.CloudEnv, logger *log.Logger) Loader { return loader } -// Create a new loader with cloud environment given +// NewLoader Create a new loader with cloud environment given func NewLoader(cloudEnvs []cloudenv.CloudEnv) Loader { if os.Getenv(DEBUG_MODE_ENV_VAR) != "" { log.SetLevel(log.DebugLevel) @@ -68,17 +68,17 @@ func NewLoader(cloudEnvs []cloudenv.CloudEnv) Loader { return newLoader(cloudEnvs, log.StandardLogger()) } -// Return all cloud environments loaded +// CloudEnvs Return all cloud environments loaded func (l GautocloudLoader) CloudEnvs() []cloudenv.CloudEnv { return l.cloudEnvs } -// Remove all registered connectors +// CleanConnectors Remove all registered connectors func (l *GautocloudLoader) CleanConnectors() { l.connectors = make(map[string]connectors.Connector) } -// Return all services loaded +// Store Return all services loaded func (l *GautocloudLoader) Store() map[string][]StoredService { return l.store } @@ -87,7 +87,7 @@ func logMessage(message string) string { return LOG_MESSAGE_PREFIX + ": " + message } -// Register a connector in the loader +// RegisterConnector Register a connector in the loader // This is mainly use for connectors creators func (l *GautocloudLoader) RegisterConnector(connector connectors.Connector) { if _, ok := l.connectors[connector.Id()]; ok { @@ -110,7 +110,7 @@ func (l *GautocloudLoader) RegisterConnector(connector connectors.Connector) { entry.Debugf(logMessage("Finished loading connector.")) } -// Return all registered connectors +// Connectors Return all registered connectors func (l GautocloudLoader) Connectors() map[string]connectors.Connector { return l.connectors } @@ -139,7 +139,7 @@ func (l GautocloudLoader) LoadCloudEnvs() { } } -// Reload connectors to find services +// ReloadConnectors Reload connectors to find services func (l *GautocloudLoader) ReloadConnectors() { l.LoadCloudEnvs() err := l.checkInCloudEnv() @@ -157,9 +157,11 @@ func (l *GautocloudLoader) ReloadConnectors() { // Inject service(s) found by connectors with given type // Example: -// var svc *dbtype.MysqlDB -// err = loader.Inject(&svc) -// // svc will have the value of the first service found with type *dbtype.MysqlDB +// +// var svc *dbtype.MysqlDB +// err = loader.Inject(&svc) +// // svc will have the value of the first service found with type *dbtype.MysqlDB +// // If service parameter is not a slice it will give the first service found // If you pass a slice of a type in service parameter, it will inject in the slice all services found with this type // It returns an error if parameter is not a pointer or if no service(s) can be found @@ -169,7 +171,7 @@ func (l GautocloudLoader) Inject(service interface{}) error { return err } notFound := true - for id, _ := range l.connectors { + for id := range l.connectors { err = l.InjectFromId(id, service) if err == nil && service != nil { notFound = false @@ -189,12 +191,12 @@ func (l GautocloudLoader) Inject(service interface{}) error { return NewErrGiveService("Service with the type " + reflectType.String() + " cannot be found. (perhaps no services match any connectors)") } -// Return the current cloud env detected +// CurrentCloudEnv Return the current cloud env detected func (l GautocloudLoader) CurrentCloudEnv() cloudenv.CloudEnv { return l.getFirstValidCloudEnv() } -// Return informations about instance of the running application +// GetAppInfo Return information about instance of the running application func (l GautocloudLoader) GetAppInfo() cloudenv.AppInfo { return l.getFirstValidCloudEnv().GetAppInfo() } @@ -212,7 +214,7 @@ func (l GautocloudLoader) getCloudEnvNames() []string { return names } -// Return true if you are in a cloud environment +// IsInACloudEnv Return true if you are in a cloud environment func (l GautocloudLoader) IsInACloudEnv() bool { for _, cloudEnv := range l.cloudEnvs { if !cloudEnv.IsInCloudEnv() { @@ -233,12 +235,14 @@ func (l GautocloudLoader) getFirstValidCloudEnv() cloudenv.CloudEnv { return finalCloudEnv } -// Inject service(s) found by a connector with given type +// InjectFromId Inject service(s) found by a connector with given type // id is the id of a connector // Example: -// var svc *dbtype.MysqlDB -// err = gautocloud.InjectFromId("mysql", &svc) -// // svc will have the value of the first service found with type *dbtype.MysqlDB in this case +// +// var svc *dbtype.MysqlDB +// err = gautocloud.InjectFromId("mysql", &svc) +// // svc will have the value of the first service found with type *dbtype.MysqlDB in this case +// // If service parameter is not a slice it will give the first service found // If you pass a slice of a type in service parameter, it will inject in the slice all services found with this type // It returns an error if service parameter is not a pointer, if no service(s) can be found and if connector with given id doesn't exist @@ -313,26 +317,31 @@ func (l GautocloudLoader) getData(store StoredService, current interface{}) (int entry.Debug(logMessage("Data intercepting by interceptor given by connector...")) finalData, err := store.Interceptor.Intercept(current, store.Data) if err != nil { - NewErrGiveService( + err := NewErrGiveService( fmt.Sprintf( "Error from interceptor given by connector for the type '%s': %s", store.ReflectType.String(), err.Error(), ), ) + if err != nil { + return nil, err + } return store.Data, err } entry.Debug(logMessage("Finished data intercepting by interceptor given by connector.")) return finalData, err } -// Return the first service found by a connector +// GetFirst Return the first service found by a connector // id is the id of a connector // Example: -// var svc *dbtype.MysqlDB -// data, err = gautocloud.GetFirst("mysql") -// svc = data.(*dbtype.MysqlDB) -// It returns the first service found or an error if no service can be found or if the connector doesn't exists +// +// var svc *dbtype.MysqlDB +// data, err = gautocloud.GetFirst("mysql") +// svc = data.(*dbtype.MysqlDB) +// +// It returns the first service found or an error if no service can be found or if the connector doesn't exist func (l GautocloudLoader) GetFirst(id string) (interface{}, error) { err := l.checkInCloudEnv() if err != nil { @@ -358,14 +367,16 @@ func (l GautocloudLoader) checkConnectorIdExist(id string) error { return nil } -// Return all services found by a connector +// GetAll Return all services found by a connector // id is the id of a connector // Example: -// var svc []interface{} -// data, err = gautocloud.GetAll("mysql") -// svc = data[0].(*dbtype.MysqlDB) +// +// var svc []interface{} +// data, err = gautocloud.GetAll("mysql") +// svc = data[0].(*dbtype.MysqlDB) +// // warning: a connector may give you different types that's why GetAll return a slice of interface{} -// It returns the first service found or an error if no service can be found or if the connector doesn't exists +// It returns the first service found or an error if no service can be found or if the connector doesn't exist func (l GautocloudLoader) GetAll(id string) ([]interface{}, error) { err := l.checkInCloudEnv() if err != nil { diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/main.go b/vendor/github.com/cloudfoundry-community/gautocloud/main.go index 8a97d4e..dff7f08 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/main.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/main.go @@ -6,17 +6,17 @@ import ( "github.com/cloudfoundry-community/gautocloud/loader" ) -// Return the loader used by the facade +// Loader Return the loader used by the facade func Loader() loader.Loader { return defaultLoader } -// Reload connectors to find services +// ReloadConnectors Reload connectors to find services func ReloadConnectors() { defaultLoader.ReloadConnectors() } -// Register a connector in the loader +// RegisterConnector Register a connector in the loader // This is mainly use for connectors creators func RegisterConnector(connector connectors.Connector) { defaultLoader.RegisterConnector(connector) @@ -24,9 +24,11 @@ func RegisterConnector(connector connectors.Connector) { // Inject service(s) found by connectors with given type // Example: -// var svc *dbtype.MysqlDB -// err = gautocloud.Inject(&svc) -// // svc will have the value of the first service found with type *dbtype.MysqlDB +// +// var svc *dbtype.MysqlDB +// err = gautocloud.Inject(&svc) +// // svc will have the value of the first service found with type *dbtype.MysqlDB +// // If service parameter is not a slice it will give the first service found // If you pass a slice of a type in service parameter, it will inject in the slice all services found with this type // It returns an error if parameter is not a pointer or if no service(s) can be found @@ -34,12 +36,14 @@ func Inject(service interface{}) error { return defaultLoader.Inject(service) } -// Inject service(s) found by a connector with given type +// InjectFromId Inject service(s) found by a connector with given type // id is the id of a connector // Example: -// var svc *dbtype.MysqlDB -// err = gautocloud.InjectFromId("mysql", &svc) -// // svc will have the value of the first service found with type *dbtype.MysqlDB in this case +// +// var svc *dbtype.MysqlDB +// err = gautocloud.InjectFromId("mysql", &svc) +// // svc will have the value of the first service found with type *dbtype.MysqlDB in this case +// // If service parameter is not a slice it will give the first service found // If you pass a slice of a type in service parameter, it will inject in the slice all services found with this type // It returns an error if service parameter is not a pointer, if no service(s) can be found and if connector with given id doesn't exist @@ -47,62 +51,64 @@ func InjectFromId(id string, service interface{}) error { return defaultLoader.InjectFromId(id, service) } -// Return the first service found by a connector +// GetFirst Return the first service found by a connector // id is the id of a connector // Example: -// var svc *dbtype.MysqlDB -// data, err = gautocloud.GetFirst("mysql") -// svc = data.(*dbtype.MysqlDB) // -// It returns the first service found or an error if no service can be found or if the connector doesn't exists +// var svc *dbtype.MysqlDB +// data, err = gautocloud.GetFirst("mysql") +// svc = data.(*dbtype.MysqlDB) +// +// It returns the first service found or an error if no service can be found or if the connector does not exist func GetFirst(id string) (interface{}, error) { return defaultLoader.GetFirst(id) } -// Return all services found by a connector +// GetAll Return all services found by a connector // id is the id of a connector // Example: -// var svc []interface{} -// data, err = gautocloud.GetAll("mysql") -// svc = data[0].(*dbtype.MysqlDB) +// +// var svc []interface{} +// data, err = gautocloud.GetAll("mysql") +// svc = data[0].(*dbtype.MysqlDB) // // warning: a connector may give you different types that's why GetAll return a slice of interface{} -// It returns the first service found or an error if no service can be found or if the connector doesn't exists +// It returns the first service found or an error if no service can be found or if the connector does not exist func GetAll(id string) ([]interface{}, error) { return defaultLoader.GetAll(id) } -// Return all cloud environments loaded +// CloudEnvs Return all cloud environments loaded func CloudEnvs() []cloudenv.CloudEnv { return defaultLoader.CloudEnvs() } -// Return all registered connectors +// Connectors Return all registered connectors func Connectors() map[string]connectors.Connector { return defaultLoader.Connectors() } -// Return all services loaded +// Store Return all services loaded func Store() map[string][]loader.StoredService { return defaultLoader.Store() } -// Remove all registered connectors +// CleanConnectors Remove all registered connectors func CleanConnectors() { defaultLoader.CleanConnectors() } -// Return the current cloud env detected +// CurrentCloudEnv Return the current cloud env detected func CurrentCloudEnv() cloudenv.CloudEnv { return defaultLoader.CurrentCloudEnv() } -// Return informations about instance of the running application +// GetAppInfo Return information about instance of the running application func GetAppInfo() cloudenv.AppInfo { return defaultLoader.GetAppInfo() } -// Return true if you are in a cloud environment +// IsInACloudEnv Return true if you are in a cloud environment func IsInACloudEnv() bool { return defaultLoader.IsInACloudEnv() } diff --git a/vendor/github.com/cloudfoundry-community/gautocloud/mocked_loader.go b/vendor/github.com/cloudfoundry-community/gautocloud/mocked_loader.go index d493b74..4a75436 100644 --- a/vendor/github.com/cloudfoundry-community/gautocloud/mocked_loader.go +++ b/vendor/github.com/cloudfoundry-community/gautocloud/mocked_loader.go @@ -1,3 +1,4 @@ +//go:build gautocloud_mock // +build gautocloud_mock package gautocloud diff --git a/vendor/github.com/satori/go.uuid/.travis.yml b/vendor/github.com/satori/go.uuid/.travis.yml deleted file mode 100644 index 20dd53b..0000000 --- a/vendor/github.com/satori/go.uuid/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: go -sudo: false -go: - - 1.2 - - 1.3 - - 1.4 - - 1.5 - - 1.6 - - 1.7 - - 1.8 - - 1.9 - - tip -matrix: - allow_failures: - - go: tip - fast_finish: true -before_install: - - go get github.com/mattn/goveralls - - go get golang.org/x/tools/cmd/cover -script: - - $HOME/gopath/bin/goveralls -service=travis-ci -notifications: - email: false diff --git a/vendor/github.com/satori/go.uuid/LICENSE b/vendor/github.com/satori/go.uuid/LICENSE deleted file mode 100644 index 926d549..0000000 --- a/vendor/github.com/satori/go.uuid/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (C) 2013-2018 by Maxim Bublis - -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/satori/go.uuid/README.md b/vendor/github.com/satori/go.uuid/README.md deleted file mode 100644 index 7b1a722..0000000 --- a/vendor/github.com/satori/go.uuid/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# UUID package for Go language - -[![Build Status](https://travis-ci.org/satori/go.uuid.png?branch=master)](https://travis-ci.org/satori/go.uuid) -[![Coverage Status](https://coveralls.io/repos/github/satori/go.uuid/badge.svg?branch=master)](https://coveralls.io/github/satori/go.uuid) -[![GoDoc](http://godoc.org/github.com/satori/go.uuid?status.png)](http://godoc.org/github.com/satori/go.uuid) - -This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing of UUIDs. - -With 100% test coverage and benchmarks out of box. - -Supported versions: -* Version 1, based on timestamp and MAC address (RFC 4122) -* Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1) -* Version 3, based on MD5 hashing (RFC 4122) -* Version 4, based on random numbers (RFC 4122) -* Version 5, based on SHA-1 hashing (RFC 4122) - -## Installation - -Use the `go` command: - - $ go get github.com/satori/go.uuid - -## Requirements - -UUID package requires Go >= 1.2. - -## Example - -```go -package main - -import ( - "fmt" - "github.com/satori/go.uuid" -) - -func main() { - // Creating UUID Version 4 - u1 := uuid.NewV4() - fmt.Printf("UUIDv4: %s\n", u1) - - // Parsing UUID from string input - u2, err := uuid.FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - if err != nil { - fmt.Printf("Something gone wrong: %s", err) - } - fmt.Printf("Successfully parsed: %s", u2) -} -``` - -## Documentation - -[Documentation](http://godoc.org/github.com/satori/go.uuid) is hosted at GoDoc project. - -## Links -* [RFC 4122](http://tools.ietf.org/html/rfc4122) -* [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01) - -## Copyright - -Copyright (C) 2013-2018 by Maxim Bublis . - -UUID package released under MIT License. -See [LICENSE](https://github.com/satori/go.uuid/blob/master/LICENSE) for details. diff --git a/vendor/github.com/satori/go.uuid/codec.go b/vendor/github.com/satori/go.uuid/codec.go deleted file mode 100644 index 656892c..0000000 --- a/vendor/github.com/satori/go.uuid/codec.go +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (C) 2013-2018 by Maxim Bublis -// -// 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. - -package uuid - -import ( - "bytes" - "encoding/hex" - "fmt" -) - -// FromBytes returns UUID converted from raw byte slice input. -// It will return error if the slice isn't 16 bytes long. -func FromBytes(input []byte) (u UUID, err error) { - err = u.UnmarshalBinary(input) - return -} - -// FromBytesOrNil returns UUID converted from raw byte slice input. -// Same behavior as FromBytes, but returns a Nil UUID on error. -func FromBytesOrNil(input []byte) UUID { - uuid, err := FromBytes(input) - if err != nil { - return Nil - } - return uuid -} - -// FromString returns UUID parsed from string input. -// Input is expected in a form accepted by UnmarshalText. -func FromString(input string) (u UUID, err error) { - err = u.UnmarshalText([]byte(input)) - return -} - -// FromStringOrNil returns UUID parsed from string input. -// Same behavior as FromString, but returns a Nil UUID on error. -func FromStringOrNil(input string) UUID { - uuid, err := FromString(input) - if err != nil { - return Nil - } - return uuid -} - -// MarshalText implements the encoding.TextMarshaler interface. -// The encoding is the same as returned by String. -func (u UUID) MarshalText() (text []byte, err error) { - text = []byte(u.String()) - return -} - -// UnmarshalText implements the encoding.TextUnmarshaler interface. -// Following formats are supported: -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8", -// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", -// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" -// "6ba7b8109dad11d180b400c04fd430c8" -// ABNF for supported UUID text representation follows: -// uuid := canonical | hashlike | braced | urn -// plain := canonical | hashlike -// canonical := 4hexoct '-' 2hexoct '-' 2hexoct '-' 6hexoct -// hashlike := 12hexoct -// braced := '{' plain '}' -// urn := URN ':' UUID-NID ':' plain -// URN := 'urn' -// UUID-NID := 'uuid' -// 12hexoct := 6hexoct 6hexoct -// 6hexoct := 4hexoct 2hexoct -// 4hexoct := 2hexoct 2hexoct -// 2hexoct := hexoct hexoct -// hexoct := hexdig hexdig -// hexdig := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | -// 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | -// 'A' | 'B' | 'C' | 'D' | 'E' | 'F' -func (u *UUID) UnmarshalText(text []byte) (err error) { - switch len(text) { - case 32: - return u.decodeHashLike(text) - case 36: - return u.decodeCanonical(text) - case 38: - return u.decodeBraced(text) - case 41: - fallthrough - case 45: - return u.decodeURN(text) - default: - return fmt.Errorf("uuid: incorrect UUID length: %s", text) - } -} - -// decodeCanonical decodes UUID string in format -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8". -func (u *UUID) decodeCanonical(t []byte) (err error) { - if t[8] != '-' || t[13] != '-' || t[18] != '-' || t[23] != '-' { - return fmt.Errorf("uuid: incorrect UUID format %s", t) - } - - src := t[:] - dst := u[:] - - for i, byteGroup := range byteGroups { - if i > 0 { - src = src[1:] // skip dash - } - _, err = hex.Decode(dst[:byteGroup/2], src[:byteGroup]) - if err != nil { - return - } - src = src[byteGroup:] - dst = dst[byteGroup/2:] - } - - return -} - -// decodeHashLike decodes UUID string in format -// "6ba7b8109dad11d180b400c04fd430c8". -func (u *UUID) decodeHashLike(t []byte) (err error) { - src := t[:] - dst := u[:] - - if _, err = hex.Decode(dst, src); err != nil { - return err - } - return -} - -// decodeBraced decodes UUID string in format -// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" or in format -// "{6ba7b8109dad11d180b400c04fd430c8}". -func (u *UUID) decodeBraced(t []byte) (err error) { - l := len(t) - - if t[0] != '{' || t[l-1] != '}' { - return fmt.Errorf("uuid: incorrect UUID format %s", t) - } - - return u.decodePlain(t[1 : l-1]) -} - -// decodeURN decodes UUID string in format -// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in format -// "urn:uuid:6ba7b8109dad11d180b400c04fd430c8". -func (u *UUID) decodeURN(t []byte) (err error) { - total := len(t) - - urn_uuid_prefix := t[:9] - - if !bytes.Equal(urn_uuid_prefix, urnPrefix) { - return fmt.Errorf("uuid: incorrect UUID format: %s", t) - } - - return u.decodePlain(t[9:total]) -} - -// decodePlain decodes UUID string in canonical format -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in hash-like format -// "6ba7b8109dad11d180b400c04fd430c8". -func (u *UUID) decodePlain(t []byte) (err error) { - switch len(t) { - case 32: - return u.decodeHashLike(t) - case 36: - return u.decodeCanonical(t) - default: - return fmt.Errorf("uuid: incorrrect UUID length: %s", t) - } -} - -// MarshalBinary implements the encoding.BinaryMarshaler interface. -func (u UUID) MarshalBinary() (data []byte, err error) { - data = u.Bytes() - return -} - -// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. -// It will return error if the slice isn't 16 bytes long. -func (u *UUID) UnmarshalBinary(data []byte) (err error) { - if len(data) != Size { - err = fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data)) - return - } - copy(u[:], data) - - return -} diff --git a/vendor/github.com/satori/go.uuid/generator.go b/vendor/github.com/satori/go.uuid/generator.go deleted file mode 100644 index 3f2f1da..0000000 --- a/vendor/github.com/satori/go.uuid/generator.go +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright (C) 2013-2018 by Maxim Bublis -// -// 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. - -package uuid - -import ( - "crypto/md5" - "crypto/rand" - "crypto/sha1" - "encoding/binary" - "hash" - "net" - "os" - "sync" - "time" -) - -// Difference in 100-nanosecond intervals between -// UUID epoch (October 15, 1582) and Unix epoch (January 1, 1970). -const epochStart = 122192928000000000 - -var ( - global = newDefaultGenerator() - - epochFunc = unixTimeFunc - posixUID = uint32(os.Getuid()) - posixGID = uint32(os.Getgid()) -) - -// NewV1 returns UUID based on current timestamp and MAC address. -func NewV1() UUID { - return global.NewV1() -} - -// NewV2 returns DCE Security UUID based on POSIX UID/GID. -func NewV2(domain byte) UUID { - return global.NewV2(domain) -} - -// NewV3 returns UUID based on MD5 hash of namespace UUID and name. -func NewV3(ns UUID, name string) UUID { - return global.NewV3(ns, name) -} - -// NewV4 returns random generated UUID. -func NewV4() UUID { - return global.NewV4() -} - -// NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. -func NewV5(ns UUID, name string) UUID { - return global.NewV5(ns, name) -} - -// Generator provides interface for generating UUIDs. -type Generator interface { - NewV1() UUID - NewV2(domain byte) UUID - NewV3(ns UUID, name string) UUID - NewV4() UUID - NewV5(ns UUID, name string) UUID -} - -// Default generator implementation. -type generator struct { - storageOnce sync.Once - storageMutex sync.Mutex - - lastTime uint64 - clockSequence uint16 - hardwareAddr [6]byte -} - -func newDefaultGenerator() Generator { - return &generator{} -} - -// NewV1 returns UUID based on current timestamp and MAC address. -func (g *generator) NewV1() UUID { - u := UUID{} - - timeNow, clockSeq, hardwareAddr := g.getStorage() - - binary.BigEndian.PutUint32(u[0:], uint32(timeNow)) - binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) - binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) - binary.BigEndian.PutUint16(u[8:], clockSeq) - - copy(u[10:], hardwareAddr) - - u.SetVersion(V1) - u.SetVariant(VariantRFC4122) - - return u -} - -// NewV2 returns DCE Security UUID based on POSIX UID/GID. -func (g *generator) NewV2(domain byte) UUID { - u := UUID{} - - timeNow, clockSeq, hardwareAddr := g.getStorage() - - switch domain { - case DomainPerson: - binary.BigEndian.PutUint32(u[0:], posixUID) - case DomainGroup: - binary.BigEndian.PutUint32(u[0:], posixGID) - } - - binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) - binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) - binary.BigEndian.PutUint16(u[8:], clockSeq) - u[9] = domain - - copy(u[10:], hardwareAddr) - - u.SetVersion(V2) - u.SetVariant(VariantRFC4122) - - return u -} - -// NewV3 returns UUID based on MD5 hash of namespace UUID and name. -func (g *generator) NewV3(ns UUID, name string) UUID { - u := newFromHash(md5.New(), ns, name) - u.SetVersion(V3) - u.SetVariant(VariantRFC4122) - - return u -} - -// NewV4 returns random generated UUID. -func (g *generator) NewV4() UUID { - u := UUID{} - g.safeRandom(u[:]) - u.SetVersion(V4) - u.SetVariant(VariantRFC4122) - - return u -} - -// NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. -func (g *generator) NewV5(ns UUID, name string) UUID { - u := newFromHash(sha1.New(), ns, name) - u.SetVersion(V5) - u.SetVariant(VariantRFC4122) - - return u -} - -func (g *generator) initStorage() { - g.initClockSequence() - g.initHardwareAddr() -} - -func (g *generator) initClockSequence() { - buf := make([]byte, 2) - g.safeRandom(buf) - g.clockSequence = binary.BigEndian.Uint16(buf) -} - -func (g *generator) initHardwareAddr() { - interfaces, err := net.Interfaces() - if err == nil { - for _, iface := range interfaces { - if len(iface.HardwareAddr) >= 6 { - copy(g.hardwareAddr[:], iface.HardwareAddr) - return - } - } - } - - // Initialize hardwareAddr randomly in case - // of real network interfaces absence - g.safeRandom(g.hardwareAddr[:]) - - // Set multicast bit as recommended in RFC 4122 - g.hardwareAddr[0] |= 0x01 -} - -func (g *generator) safeRandom(dest []byte) { - if _, err := rand.Read(dest); err != nil { - panic(err) - } -} - -// Returns UUID v1/v2 storage state. -// Returns epoch timestamp, clock sequence, and hardware address. -func (g *generator) getStorage() (uint64, uint16, []byte) { - g.storageOnce.Do(g.initStorage) - - g.storageMutex.Lock() - defer g.storageMutex.Unlock() - - timeNow := epochFunc() - // Clock changed backwards since last UUID generation. - // Should increase clock sequence. - if timeNow <= g.lastTime { - g.clockSequence++ - } - g.lastTime = timeNow - - return timeNow, g.clockSequence, g.hardwareAddr[:] -} - -// Returns difference in 100-nanosecond intervals between -// UUID epoch (October 15, 1582) and current time. -// This is default epoch calculation function. -func unixTimeFunc() uint64 { - return epochStart + uint64(time.Now().UnixNano()/100) -} - -// Returns UUID based on hashing of namespace UUID and name. -func newFromHash(h hash.Hash, ns UUID, name string) UUID { - u := UUID{} - h.Write(ns[:]) - h.Write([]byte(name)) - copy(u[:], h.Sum(nil)) - - return u -} diff --git a/vendor/github.com/satori/go.uuid/sql.go b/vendor/github.com/satori/go.uuid/sql.go deleted file mode 100644 index 56759d3..0000000 --- a/vendor/github.com/satori/go.uuid/sql.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (C) 2013-2018 by Maxim Bublis -// -// 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. - -package uuid - -import ( - "database/sql/driver" - "fmt" -) - -// Value implements the driver.Valuer interface. -func (u UUID) Value() (driver.Value, error) { - return u.String(), nil -} - -// Scan implements the sql.Scanner interface. -// A 16-byte slice is handled by UnmarshalBinary, while -// a longer byte slice or a string is handled by UnmarshalText. -func (u *UUID) Scan(src interface{}) error { - switch src := src.(type) { - case []byte: - if len(src) == Size { - return u.UnmarshalBinary(src) - } - return u.UnmarshalText(src) - - case string: - return u.UnmarshalText([]byte(src)) - } - - return fmt.Errorf("uuid: cannot convert %T to UUID", src) -} - -// NullUUID can be used with the standard sql package to represent a -// UUID value that can be NULL in the database -type NullUUID struct { - UUID UUID - Valid bool -} - -// Value implements the driver.Valuer interface. -func (u NullUUID) Value() (driver.Value, error) { - if !u.Valid { - return nil, nil - } - // Delegate to UUID Value function - return u.UUID.Value() -} - -// Scan implements the sql.Scanner interface. -func (u *NullUUID) Scan(src interface{}) error { - if src == nil { - u.UUID, u.Valid = Nil, false - return nil - } - - // Delegate to UUID Scan function - u.Valid = true - return u.UUID.Scan(src) -} diff --git a/vendor/github.com/satori/go.uuid/uuid.go b/vendor/github.com/satori/go.uuid/uuid.go deleted file mode 100644 index a2b8e2c..0000000 --- a/vendor/github.com/satori/go.uuid/uuid.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (C) 2013-2018 by Maxim Bublis -// -// 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. - -// Package uuid provides implementation of Universally Unique Identifier (UUID). -// Supported versions are 1, 3, 4 and 5 (as specified in RFC 4122) and -// version 2 (as specified in DCE 1.1). -package uuid - -import ( - "bytes" - "encoding/hex" -) - -// Size of a UUID in bytes. -const Size = 16 - -// UUID representation compliant with specification -// described in RFC 4122. -type UUID [Size]byte - -// UUID versions -const ( - _ byte = iota - V1 - V2 - V3 - V4 - V5 -) - -// UUID layout variants. -const ( - VariantNCS byte = iota - VariantRFC4122 - VariantMicrosoft - VariantFuture -) - -// UUID DCE domains. -const ( - DomainPerson = iota - DomainGroup - DomainOrg -) - -// String parse helpers. -var ( - urnPrefix = []byte("urn:uuid:") - byteGroups = []int{8, 4, 4, 4, 12} -) - -// Nil is special form of UUID that is specified to have all -// 128 bits set to zero. -var Nil = UUID{} - -// Predefined namespace UUIDs. -var ( - NamespaceDNS = Must(FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) - NamespaceURL = Must(FromString("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) - NamespaceOID = Must(FromString("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) - NamespaceX500 = Must(FromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) -) - -// Equal returns true if u1 and u2 equals, otherwise returns false. -func Equal(u1 UUID, u2 UUID) bool { - return bytes.Equal(u1[:], u2[:]) -} - -// Version returns algorithm version used to generate UUID. -func (u UUID) Version() byte { - return u[6] >> 4 -} - -// Variant returns UUID layout variant. -func (u UUID) Variant() byte { - switch { - case (u[8] >> 7) == 0x00: - return VariantNCS - case (u[8] >> 6) == 0x02: - return VariantRFC4122 - case (u[8] >> 5) == 0x06: - return VariantMicrosoft - case (u[8] >> 5) == 0x07: - fallthrough - default: - return VariantFuture - } -} - -// Bytes returns bytes slice representation of UUID. -func (u UUID) Bytes() []byte { - return u[:] -} - -// Returns canonical string representation of UUID: -// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. -func (u UUID) String() string { - buf := make([]byte, 36) - - hex.Encode(buf[0:8], u[0:4]) - buf[8] = '-' - hex.Encode(buf[9:13], u[4:6]) - buf[13] = '-' - hex.Encode(buf[14:18], u[6:8]) - buf[18] = '-' - hex.Encode(buf[19:23], u[8:10]) - buf[23] = '-' - hex.Encode(buf[24:], u[10:]) - - return string(buf) -} - -// SetVersion sets version bits. -func (u *UUID) SetVersion(v byte) { - u[6] = (u[6] & 0x0f) | (v << 4) -} - -// SetVariant sets variant bits. -func (u *UUID) SetVariant(v byte) { - switch v { - case VariantNCS: - u[8] = (u[8]&(0xff>>1) | (0x00 << 7)) - case VariantRFC4122: - u[8] = (u[8]&(0xff>>2) | (0x02 << 6)) - case VariantMicrosoft: - u[8] = (u[8]&(0xff>>3) | (0x06 << 5)) - case VariantFuture: - fallthrough - default: - u[8] = (u[8]&(0xff>>3) | (0x07 << 5)) - } -} - -// Must is a helper that wraps a call to a function returning (UUID, error) -// and panics if the error is non-nil. It is intended for use in variable -// initializations such as -// var packageUUID = uuid.Must(uuid.FromString("123e4567-e89b-12d3-a456-426655440000")); -func Must(u UUID, err error) UUID { - if err != nil { - panic(err) - } - return u -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 0dbe314..34f6352 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -4,8 +4,8 @@ code.cloudfoundry.org/lager # github.com/azer/snakecase v1.0.0 ## explicit github.com/azer/snakecase -# github.com/cloudfoundry-community/gautocloud v1.3.2 -## explicit; go 1.21 +# github.com/cloudfoundry-community/gautocloud v1.4.0 +## explicit; go 1.22.3 github.com/cloudfoundry-community/gautocloud github.com/cloudfoundry-community/gautocloud/cloudenv github.com/cloudfoundry-community/gautocloud/connectors @@ -80,9 +80,6 @@ github.com/sagikazarmark/locafero # github.com/sagikazarmark/slog-shim v0.1.0 ## explicit; go 1.20 github.com/sagikazarmark/slog-shim -# github.com/satori/go.uuid v1.2.0 -## explicit -github.com/satori/go.uuid # github.com/sirupsen/logrus v1.9.3 ## explicit; go 1.13 github.com/sirupsen/logrus