Commit Graph

25 Commits

Author SHA1 Message Date
Djordje Lukic ad72c866cc Add license headers 2020-06-18 16:48:03 +02:00
Guillaume Tardif e7682682fb Store context type in metadata to make retrocompatibility with previous contexts easier (potentially switching back and forth) 2020-06-10 18:17:48 +02:00
Guillaume Tardif 01aaec2dbe Fix Azure login : allow getting a backend when no corresponding context already exists with an explicit call from the login command. Will be usefull next for context creation with azure interactive things 2020-05-29 11:35:35 +02:00
Djordje Lukic 11339761ca Change the way a context is stored
Initially we stored the context data in the `Metadata` of the context
but in hindsight this data would be better of in the `Endpoints` because
that's what it is used for.

Before:
```json
{
  "Name": "aci",
  "Metadata": {
    "Type": "aci",
    "Data": {
      "key": "value"
    }
  },
  "Endpoints": {
      "docker": {}
  }
}
```

After:
```json
{
  "Name": "aci",
  "Type": "aci",
  "Metadata": {},
  "Endpoints": {
      "aci": {
          "key": "value"
      },
      "docker": {}
  }
}
```

With this change the contexts that we create are more in line with the contexts the docker cli creates.

It also makes the code less complicated since we don't need to marsal twice any more. The API is nicer too:

```go
// Get a context:
c, err := store.Get(contextName)

// Get the stored endpoint:
var aciContext store.AciContext
if err := contextStore.GetEndpoint(currentContext, &aciContext); err != nil {
	return nil, err
}
```
2020-05-22 16:32:43 +02:00
Djordje Lukic 3ffa79f743 Remove gRPC stuff from the client 2020-05-20 16:49:20 +02:00
Guillaume Tardif 7edc6659a2 Add unit tests for login process 2020-05-15 10:28:31 +02:00
Guillaume Tardif 1e19d977e0 Initial functional login command : added Cloud API with generic Login() 2020-05-15 10:04:22 +02:00
Ulysses Souza 73529cc264 Refactor example/backend
Also promote init function from returning
interface{} to backend.Service to avoid
typecasting

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-05-05 17:14:26 +02:00
Ulysses Souza ba455916c6 Refactor on services
This refactors the interfaces and implementations of
services

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-05-05 15:37:12 +02:00
Ulysses Souza 03e418cbbb Add compose up and down
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-05-05 14:03:14 +02:00
Djordje Lukic 24c035e822 Add comments on exported items, remove example command
Also add `make lint` to run the linter
2020-05-05 10:27:44 +02:00
Ulysses Souza 933bed5f5d Invert the logic to preserve the happy path
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-05-04 11:30:21 +02:00
Ulysses Souza 111ec3b80d Add Containers and Compose to gRPC client creation
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-05-04 11:30:21 +02:00
Djordje Lukic c4a260369b Remove useless SetContext function in client.go 2020-04-30 12:44:55 +02:00
Djordje Lukic 9ea91791b4 Change the current context of the client on each request
* the interceptor takes the current context from the metadat
* each handler needs to call `client.SetContext()` before using the
sevices
2020-04-30 12:07:26 +02:00
Djordje Lukic b2606b91f2 Remove useless client grpc stuff 2020-04-30 11:06:04 +02:00
Djordje Lukic f4bde8cb89 Multiple backend for the cli
* implement a little azure backend
* implement an example backend
* use the right backend from the context
2020-04-30 11:01:04 +02:00
Djordje Lukic 551eb2326f ACI context creation
And remove gRPC stuff from the client for now
2020-04-29 19:08:58 +02:00
Djordje Lukic 244adb77a4
Merge pull request #20 from chris-crone/copyright
Update copyright date
2020-04-24 18:06:14 +02:00
Christopher Crone d166ad82f9 Update copyright date
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-04-24 14:39:49 +02:00
Ulysses Souza b44547c71f Refactor NewContext
This renames NewContext to NewSigContext and
moves it to ./util/util.go avoiding the servers
to import "github.com/docker/api/client"

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-04-24 11:50:30 +02:00
Djordje Lukic 6bfeda054b Go mods initialized, protos without gogo 2020-04-21 15:07:41 +02:00
Djordje Lukic dfa8e03860 Configure client connection backoff
For faster startup times (from 2s to ~130ms)
2020-04-17 14:37:54 +02:00
Michael Crosby 37591c714b Add base cli and connection logic
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2020-04-06 11:54:01 -04:00
Michael Crosby bae830a1b1 Add initial backend proto and example
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2020-04-06 11:22:34 -04:00