scim

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2021 License: MIT Imports: 20 Imported by: 0

README

Go API client for SCIM

Used By Build Status Go Report Card Docs License

SCIM V2 API implemented by RingCentral

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: 0.1.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.languages.GoClientCodegen

Installation

$ go get github.com/digroad/go-scim-client

The package name is: scim

Documentation for API Endpoints

Class Method HTTP request Description
ServiceProviderConfigApi GetServiceProviderConfig Get /ServiceProviderConfig get service provider config
UserApi CreateUser Post /Users create a user
UserApi DeleteUser Delete /Users/{id} delete a user
UserApi GetUserById Get /Users/{id} get a user by id
UserApi PatchUser Patch /Users/{id} partially update/patch a user
UserApi ReplaceUser Put /Users/{id} fully update/replace a user
UserApi SearchViaGet Get /Users search or list users
UserApi SearchViaPost Post /Users/.search search or list users

Documentation For Models

Documentation For Authorization

OAuth2

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL:
  • Scopes: N/A

Example

	auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
    r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

	import 	"golang.org/x/oauth2"

    / .. Perform OAuth2 round trip request and obtain a token .. //

    tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
	auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
    r, err := client.Service.Operation(auth, args)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {

	// API Services
	ServiceProviderConfigApi *ServiceProviderConfigApiService
	UserApi                  *UserApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the SCIM API API v0.1.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

Change base path to allow switching to mocks

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

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 Address

type Address struct {
	Country string `json:"country,omitempty"`

	Locality string `json:"locality,omitempty"`

	PostalCode string `json:"postalCode,omitempty"`

	Region string `json:"region,omitempty"`

	StreetAddress string `json:"streetAddress,omitempty"`

	Type_ string `json:"type"`
}

type AuthenticationScheme

type AuthenticationScheme struct {
	Description string `json:"description,omitempty"`

	DocumentationUrl string `json:"documentationUrl,omitempty"`

	Name string `json:"name,omitempty"`

	SpecUrl string `json:"specUrl,omitempty"`
}

type AuthenticationSchemes

type AuthenticationSchemes struct {
	AuthenticationSchemes []AuthenticationScheme `json:"authenticationSchemes,omitempty"`
}

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type BulkSupported

type BulkSupported struct {
	MaxOperations int32 `json:"maxOperations,omitempty"`

	MaxPayloadSize int32 `json:"maxPayloadSize,omitempty"`

	Supported bool `json:"supported,omitempty"`
}

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	HTTPClient    *http.Client
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

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

type Email

type Email struct {
	Type_ string `json:"type"`

	Value string `json:"value"`
}

type EnterpriseUser

type EnterpriseUser struct {
	Department string `json:"department,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {

	// detail error message
	Detail string `json:"detail,omitempty"`

	Schemas []string `json:"schemas,omitempty"`

	// bad request type when status code is 400
	ScimType string `json:"scimType,omitempty"`

	// same as HTTP status code, e.g. 400, 401, etc.
	Status string `json:"status,omitempty"`
}

type FilterSupported

type FilterSupported struct {
	MaxResults int32 `json:"maxResults,omitempty"`

	Supported bool `json:"supported,omitempty"`
}

type Meta

type Meta struct {
	Created time.Time `json:"created,omitempty"`

	LastModified time.Time `json:"lastModified,omitempty"`

	// resource location URI
	Location string `json:"location,omitempty"`

	ResourceType string `json:"resourceType,omitempty"`
}

resource metadata

type Name

type Name struct {
	FamilyName string `json:"familyName"`

	GivenName string `json:"givenName"`
}

type PatchOperation

type PatchOperation struct {
	Op string `json:"op"`

	Path string `json:"path,omitempty"`

	// corresponding 'value' of that field specified by 'path'
	//Value *interface{} `json:"value,omitempty"`
	Value interface{} `json:"value,omitempty"`
}

type PhoneNumber

type PhoneNumber struct {
	Type_ string `json:"type"`

	Value string `json:"value"`
}

type Photo

type Photo struct {
	Type_ string `json:"type"`

	Value string `json:"value"`
}

type SearchRequest

type SearchRequest struct {

	// page size
	Count int32 `json:"count,omitempty"`

	// only support 'userName' or 'email' filter expressions for now
	Filter string `json:"filter,omitempty"`

	Schemas []string `json:"schemas,omitempty"`

	// start index (1-based)
	StartIndex int32 `json:"startIndex,omitempty"`
}

type ServiceProviderConfig

type ServiceProviderConfig struct {
	AuthenticationSchemes *AuthenticationSchemes `json:"authenticationSchemes,omitempty"`

	Bulk *BulkSupported `json:"bulk,omitempty"`

	ChangePassword *Supported `json:"changePassword,omitempty"`

	Etag *Supported `json:"etag,omitempty"`

	Filter *FilterSupported `json:"filter,omitempty"`

	Patch *Supported `json:"patch,omitempty"`

	Schemas []string `json:"schemas,omitempty"`

	Sort *Supported `json:"sort,omitempty"`

	XmlDataFormat *Supported `json:"xmlDataFormat,omitempty"`
}

type ServiceProviderConfigApiService

type ServiceProviderConfigApiService service

func (*ServiceProviderConfigApiService) GetServiceProviderConfig

ServiceProviderConfigApiService get service provider config * @param ctx context.Context for authentication, logging, tracing, etc. @return ServiceProviderConfig

type Supported

type Supported struct {
	Supported bool `json:"supported,omitempty"`
}

type User

type User struct {

	// user status
	Active bool `json:"active"`

	Addresses []Address `json:"addresses,omitempty"`

	// Emails []Email `json:"emails"`
	Emails []Email `json:"emails,omitempty"`

	// external unique resource id defined by provisioning client
	ExternalId string `json:"externalId,omitempty"`

	// unique resource id defined by RingCentral
	Id string `json:"id,omitempty"`

	Name *Name `json:"name,omitempty"`

	PhoneNumbers []PhoneNumber `json:"phoneNumbers,omitempty"`

	Photos []Photo `json:"photos,omitempty"`

	Schemas []string `json:"schemas,omitempty"`

	Urnietfparamsscimschemasextensionenterprise20User *EnterpriseUser `json:"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User,omitempty"`

	// MUST be same as work type email address
	//UserName string `json:"userName"`
	UserName string `json:"userName,omitempty"`
}

type UserApiService

type UserApiService service

func (*UserApiService) CreateUser

func (a *UserApiService) CreateUser(ctx context.Context, localVarOptionals map[string]interface{}) (UserResponse, *http.Response, error)
UserApiService create a user

* @param ctx context.Context for authentication, logging, tracing, etc. @param optional (nil or map[string]interface{}) with one or more of:

@param "body" (User) a new user without 'id'

@return UserResponse

func (*UserApiService) DeleteUser

func (a *UserApiService) DeleteUser(ctx context.Context, id string) (*http.Response, error)
UserApiService delete a user

* @param ctx context.Context for authentication, logging, tracing, etc. @param id user id @return

func (*UserApiService) GetUserById

func (a *UserApiService) GetUserById(ctx context.Context, id string) (UserResponse, *http.Response, error)
UserApiService get a user by id

* @param ctx context.Context for authentication, logging, tracing, etc. @param id user id @return UserResponse

func (*UserApiService) PatchUser

func (a *UserApiService) PatchUser(ctx context.Context, id string, localVarOptionals map[string]interface{}) (UserResponse, *http.Response, error)
UserApiService partially update/patch a user

* @param ctx context.Context for authentication, logging, tracing, etc. @param id user id @param optional (nil or map[string]interface{}) with one or more of:

@param "body" (UserPatch) patch operations list

@return UserResponse

func (*UserApiService) ReplaceUser

func (a *UserApiService) ReplaceUser(ctx context.Context, id string, localVarOptionals map[string]interface{}) (UserResponse, *http.Response, error)
UserApiService fully update/replace a user

* @param ctx context.Context for authentication, logging, tracing, etc. @param id user id @param optional (nil or map[string]interface{}) with one or more of:

@param "body" (User) an existing user

@return UserResponse

func (*UserApiService) SearchViaGet

func (a *UserApiService) SearchViaGet(ctx context.Context, localVarOptionals map[string]interface{}) (UserSearchResponse, *http.Response, error)
UserApiService search or list users

* @param ctx context.Context for authentication, logging, tracing, etc. @param optional (nil or map[string]interface{}) with one or more of:

@param "filter" (string) only support 'userName' or 'email' filter expressions for now
@param "startIndex" (int32) start index (1-based)
@param "count" (int32) page size

@return UserSearchResponse

func (*UserApiService) SearchViaPost

func (a *UserApiService) SearchViaPost(ctx context.Context, localVarOptionals map[string]interface{}) (UserSearchResponse, *http.Response, error)
UserApiService search or list users

* @param ctx context.Context for authentication, logging, tracing, etc. @param optional (nil or map[string]interface{}) with one or more of:

@param "body" (SearchRequest) search parameters

@return UserSearchResponse

type UserPatch

type UserPatch struct {

	////////////////////////////////////
	// for v2
	////////////////////////////////////
	// patch operations list
	Operations []PatchOperation `json:"Operations,omitempty"`

	////////////////////////////////////
	// for v1
	////////////////////////////////////
	// user status
	Active *bool `json:"active,omitempty"`

	Addresses []Address `json:"addresses,omitempty"`

	Emails []Email `json:"emails,omitempty"`

	// unique resource id defined by RingCentral
	Id string `json:"id,omitempty"`

	Name *Name `json:"name,omitempty"`

	PhoneNumbers []PhoneNumber `json:"phoneNumbers,omitempty"`

	Photos []Photo `json:"photos,omitempty"`

	Urnietfparamsscimschemasextensionenterprise20User *EnterpriseUser `json:"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User,omitempty"`

	// MUST be same as work type email address
	UserName string `json:"userName,omitempty"`

	Schemas []string `json:"schemas"`
}

type UserResponse

type UserResponse struct {

	// user status
	Active bool `json:"active,omitempty"`

	Addresses []Address `json:"addresses,omitempty"`

	Emails []Email `json:"emails"`

	// external unique resource id defined by provisioning client
	ExternalId string `json:"externalId,omitempty"`

	// unique resource id defined by RingCentral
	Id string `json:"id,omitempty"`

	Name *Name `json:"name"`

	PhoneNumbers []PhoneNumber `json:"phoneNumbers,omitempty"`

	Photos []Photo `json:"photos,omitempty"`

	Schemas []string `json:"schemas"`

	Urnietfparamsscimschemasextensionenterprise20User *EnterpriseUser `json:"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User,omitempty"`

	// MUST be same as work type email address
	UserName string `json:"userName"`

	Meta *Meta `json:"meta,omitempty"`
}

type UserSearchResponse

type UserSearchResponse struct {

	// user list
	Resources []UserResponse `json:"Resources,omitempty"`

	ItemsPerPage int64 `json:"itemsPerPage,omitempty"`

	Schemas []string `json:"schemas,omitempty"`

	StartIndex int64 `json:"startIndex,omitempty"`

	TotalResults int64 `json:"totalResults,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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