schema/adminschema: add route for setting and listing connectors

This commit is contained in:
Eric Chiang 2016-05-26 13:13:28 -07:00
parent 2003df83cf
commit adbf486246
4 changed files with 326 additions and 0 deletions

View file

@ -58,6 +58,38 @@ Upon successful registration, an ID and secret is assigned to the client.
}
```
### Connector
An object which describes a federating identity strategy. For documentation see Documentation/connectors-configuration.md. Since different connectors expect different object fields the scheme is omitted here.
```
```
### ConnectorsGetResponse
A list of all connector responses.
```
{
connectors: [
Connector
]
}
```
### ConnectorsSetRequest
A request to set all the connectors in the dex database.
```
{
connectors: [
Connector
]
}
```
### State
@ -150,6 +182,50 @@ Upon successful registration, an ID and secret is assigned to the client.
| default | Unexpected error | |
### GET /connectors
> __Summary__
> Get Connectors
> __Description__
> Return a list of the connectors for the dex system.
> __Responses__
> |Code|Description|Type|
|:-----|:-----|:-----|
| 200 | | [ConnectorsGetResponse](#connectorsgetresponse) |
| default | Unexpected error | |
### PUT /connectors
> __Summary__
> Set Connectors
> __Description__
> Set the list of connectors for the dex system, overwriting all previous connectors. A 200 status code indicates the action was successful.
> __Parameters__
> |Name|Located in|Description|Required|Type|
|:-----|:-----|:-----|:-----|:-----|
| | body | | Yes | [ConnectorsSetRequest](#connectorssetrequest) |
> __Responses__
> |Code|Description|Type|
|:-----|:-----|:-----|
| default | Unexpected error | |
### GET /state
> __Summary__

View file

@ -47,6 +47,7 @@ func New(client *http.Client) (*Service, error) {
s := &Service{client: client, BasePath: basePath}
s.Admin = NewAdminService(s)
s.Client = NewClientService(s)
s.Connectors = NewConnectorsService(s)
s.State = NewStateService(s)
return s, nil
}
@ -59,6 +60,8 @@ type Service struct {
Client *ClientService
Connectors *ConnectorsService
State *StateService
}
@ -80,6 +83,15 @@ type ClientService struct {
s *Service
}
func NewConnectorsService(s *Service) *ConnectorsService {
rs := &ConnectorsService{s: s}
return rs
}
type ConnectorsService struct {
s *Service
}
func NewStateService(s *Service) *StateService {
rs := &StateService{s: s}
return rs
@ -146,6 +158,16 @@ type ClientCreateResponse struct {
Client *Client `json:"client,omitempty"`
}
type Connector interface{}
type ConnectorsGetResponse struct {
Connectors []interface{} `json:"connectors,omitempty"`
}
type ConnectorsSetRequest struct {
Connectors []interface{} `json:"connectors,omitempty"`
}
type State struct {
AdminUserCreated bool `json:"AdminUserCreated,omitempty"`
}
@ -360,6 +382,128 @@ func (c *ClientCreateCall) Do() (*ClientCreateResponse, error) {
}
// method id "dex.admin.Connector.Get":
type ConnectorsGetCall struct {
s *Service
opt_ map[string]interface{}
}
// Get: Return a list of the connectors for the dex system.
func (r *ConnectorsService) Get() *ConnectorsGetCall {
c := &ConnectorsGetCall{s: r.s, opt_: make(map[string]interface{})}
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ConnectorsGetCall) Fields(s ...googleapi.Field) *ConnectorsGetCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *ConnectorsGetCall) Do() (*ConnectorsGetResponse, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "connectors")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.SetOpaque(req.URL)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *ConnectorsGetResponse
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Return a list of the connectors for the dex system.",
// "httpMethod": "GET",
// "id": "dex.admin.Connector.Get",
// "path": "connectors",
// "response": {
// "$ref": "ConnectorsGetResponse"
// }
// }
}
// method id "dex.admin.Connector.Set":
type ConnectorsSetCall struct {
s *Service
connectorssetrequest *ConnectorsSetRequest
opt_ map[string]interface{}
}
// Set: Set the list of connectors for the dex system, overwriting all
// previous connectors. A 200 status code indicates the action was
// successful.
func (r *ConnectorsService) Set(connectorssetrequest *ConnectorsSetRequest) *ConnectorsSetCall {
c := &ConnectorsSetCall{s: r.s, opt_: make(map[string]interface{})}
c.connectorssetrequest = connectorssetrequest
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ConnectorsSetCall) Fields(s ...googleapi.Field) *ConnectorsSetCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *ConnectorsSetCall) Do() error {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.connectorssetrequest)
if err != nil {
return err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "connectors")
urls += "?" + params.Encode()
req, _ := http.NewRequest("PUT", urls, body)
googleapi.SetOpaque(req.URL)
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return err
}
return nil
// {
// "description": "Set the list of connectors for the dex system, overwriting all previous connectors. A 200 status code indicates the action was successful.",
// "httpMethod": "PUT",
// "id": "dex.admin.Connector.Set",
// "path": "connectors",
// "request": {
// "$ref": "ConnectorsSetRequest"
// }
// }
}
// method id "dex.admin.State.Get":
type StateGetCall struct {

View file

@ -106,6 +106,37 @@ const DiscoveryJSON = `{
"$ref": "Client"
}
}
},
"Connector": {
"id": "Connector",
"type": "any",
"description": "An object which describes a federating identity strategy. For documentation see Documentation/connectors-configuration.md. Since different connectors expect different object fields the scheme is omitted here."
},
"ConnectorsSetRequest": {
"id": "ConnectorsSetRequest",
"type": "object",
"description": "A request to set all the connectors in the dex database.",
"properties": {
"connectors": {
"type": "array",
"items": {
"$ref": "Connector"
}
}
}
},
"ConnectorsGetResponse": {
"id": "ConnectorsGetResponse",
"type": "object",
"description": "A list of all connector responses.",
"properties": {
"connectors": {
"type": "array",
"items": {
"$ref": "Connector"
}
}
}
}
},
"resources": {
@ -172,6 +203,28 @@ const DiscoveryJSON = `{
}
}
}
},
"Connectors": {
"methods": {
"Set": {
"id": "dex.admin.Connector.Set",
"description": "Set the list of connectors for the dex system, overwriting all previous connectors. A 200 status code indicates the action was successful.",
"httpMethod": "PUT",
"path": "connectors",
"request": {
"$ref": "ConnectorsSetRequest"
}
},
"Get": {
"id": "dex.admin.Connector.Get",
"description": "Return a list of the connectors for the dex system.",
"httpMethod": "GET",
"path": "connectors",
"response": {
"$ref": "ConnectorsGetResponse"
}
}
}
}
}
}

View file

@ -100,6 +100,37 @@
"$ref": "Client"
}
}
},
"Connector": {
"id": "Connector",
"type": "any",
"description": "An object which describes a federating identity strategy. For documentation see Documentation/connectors-configuration.md. Since different connectors expect different object fields the scheme is omitted here."
},
"ConnectorsSetRequest": {
"id": "ConnectorsSetRequest",
"type": "object",
"description": "A request to set all the connectors in the dex database.",
"properties": {
"connectors": {
"type": "array",
"items": {
"$ref": "Connector"
}
}
}
},
"ConnectorsGetResponse": {
"id": "ConnectorsGetResponse",
"type": "object",
"description": "A list of all connector responses.",
"properties": {
"connectors": {
"type": "array",
"items": {
"$ref": "Connector"
}
}
}
}
},
"resources": {
@ -166,6 +197,28 @@
}
}
}
},
"Connectors": {
"methods": {
"Set": {
"id": "dex.admin.Connector.Set",
"description": "Set the list of connectors for the dex system, overwriting all previous connectors. A 200 status code indicates the action was successful.",
"httpMethod": "PUT",
"path": "connectors",
"request": {
"$ref": "ConnectorsSetRequest"
}
},
"Get": {
"id": "dex.admin.Connector.Get",
"description": "Return a list of the connectors for the dex system.",
"httpMethod": "GET",
"path": "connectors",
"response": {
"$ref": "ConnectorsGetResponse"
}
}
}
}
}
}