swagger

package
v1.0.0-beta.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

README

Go API client for swagger

Package main ORY Keto

Overview

This API client was generated by the swagger-codegen project. By using the swagger-spec from a remote server, you can easily generate an API client.

  • API version: Latest
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.languages.GoClientCodegen For more information, please visit https://www.ory.sh

Installation

Put the package under your project folder and add the following in import:

    "./swagger"

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
HealthApi IsInstanceAlive Get /health/alive Check the Alive Status
HealthApi IsInstanceReady Get /health/ready Check the Readiness Status
PolicyApi CreatePolicy Post /policies
PolicyApi DeletePolicy Delete /policies/{id}
PolicyApi GetPolicy Get /policies/{id}
PolicyApi ListPolicies Get /policies
PolicyApi UpdatePolicy Put /policies/{id}
RoleApi AddMembersToRole Post /roles/{id}/members Add members to a role
RoleApi CreateRole Post /roles Create a role
RoleApi DeleteRole Delete /roles/{id} Get a role by its ID
RoleApi GetRole Get /roles/{id} Get a role by its ID
RoleApi ListRoles Get /roles List all roles
RoleApi RemoveMembersFromRole Delete /roles/{id}/members Remove members from a role
RoleApi SetRole Put /roles/{id} A Role represents a group of users that share the same role and thus permissions. A role could be an administrator, a moderator, a regular user or some other sort of role.
VersionApi GetVersion Get /version Get the version of Keto
WardenApi IsOAuth2AccessTokenAuthorized Post /warden/oauth2/access-tokens/authorize Check if an OAuth 2.0 access token is authorized to access a resource
WardenApi IsOAuth2ClientAuthorized Post /warden/oauth2/clients/authorize Check if an OAuth 2.0 Client is authorized to access a resource
WardenApi IsSubjectAuthorized Post /warden/subjects/authorize Check if a subject is authorized to access a resource

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Author

hi@ory.am

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	// contains filtered or unexported fields
}

func (*APIClient) CallAPI

func (c *APIClient) CallAPI(path string, method string,
	postBody interface{},
	headerParams map[string]string,
	queryParams url.Values,
	formParams map[string]string,
	fileName string,
	fileBytes []byte) (*resty.Response, error)

func (*APIClient) ParameterToString

func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string

func (*APIClient) SelectHeaderAccept

func (c *APIClient) SelectHeaderAccept(accepts []string) string

func (*APIClient) SelectHeaderContentType

func (c *APIClient) SelectHeaderContentType(contentTypes []string) string

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the swagger operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type AuthenticationDefaultSession

type AuthenticationDefaultSession struct {

	// Allowed is true if the request is allowed and false otherwise.
	Allowed bool `json:"allowed,omitempty"`

	// Subject is the identity that authorized issuing the token, for example a user or an OAuth2 app. This is usually a uuid but you can choose a urn or some other id too.
	Sub string `json:"sub,omitempty"`
}

type AuthenticationOAuth2ClientCredentialsRequest

type AuthenticationOAuth2ClientCredentialsRequest struct {

	// Token is the token to introspect.
	ClientId string `json:"client_id,omitempty"`

	ClientSecret string `json:"client_secret,omitempty"`

	// Scope is an array of scopes that are required.
	Scope []string `json:"scope,omitempty"`
}

type AuthenticationOAuth2ClientCredentialsSession

type AuthenticationOAuth2ClientCredentialsSession struct {

	// Allowed is true if the request is allowed and false otherwise.
	Allowed bool `json:"allowed,omitempty"`

	// Subject is the identity that authorized issuing the token, for example a user or an OAuth2 app. This is usually a uuid but you can choose a urn or some other id too.
	Sub string `json:"sub,omitempty"`
}

type AuthenticationOAuth2IntrospectionRequest

type AuthenticationOAuth2IntrospectionRequest struct {

	// Scope is an array of scopes that are required.
	Scope []string `json:"scope,omitempty"`

	// Token is the token to introspect.
	Token string `json:"token,omitempty"`
}

type AuthenticationOAuth2Session

type AuthenticationOAuth2Session struct {

	// Allowed is true if the request is allowed and false otherwise.
	Allowed bool `json:"allowed,omitempty"`

	Aud []string `json:"aud,omitempty"`

	// ClientID is the id of the OAuth2 client that requested the token.
	ClientId string `json:"client_id,omitempty"`

	// ExpiresAt is the expiry timestamp.
	Exp time.Time `json:"exp,omitempty"`

	// IssuedAt is the token creation time stamp.
	Iat time.Time `json:"iat,omitempty"`

	// Issuer is the id of the issuer, typically an hydra instance.
	Iss string `json:"iss,omitempty"`

	Nbf time.Time `json:"nbf,omitempty"`

	// GrantedScopes is a list of scopes that the subject authorized when asked for consent.
	Scope string `json:"scope,omitempty"`

	// Session represents arbitrary session data.
	Session map[string]interface{} `json:"session,omitempty"`

	// Subject is the identity that authorized issuing the token, for example a user or an OAuth2 app. This is usually a uuid but you can choose a urn or some other id too.
	Sub string `json:"sub,omitempty"`

	Username string `json:"username,omitempty"`
}

type Authenticator

type Authenticator struct {
}

type Configuration

type Configuration struct {
	Username      string            `json:"userName,omitempty"`
	Password      string            `json:"password,omitempty"`
	APIKeyPrefix  map[string]string `json:"APIKeyPrefix,omitempty"`
	APIKey        map[string]string `json:"APIKey,omitempty"`
	Debug         bool              `json:"debug,omitempty"`
	DebugFile     string            `json:"debugFile,omitempty"`
	OAuthToken    string            `json:"oAuthToken,omitempty"`
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	AccessToken   string            `json:"accessToken,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	APIClient     *APIClient
	Transport     http.RoundTripper
	Timeout       *time.Duration `json:"timeout,omitempty"`
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

func (*Configuration) GetAPIKeyWithPrefix

func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string

func (*Configuration) GetBasicAuthEncodedString

func (c *Configuration) GetBasicAuthEncodedString() string

type Firewall

type Firewall struct {
}

type Handler

type Handler struct {
	H Writer `json:"H,omitempty"`

	Manager Manager `json:"Manager,omitempty"`
}

type HealthApi

type HealthApi struct {
	Configuration *Configuration
}

func NewHealthApi

func NewHealthApi() *HealthApi

func NewHealthApiWithBasePath

func NewHealthApiWithBasePath(basePath string) *HealthApi

func (HealthApi) IsInstanceAlive

func (a HealthApi) IsInstanceAlive() (*HealthStatus, *APIResponse, error)

*

  • Check the Alive Status
  • This endpoint returns a 200 status code when the HTTP server is up running. This status does currently not include checks whether the database connection is working. This endpoint does not require the `X-Forwarded-Proto` header when TLS termination is set. Be aware that if you are running multiple nodes of ORY Keto, the health status will never refer to the cluster state, only to a single instance. *
  • @return *HealthStatus

func (HealthApi) IsInstanceReady

func (a HealthApi) IsInstanceReady() (*HealthStatus, *APIResponse, error)

*

  • Check the Readiness Status
  • This endpoint returns a 200 status code when the HTTP server is up running and the environment dependencies (e.g. the database) are responsive as well. This status does currently not include checks whether the database connection is working. This endpoint does not require the `X-Forwarded-Proto` header when TLS termination is set. Be aware that if you are running multiple nodes of ORY Keto, the health status will never refer to the cluster state, only to a single instance. *
  • @return *HealthStatus

type HealthNotReadyStatus

type HealthNotReadyStatus struct {

	// Errors contains a list of errors that caused the not ready status.
	Errors map[string]string `json:"errors,omitempty"`
}

type HealthStatus

type HealthStatus struct {

	// Status always contains \"ok\".
	Status string `json:"status,omitempty"`
}

type InlineResponse500

type InlineResponse500 struct {
	Code int64 `json:"code,omitempty"`

	Details []map[string]interface{} `json:"details,omitempty"`

	Message string `json:"message,omitempty"`

	Reason string `json:"reason,omitempty"`

	Request string `json:"request,omitempty"`

	Status string `json:"status,omitempty"`
}

type IntrospectionResponse

type IntrospectionResponse struct {
	Active bool `json:"active,omitempty"`

	Aud []string `json:"aud,omitempty"`

	ClientId string `json:"client_id,omitempty"`

	Exp int64 `json:"exp,omitempty"`

	// Session represents arbitrary session data.
	Ext map[string]interface{} `json:"ext,omitempty"`

	Iat int64 `json:"iat,omitempty"`

	Iss string `json:"iss,omitempty"`

	Nbf int64 `json:"nbf,omitempty"`

	Scope string `json:"scope,omitempty"`

	// Here, it's sub
	Sub string `json:"sub,omitempty"`

	TokenType string `json:"token_type,omitempty"`

	Username string `json:"username,omitempty"`
}

type Manager

type Manager struct {
}

type OAuth2ClientCredentialsAuthentication

type OAuth2ClientCredentialsAuthentication struct {
}

type OAuth2IntrospectionAuthentication

type OAuth2IntrospectionAuthentication struct {
}

type Policy

type Policy struct {

	// Actions impacted by the policy.
	Actions []string `json:"actions,omitempty"`

	// Conditions under which the policy is active.
	Conditions map[string]PolicyConditions `json:"conditions,omitempty"`

	// Description of the policy.
	Description string `json:"description,omitempty"`

	// Effect of the policy
	Effect string `json:"effect,omitempty"`

	// ID of the policy.
	Id string `json:"id,omitempty"`

	// Resources impacted by the policy.
	Resources []string `json:"resources,omitempty"`

	// Subjects impacted by the policy.
	Subjects []string `json:"subjects,omitempty"`
}

type PolicyApi

type PolicyApi struct {
	Configuration *Configuration
}

func NewPolicyApi

func NewPolicyApi() *PolicyApi

func NewPolicyApiWithBasePath

func NewPolicyApiWithBasePath(basePath string) *PolicyApi

func (PolicyApi) CreatePolicy

func (a PolicyApi) CreatePolicy(body Policy) (*Policy, *APIResponse, error)

*

*
* Create an Access Control Policy
*
* @param body
* @return *Policy

func (PolicyApi) DeletePolicy

func (a PolicyApi) DeletePolicy(id string) (*APIResponse, error)

*

*
* Delete an Access Control Policy
*
* @param id The id of the policy.
* @return void

func (PolicyApi) GetPolicy

func (a PolicyApi) GetPolicy(id string) (*Policy, *APIResponse, error)

*

*
* Get an Access Control Policy
*
* @param id The id of the policy.
* @return *Policy

func (PolicyApi) ListPolicies

func (a PolicyApi) ListPolicies(offset int64, limit int64) ([]Policy, *APIResponse, error)

*

*
* List Access Control Policies
*
* @param offset The offset from where to start looking.
* @param limit The maximum amount of policies returned.
* @return []Policy

func (PolicyApi) UpdatePolicy

func (a PolicyApi) UpdatePolicy(id string, body Policy) (*Policy, *APIResponse, error)

*

*
* Update an Access Control Policy
*
* @param id The id of the policy.
* @param body
* @return *Policy

type PolicyConditions

type PolicyConditions struct {
	Options map[string]interface{} `json:"options,omitempty"`

	Type_ string `json:"type,omitempty"`
}

type Role

type Role struct {

	// ID is the role's unique id.
	Id string `json:"id,omitempty"`

	// Members is who belongs to the role.
	Members []string `json:"members,omitempty"`
}

Role represents a group of users that share the same role. A role could be an administrator, a moderator, a regular user or some other sort of role.

type RoleApi

type RoleApi struct {
	Configuration *Configuration
}

func NewRoleApi

func NewRoleApi() *RoleApi

func NewRoleApiWithBasePath

func NewRoleApiWithBasePath(basePath string) *RoleApi

func (RoleApi) AddMembersToRole

func (a RoleApi) AddMembersToRole(id string, body RoleMembers) (*APIResponse, error)

*

  • Add members to a role
  • A Role represents a group of users that share the same role and thus permissions. A role could be an administrator, a moderator, a regular user or some other sort of role. This endpoint allows you to add members (users, applications, ...) to a specific role. You have to know the role's ID. *
  • @param id The id of the role to modify.
  • @param body
  • @return void

func (RoleApi) CreateRole

func (a RoleApi) CreateRole(body Role) (*Role, *APIResponse, error)

*

  • Create a role
  • A Role represents a group of users that share the same role and thus permissions. A role could be an administrator, a moderator, a regular user or some other sort of role. This endpoint allows you to create a new role. You may define members as well but you don't have to. *
  • @param body
  • @return *Role

func (RoleApi) DeleteRole

func (a RoleApi) DeleteRole(id string) (*APIResponse, error)

*

  • Get a role by its ID
  • A Role represents a group of users that share the same role and thus permissions. A role could be an administrator, a moderator, a regular user or some other sort of role. This endpoint allows you to delete an existing role. You have to know the role's ID. *
  • @param id The id of the role to look up.
  • @return void

func (RoleApi) GetRole

func (a RoleApi) GetRole(id string) (*Role, *APIResponse, error)

*

  • Get a role by its ID
  • A Role represents a group of users that share the same role and thus permissions. A role could be an administrator, a moderator, a regular user or some other sort of role. This endpoint allows you to retrieve an existing role. You have to know the role's ID. *
  • @param id The id of the role to look up.
  • @return *Role

func (RoleApi) ListRoles

func (a RoleApi) ListRoles(member string, limit int64, offset int64) ([]Role, *APIResponse, error)

*

  • List all roles
  • A Role represents a group of users that share the same role and thus permissions. A role could be an administrator, a moderator, a regular user or some other sort of role. This endpoint allows you to retrieve all roles that are stored in the system. *
  • @param member The id of the member to look up.
  • @param limit The maximum amount of policies returned.
  • @param offset The offset from where to start looking.
  • @return []Role

func (RoleApi) RemoveMembersFromRole

func (a RoleApi) RemoveMembersFromRole(id string, body RoleMembers) (*APIResponse, error)

*

  • Remove members from a role
  • A Role represents a group of users that share the same role and thus permissions. A role could be an administrator, a moderator, a regular user or some other sort of role. This endpoint allows you to remove members (users, applications, ...) from a specific role. You have to know the role's ID. *
  • @param id The id of the role to modify.
  • @param body
  • @return void

func (RoleApi) SetRole

func (a RoleApi) SetRole() (*APIResponse, error)

*

  • A Role represents a group of users that share the same role and thus permissions. A role could be an administrator, a moderator, a regular user or some other sort of role.
  • This endpoint allows you to overwrite a role. You have to know the role's ID. *
  • @return void

type RoleMembers

type RoleMembers struct {
	Members []string `json:"members,omitempty"`
}

type Session

type Session struct {
	GetSubject string `json:"GetSubject,omitempty"`
}

type SwaggerCreatePolicyParameters

type SwaggerCreatePolicyParameters struct {
	Body Policy `json:"Body,omitempty"`
}

type SwaggerDoesWardenAllowAccessRequestParameters

type SwaggerDoesWardenAllowAccessRequestParameters struct {
	Body WardenSubjectAuthorizationRequest `json:"Body,omitempty"`
}

type SwaggerDoesWardenAllowClientRequestParameters

type SwaggerDoesWardenAllowClientRequestParameters struct {
	Body WardenOAuth2ClientAuthorizationRequest `json:"Body,omitempty"`
}

type SwaggerDoesWardenAllowTokenAccessRequestParameters

type SwaggerDoesWardenAllowTokenAccessRequestParameters struct {
	Body WardenOAuth2AccessTokenAuthorizationRequest `json:"Body,omitempty"`
}

type SwaggerGetPolicyParameters

type SwaggerGetPolicyParameters struct {

	// The id of the policy. in: path
	Id string `json:"id,omitempty"`
}

type SwaggerListPolicyParameters

type SwaggerListPolicyParameters struct {

	// The maximum amount of policies returned. in: query
	Limit int64 `json:"limit,omitempty"`

	// The offset from where to start looking. in: query
	Offset int64 `json:"offset,omitempty"`
}

type SwaggerListPolicyResponse

type SwaggerListPolicyResponse struct {

	// in: body type: array
	Body []Policy `json:"Body,omitempty"`
}

A policy

type SwaggerUpdatePolicyParameters

type SwaggerUpdatePolicyParameters struct {
	Body Policy `json:"Body,omitempty"`

	// The id of the policy. in: path
	Id string `json:"id,omitempty"`
}

type SwaggerWardenBaseRequest

type SwaggerWardenBaseRequest struct {

	// Action is the action that is requested on the resource.
	Action string `json:"action,omitempty"`

	// Context is the request's environmental context.
	Context map[string]interface{} `json:"context,omitempty"`

	// Resource is the resource that access is requested to.
	Resource string `json:"resource,omitempty"`
}

swager:model authorizedBaseRequest

type Version

type Version struct {
	Version string `json:"version,omitempty"`
}

type VersionApi

type VersionApi struct {
	Configuration *Configuration
}

func NewVersionApi

func NewVersionApi() *VersionApi

func NewVersionApiWithBasePath

func NewVersionApiWithBasePath(basePath string) *VersionApi

func (VersionApi) GetVersion

func (a VersionApi) GetVersion() (*Version, *APIResponse, error)

*

  • Get the version of Keto
  • This endpoint returns the version as `{ \"version\": \"VERSION\" }`. The version is only correct with the prebuilt binary and not custom builds. *
  • @return *Version

type WardenApi

type WardenApi struct {
	Configuration *Configuration
}

func NewWardenApi

func NewWardenApi() *WardenApi

func NewWardenApiWithBasePath

func NewWardenApiWithBasePath(basePath string) *WardenApi

func (WardenApi) IsOAuth2AccessTokenAuthorized

*

  • Check if an OAuth 2.0 access token is authorized to access a resource
  • Checks if a token is valid and if the token subject is allowed to perform an action on a resource. This endpoint requires a token, a scope, a resource name, an action name and a context. If a token is expired/invalid, has not been granted the requested scope or the subject is not allowed to perform the action on the resource, this endpoint returns a 200 response with `{ \"allowed\": false }`. This endpoint passes all data from the upstream OAuth 2.0 token introspection endpoint. If you use ORY Hydra as an upstream OAuth 2.0 provider, data set through the `accessTokenExtra` field in the consent flow will be included in this response as well. *
  • @param body
  • @return *WardenOAuth2AccessTokenAuthorizationResponse

func (WardenApi) IsOAuth2ClientAuthorized

*

  • Check if an OAuth 2.0 Client is authorized to access a resource
  • Checks if an OAuth 2.0 Client provided the correct access credentials and and if the client is allowed to perform an action on a resource. This endpoint requires a client id, a client secret, a scope, a resource name, an action name and a context. *
  • @param body
  • @return *WardenOAuth2ClientAuthorizationResponse

func (WardenApi) IsSubjectAuthorized

*

  • Check if a subject is authorized to access a resource
  • Checks if a subject (e.g. user ID, API key, ...) is allowed to perform a certain action on a resource. *
  • @param body
  • @return *WardenSubjectAuthorizationResponse

type WardenOAuth2AccessTokenAuthorizationRequest

type WardenOAuth2AccessTokenAuthorizationRequest struct {

	// Action is the action that is requested on the resource.
	Action string `json:"action,omitempty"`

	// Context is the request's environmental context.
	Context map[string]interface{} `json:"context,omitempty"`

	// Resource is the resource that access is requested to.
	Resource string `json:"resource,omitempty"`

	// Scope is an array of scopes that are required.
	Scope []string `json:"scope,omitempty"`

	// Token is the token to introspect.
	Token string `json:"token,omitempty"`
}

type WardenOAuth2AccessTokenAuthorizationResponse

type WardenOAuth2AccessTokenAuthorizationResponse struct {

	// Allowed is true if the request is allowed and false otherwise.
	Allowed bool `json:"allowed,omitempty"`

	Aud []string `json:"aud,omitempty"`

	// ClientID is the id of the OAuth2 client that requested the token.
	ClientId string `json:"client_id,omitempty"`

	// ExpiresAt is the expiry timestamp.
	Exp time.Time `json:"exp,omitempty"`

	// IssuedAt is the token creation time stamp.
	Iat time.Time `json:"iat,omitempty"`

	// Issuer is the id of the issuer, typically an hydra instance.
	Iss string `json:"iss,omitempty"`

	Nbf time.Time `json:"nbf,omitempty"`

	// GrantedScopes is a list of scopes that the subject authorized when asked for consent.
	Scope string `json:"scope,omitempty"`

	// Session represents arbitrary session data.
	Session map[string]interface{} `json:"session,omitempty"`

	// Subject is the identity that authorized issuing the token, for example a user or an OAuth2 app. This is usually a uuid but you can choose a urn or some other id too.
	Sub string `json:"sub,omitempty"`

	Username string `json:"username,omitempty"`
}

type WardenOAuth2ClientAuthorizationRequest

type WardenOAuth2ClientAuthorizationRequest struct {

	// Action is the action that is requested on the resource.
	Action string `json:"action,omitempty"`

	// Token is the token to introspect.
	ClientId string `json:"client_id,omitempty"`

	ClientSecret string `json:"client_secret,omitempty"`

	// Context is the request's environmental context.
	Context map[string]interface{} `json:"context,omitempty"`

	// Resource is the resource that access is requested to.
	Resource string `json:"resource,omitempty"`

	// Scope is an array of scopes that are required.
	Scope []string `json:"scope,omitempty"`
}

type WardenOAuth2ClientAuthorizationResponse

type WardenOAuth2ClientAuthorizationResponse struct {

	// Allowed is true if the request is allowed and false otherwise.
	Allowed bool `json:"allowed,omitempty"`

	// Subject is the identity that authorized issuing the token, for example a user or an OAuth2 app. This is usually a uuid but you can choose a urn or some other id too.
	Sub string `json:"sub,omitempty"`
}

type WardenSubjectAuthorizationRequest

type WardenSubjectAuthorizationRequest struct {

	// Action is the action that is requested on the resource.
	Action string `json:"action,omitempty"`

	// Context is the request's environmental context.
	Context map[string]interface{} `json:"context,omitempty"`

	// Resource is the resource that access is requested to.
	Resource string `json:"resource,omitempty"`

	// Subejct is the subject that is requesting access.
	Subject string `json:"subject,omitempty"`
}

type WardenSubjectAuthorizationResponse

type WardenSubjectAuthorizationResponse struct {

	// Allowed is true if the request is allowed and false otherwise.
	Allowed bool `json:"allowed,omitempty"`

	// Subject is the identity that authorized issuing the token, for example a user or an OAuth2 app. This is usually a uuid but you can choose a urn or some other id too.
	Sub string `json:"sub,omitempty"`
}

type Writer

type Writer struct {
}

Writer is a helper to write arbitrary data to a ResponseWriter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL