yacchi / go-onelogin-oas

Go API client for onelogin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go API client for github.com/yacchi/go-onelogin-oas

This is an administrative API for OneLogin customers

Overview

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

  • API version: 1.1.0-oas3
  • Package version: 0.2.1
  • Build package: MyGoClientCodegen

Installation

Install the following dependencies:

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

import "github.com/yacchi/go-onelogin-oas"

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value onelogin.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), onelogin.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value onelogin.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), onelogin.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identifield by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using onelogin.ContextOperationServerIndices and onelogin.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), onelogin.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), onelogin.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://api.us.onelogin.com/api

Method HTTP request Description
CreateApp Post /2/apps Create an App
DeleteApp Delete /2/apps/{id} Delete an app
DeleteAppParameter Delete /2/apps/{id}/parameters/{parameter_id} Delete an app parameter
GetApp Get /2/apps/{id} Get an App
GetApps Get /2/apps Get Apps
UpdateApp Put /2/apps/{id} Update an App
GetConnectors Get /2/connectors Get Connectors
GetEvent Get /1/events/{id} Get Event by ID
GetEventTypes Get /1/events/types Get Event Types
GetEvents Get /1/events Get Events
GetGroup Get /1/groups/{id} Get Group by ID
GetGroups Get /1/groups Get Groups
CreateInviteLink Post /1/invites/get_invite_link Generate Invite Link
SendInviteLink Post /1/invites/send_invite_link Send Invite Link
AuthenticateUser Post /1/login/auth Authenticate a user
VerifyLoginMFAToken Post /1/login/verify_factor Verify an MFA token
ActivateUserMFADevice Post /1/users/{id}/otp_devices/{device_id}/trigger Activate an authentication factor
DeleteUserMFADevice Delete /1/users/{id}/otp_devices/{device_id} Remove an authentication device
EnrollUserMFADevice Post /1/users/{id}/otp_devices Enroll a user with a given authentication factor.
GetUserAvailableMFAFactors Get /1/users/{id}/auth_factors Get a list of MFA factors available to user
GetUserEnrolledMFADevices Get /1/users/{id}/otp_devices Get enrolled authentication devices
VerifyUserMFADevice Post /1/users/{id}/otp_devices/{device_id}/verify Verify an authentication device
AddPrivilegeRoles Post /1/privileges/{id}/roles Assign roles
AddPrivilegeUsers Post /1/privileges/{id}/users Assign users
CreatePrivilege Post /1/privileges Creates privilege
DeletePrivilege Delete /1/privileges/{id} Delete privilege
GetPrivilege Get /1/privileges/{id} Get privilege
GetPrivilegeRoles Get /1/privileges/{id}/roles Get roles
GetPrivilegeUsers Get /1/privileges/{id}/users Get privilege users
GetPrivileges Get /1/privileges Get Privileges
RemovePrivilegeRole Delete /1/privileges/{id}/roles/{role_id} Remove a role
RemovePrivlegeUser Delete /1/privileges/{id}/users/{user_id} Remove a user
UpdatePrivilege Put /1/privileges/{id} Update privilege
GetRole Get /1/roles/{id} Get Role by ID
GetRoles Get /1/roles Get Roles
CreateSAMLAssertion Post /1/saml_assertion Generate SAML assertion
VerifySAMLAssertionMFAToken Post /1/saml_assertion/verify_factor Verify an MFA token
AddUserRoles Put /1/users/{id}/add_roles Assign Role to User
Call1UsersPost Post /1/users Create a User
CreateUserTempMFAToken Post /1/users/{id}/mfa_token Generate Temp MFA Token
DeleteUser Delete /1/users/{id} Delete a user account
GetCustomAttributes Get /1/users/custom_attributes Get Custom Attributes
GetUser Get /1/users/{id} Get a User
GetUserApps Get /1/users/{id}/apps Get User Apps
GetUserRoles Get /1/users/{id}/roles Get User Roles
GetUsers Get /1/users Get Users
LockUser Put /1/users/{id}/lock_user Lock a user account
LogoutUser Put /1/users/{id}/logout Log a user out of any and all sessions
RemoveUserRoles Put /1/users/{id}/remove_roles Remove Roles from User
UpdateUser Put /1/users/{id} Update a User
UpdateUserCustomAttributes Put /1/users/{id}/set_custom_attributes Set a custom attribute
UpdateUserPassword Put /1/users/set_password_clear_text/{id} Set a the password for a user
UpdateUserPasswordSalted Put /1/users/set_password_using_salt/{id} Set a pre salted password for a user
UpdateUserState Put /1/users/{id}/set_state Set the State for a user.

Documentation For Models

Documentation For Authorization

application

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

Example

auth := context.WithValue(context.Background(), onelogin.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, onelogin.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Licence

MIT

About

Go API client for onelogin

License:MIT License


Languages

Language:HTML 86.6%Language:Groovy 8.5%Language:Makefile 2.4%Language:JSONiq 2.4%