forked from mystiq/dex
schema: disable user API
This commit is contained in:
parent
1563d78861
commit
b33cfbf556
4 changed files with 180 additions and 7 deletions
|
@ -4,7 +4,7 @@
|
||||||
//
|
//
|
||||||
// Usage example:
|
// Usage example:
|
||||||
//
|
//
|
||||||
// import "github.com/coreos/dex/Godeps/_workspace/src/google.golang.org/api/adminschema/v1"
|
// import "google.golang.org/api/adminschema/v1"
|
||||||
// ...
|
// ...
|
||||||
// adminschemaService, err := adminschema.New(oauthHttpClient)
|
// adminschemaService, err := adminschema.New(oauthHttpClient)
|
||||||
package adminschema
|
package adminschema
|
||||||
|
|
|
@ -134,6 +134,15 @@ type UserCreateResponse struct {
|
||||||
type UserCreateResponseUser struct {
|
type UserCreateResponseUser struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type UserDisableRequest struct {
|
||||||
|
// Disable: If true, disable this user, if false, enable them
|
||||||
|
Disable bool `json:"disable,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserDisableResponse struct {
|
||||||
|
Ok bool `json:"ok,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type UserResponse struct {
|
type UserResponse struct {
|
||||||
User *User `json:"user,omitempty"`
|
User *User `json:"user,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -355,6 +364,89 @@ func (c *UsersCreateCall) Do() (*UserCreateResponse, error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// method id "dex.User.Disable":
|
||||||
|
|
||||||
|
type UsersDisableCall struct {
|
||||||
|
s *Service
|
||||||
|
id string
|
||||||
|
userdisablerequest *UserDisableRequest
|
||||||
|
opt_ map[string]interface{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disable: Enable or disable a user.
|
||||||
|
func (r *UsersService) Disable(id string, userdisablerequest *UserDisableRequest) *UsersDisableCall {
|
||||||
|
c := &UsersDisableCall{s: r.s, opt_: make(map[string]interface{})}
|
||||||
|
c.id = id
|
||||||
|
c.userdisablerequest = userdisablerequest
|
||||||
|
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 *UsersDisableCall) Fields(s ...googleapi.Field) *UsersDisableCall {
|
||||||
|
c.opt_["fields"] = googleapi.CombineFields(s)
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *UsersDisableCall) Do() (*UserDisableResponse, error) {
|
||||||
|
var body io.Reader = nil
|
||||||
|
body, err := googleapi.WithoutDataWrapper.JSONReader(c.userdisablerequest)
|
||||||
|
if err != nil {
|
||||||
|
return nil, 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, "users/{id}/disable")
|
||||||
|
urls += "?" + params.Encode()
|
||||||
|
req, _ := http.NewRequest("POST", urls, body)
|
||||||
|
googleapi.Expand(req.URL, map[string]string{
|
||||||
|
"id": c.id,
|
||||||
|
})
|
||||||
|
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 nil, err
|
||||||
|
}
|
||||||
|
defer googleapi.CloseBody(res)
|
||||||
|
if err := googleapi.CheckResponse(res); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var ret *UserDisableResponse
|
||||||
|
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return ret, nil
|
||||||
|
// {
|
||||||
|
// "description": "Enable or disable a user.",
|
||||||
|
// "httpMethod": "POST",
|
||||||
|
// "id": "dex.User.Disable",
|
||||||
|
// "parameterOrder": [
|
||||||
|
// "id"
|
||||||
|
// ],
|
||||||
|
// "parameters": {
|
||||||
|
// "id": {
|
||||||
|
// "location": "path",
|
||||||
|
// "required": true,
|
||||||
|
// "type": "string"
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// "path": "users/{id}/disable",
|
||||||
|
// "request": {
|
||||||
|
// "$ref": "UserDisableRequest"
|
||||||
|
// },
|
||||||
|
// "response": {
|
||||||
|
// "$ref": "UserDisableResponse"
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// method id "dex.User.Get":
|
// method id "dex.User.Get":
|
||||||
|
|
||||||
type UsersGetCall struct {
|
type UsersGetCall struct {
|
||||||
|
@ -363,7 +455,7 @@ type UsersGetCall struct {
|
||||||
opt_ map[string]interface{}
|
opt_ map[string]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get: Get a single use object.
|
// Get: Get a single User object by id.
|
||||||
func (r *UsersService) Get(id string) *UsersGetCall {
|
func (r *UsersService) Get(id string) *UsersGetCall {
|
||||||
c := &UsersGetCall{s: r.s, opt_: make(map[string]interface{})}
|
c := &UsersGetCall{s: r.s, opt_: make(map[string]interface{})}
|
||||||
c.id = id
|
c.id = id
|
||||||
|
@ -406,7 +498,7 @@ func (c *UsersGetCall) Do() (*UserResponse, error) {
|
||||||
}
|
}
|
||||||
return ret, nil
|
return ret, nil
|
||||||
// {
|
// {
|
||||||
// "description": "Get a single use object.",
|
// "description": "Get a single User object by id.",
|
||||||
// "httpMethod": "GET",
|
// "httpMethod": "GET",
|
||||||
// "id": "dex.User.Get",
|
// "id": "dex.User.Get",
|
||||||
// "parameterOrder": [
|
// "parameterOrder": [
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
package workerschema
|
package workerschema
|
||||||
|
|
||||||
//
|
//
|
||||||
// This file is automatically generated by schema/generator
|
// This file is automatically generated by schema/generator
|
||||||
//
|
//
|
||||||
|
@ -167,6 +166,25 @@ const DiscoveryJSON = `{
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"UserDisableRequest": {
|
||||||
|
"id": "UserDisableRequest",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"disable": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "If true, disable this user, if false, enable them"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"UserDisableResponse": {
|
||||||
|
"id": "UserDisableResponse",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"ok": {
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"resources": {
|
"resources": {
|
||||||
|
@ -224,7 +242,7 @@ const DiscoveryJSON = `{
|
||||||
},
|
},
|
||||||
"Get": {
|
"Get": {
|
||||||
"id": "dex.User.Get",
|
"id": "dex.User.Get",
|
||||||
"description": "Get a single use object.",
|
"description": "Get a single User object by id.",
|
||||||
"httpMethod": "GET",
|
"httpMethod": "GET",
|
||||||
"path": "users/{id}",
|
"path": "users/{id}",
|
||||||
"parameters": {
|
"parameters": {
|
||||||
|
@ -252,9 +270,31 @@ const DiscoveryJSON = `{
|
||||||
"response": {
|
"response": {
|
||||||
"$ref": "UserCreateResponse"
|
"$ref": "UserCreateResponse"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Disable": {
|
||||||
|
"id": "dex.User.Disable",
|
||||||
|
"description": "Enable or disable a user.",
|
||||||
|
"httpMethod": "POST",
|
||||||
|
"path": "users/{id}/disable",
|
||||||
|
"parameters": {
|
||||||
|
"id": {
|
||||||
|
"type": "string",
|
||||||
|
"required": true,
|
||||||
|
"location": "path"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parameterOrder": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"request": {
|
||||||
|
"$ref": "UserDisableRequest"
|
||||||
|
},
|
||||||
|
"response": {
|
||||||
|
"$ref": "UserDisableResponse"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
|
@ -160,6 +160,25 @@
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"UserDisableRequest": {
|
||||||
|
"id": "UserDisableRequest",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"disable": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "If true, disable this user, if false, enable them. No error is signaled if the user state doesn't change."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"UserDisableResponse": {
|
||||||
|
"id": "UserDisableResponse",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"ok": {
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"resources": {
|
"resources": {
|
||||||
|
@ -217,7 +236,7 @@
|
||||||
},
|
},
|
||||||
"Get": {
|
"Get": {
|
||||||
"id": "dex.User.Get",
|
"id": "dex.User.Get",
|
||||||
"description": "Get a single use object.",
|
"description": "Get a single User object by id.",
|
||||||
"httpMethod": "GET",
|
"httpMethod": "GET",
|
||||||
"path": "users/{id}",
|
"path": "users/{id}",
|
||||||
"parameters": {
|
"parameters": {
|
||||||
|
@ -245,6 +264,28 @@
|
||||||
"response": {
|
"response": {
|
||||||
"$ref": "UserCreateResponse"
|
"$ref": "UserCreateResponse"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Disable": {
|
||||||
|
"id": "dex.User.Disable",
|
||||||
|
"description": "Enable or disable a user.",
|
||||||
|
"httpMethod": "POST",
|
||||||
|
"path": "users/{id}/disable",
|
||||||
|
"parameters": {
|
||||||
|
"id": {
|
||||||
|
"type": "string",
|
||||||
|
"required": true,
|
||||||
|
"location": "path"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parameterOrder": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"request": {
|
||||||
|
"$ref": "UserDisableRequest"
|
||||||
|
},
|
||||||
|
"response": {
|
||||||
|
"$ref": "UserDisableResponse"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue