# README
Go API client for identitycloud
Introduction
The PingOne Advanced Identity Cloud REST API lets you manage your Advanced Identity Cloud tenants. The API exposes access management and identity management endpoints, with additional endpoints specific to Advanced Identity Cloud tenant environments.
We are now publishing the API spec in OpenAPI 3.0. For the legacy Swagger 2.0 spec, please download swagger.yaml, but note that it may not contain all new functionality.
For full PingOne Advanced Identity Cloud documentation, please visit the docs website.
Authenticating to the API
The PingOne Advanced Identity Cloud REST API has two different authentication methods:
- API key and secret: used for tenant read-only operations
- Access token: used for access management operations, identity management operations or tenant write operations
For a summary of how to use these authentication methods, refer to Authenticate to Advanced Identity Cloud REST API.
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:
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Installation
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
Put the package under your project folder and add the following in import:
import identitycloud "github.com/pingidentity/identitycloud-go-client"
To use a proxy, set the environment variable HTTP_PROXY
:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
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 sw.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), identitycloud.ContextServerIndex, 1)
Templated Server URL
Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), identitycloud.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 identified by "{classname}Service.{nickname}"
string.
Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices
and sw.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), identitycloud.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), identitycloud.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
Documentation for API Endpoints
All URIs are relative to https://openam-example.id.forgerock.io
Class | Method | HTTP request | Description |
---|---|---|---|
CSRsAPI | CreateCertificateSigningRequest | Post /environment/csrs | Create CSR |
CSRsAPI | DeleteCertificateSigningRequestById | Delete /environment/csrs/{id} | Delete CSR by ID |
CSRsAPI | GetCertificateSigningRequestById | Get /environment/csrs/{id} | Get CSR by ID |
CSRsAPI | GetCertificateSigningRequests | Get /environment/csrs | Get all CSRs |
CSRsAPI | UpdateCertificateSigningRequestById | Patch /environment/csrs/{id} | Update CSR by ID |
CertificatesAPI | CreateCertificate | Post /environment/certificates | Create certificate |
CertificatesAPI | DeleteCertificateByID | Delete /environment/certificates/{id} | Delete certificate by ID |
CertificatesAPI | GetCertificateByID | Get /environment/certificates/{id} | Get certificate by ID |
CertificatesAPI | GetCertificates | Get /environment/certificates | Get all certificates |
CertificatesAPI | UpdateCertificateByID | Patch /environment/certificates/{id} | Update certificate by ID |
ContentSecurityPolicyAPI | GetEnforcedContentSecurityPolicy | Get /environment/content-security-policy/enforced | Get enforced content security policy |
ContentSecurityPolicyAPI | GetReportOnlyContentSecurityPolicy | Get /environment/content-security-policy/report-only | Get report-only content security policy |
ContentSecurityPolicyAPI | SetEnforcedContentSecurityPolicy | Put /environment/content-security-policy/enforced | Set enforced content security policy |
ContentSecurityPolicyAPI | SetReportOnlyContentSecurityPolicy | Put /environment/content-security-policy/report-only | Set report-only content security policy |
CookieDomainsAPI | GetCookieDomains | Get /environment/cookie-domains | Get cookie domains |
CookieDomainsAPI | SetCookieDomains | Put /environment/cookie-domains | Set cookie domains |
CountAPI | GetCount | Get /environment/count | Get count of ESVs |
CustomDomainsAPI | GetCustomDomains | Get /environment/custom-domains/{realm} | Get custom domains |
CustomDomainsAPI | SetCustomDomains | Put /environment/custom-domains/{realm} | Set custom domains |
CustomDomainsAPI | VerifyCustomDomains | Post /environment/custom-domains | Verify a CNAME |
FederationEnforcementAPI | GetEnforcement | Get /environment/federation/enforcement | Get enforcement of federation |
FederationEnforcementAPI | SetEnforcement | Put /environment/federation/enforcement | Set enforcement of federation |
PromotionAPI | CheckLock | Get /environment/promotion/lock/state | Get lock status |
PromotionAPI | GetLastReport | Get /environment/promotion/report | Get last promotion report |
PromotionAPI | GetProvisionalReport | Get /environment/promotion/report/provisional | Get a provisional promotion report |
PromotionAPI | GetProvisionalRollbackReport | Get /environment/promotion/report/provisional-rollback | Get a provisional rollback report |
PromotionAPI | GetReport | Get /environment/promotion/report/{reportId} | Get a promotion report |
PromotionAPI | GetReportList | Get /environment/promotion/reports | Get promotion reports |
PromotionAPI | Lock | Post /environment/promotion/lock | Lock environments |
PromotionAPI | Progress | Get /environment/promotion/promote | Get promotion status |
PromotionAPI | Rollback | Post /environment/promotion/rollback | Rollback a promotion |
PromotionAPI | Start | Post /environment/promotion/promote | Run a promotion |
PromotionAPI | Unlock | Delete /environment/promotion/lock/{promotionId} | Unlock environments |
ReleaseAPI | GetReleaseInfo | Get /environment/release | Get release information |
RestartAPI | GetRestartStatus | Get /environment/startup | Get restart status |
RestartAPI | Restart | Post /environment/startup | Initiate restart |
SSOCookieAPI | GetSSOCookie | Get /environment/sso-cookie | Get SSO cookie configuration |
SSOCookieAPI | ResetSSOCookie | Post /environment/sso-cookie | Reset SSO cookie configuration |
SSOCookieAPI | SetSSOCookie | Put /environment/sso-cookie | Set SSO cookie configuration |
SecretsAPI | ActionSecret | Post /environment/secrets/{secretId} | Set a secret description |
SecretsAPI | ChangeSecretVersion | Post /environment/secrets/{secretId}/versions/{versionId} | Update the status of a version of a secret |
SecretsAPI | CreateSecret | Put /environment/secrets/{secretId} | Create a secret |
SecretsAPI | CreateSecretVersion | Post /environment/secrets/{secretId}/versions | Create a new version of a secret |
SecretsAPI | DeleteSecret | Delete /environment/secrets/{secretId} | Delete a secret |
SecretsAPI | DeleteSecretVersion | Delete /environment/secrets/{secretId}/versions/{versionId} | Delete a version of a secret |
SecretsAPI | GetAllSecrets | Get /environment/secrets | Get all secrets |
SecretsAPI | GetSecret | Get /environment/secrets/{secretId} | Get a secret |
SecretsAPI | GetSecretVersion | Get /environment/secrets/{secretId}/versions/{versionId} | Get a version of a secret |
SecretsAPI | GetSecretVersions | Get /environment/secrets/{secretId}/versions | Get all versions of a secret |
VariablesAPI | ActionVariable | Post /environment/variables/{variableId} | Set a variable description |
VariablesAPI | CreateVariables | Put /environment/variables/{variableId} | Create or update a variable |
VariablesAPI | DeleteVariable | Delete /environment/variables/{variableId} | Delete a variable |
VariablesAPI | GetAllVariables | Get /environment/variables | Get all variables |
VariablesAPI | GetVariable | Get /environment/variables/{variableId} | Get a variable |
Documentation For Models
- BadRequest
- CName
- Certificate
- CertificateSigningRequest
- Conflict
- ContentSecurityPolicy
- CookieDomains
- CreateCertificateRequest
- CreateCertificateSigningRequestRequest
- CustomDomains
- Error
- EsvCount
- EsvError
- EsvRestartStatus
- EsvSecretCreateRequest
- EsvSecretResponse
- EsvSecretVersionCreateRequest
- EsvSecretVersionResponse
- EsvSecretVersionStatusRequest
- EsvSecretsListResponse
- EsvSetDescriptionRequest
- EsvVariableCreateUpdateRequest
- EsvVariableListV1
- EsvVariableListV2
- EsvVariableResponse
- EsvVariableResponseV2
- FederationEnforcement
- Forbidden
- GetAllVariables200Response
- InternalServerError
- ModelDefault
- NotFound
- P1Connect
- P1ConnectConfigureRequest
- P1ConnectConfigureResponse
- PromotionCIMeta
- PromotionConflictingLockState
- PromotionLockState
- PromotionLockStateLowerEnv
- PromotionProgress
- PromotionReport
- PromotionReportContent
- PromotionReportContentConfigChange
- PromotionReportMeta
- PromotionReportReport
- PromotionRequest
- PromotionStart
- PromotionStartLocking
- PromotionStartUnlocking
- PromotionUnlocked
- Release
- RollbackRequest
- RollbackStart
- SSOCookie
- Unauthorized
- UpdateCertificateRequest
- UpdateCertificateSigningRequestRequest
Documentation For Authorization
Authentication schemes defined for the API:
OAuth2
- Type: OAuth
- Flow: accessCode
- Authorization URL: https://example.com/oauth/authorize
- Scopes:
- fr:idc:certificate:*: Full access to certificates configuration
- fr:idc:certificate:read: Read only access to certificates configuration
- fr:idc:content-security-policy:*: Full access to content security policy configuration
- fr:idc:custom-domain:*: Full access to custom domains configuration
- fr:idc:esv:*: Full ESV access
- fr:idc:esv:read: Read ESVs
- fr:idc:esv:restart: Perform a restart of the ID Cloud workloads
- fr:idc:esv:update: Modify or delete ESVs
- fr:idc:federation:*: Full access to federation configuration
- fr:idc:promotion:*: Allows a user to trigger a promotion
- fr:idc:release:*: Full access to release configuration
- fr:idc:sso-cookie:*: Full access to SSO cookie configuration
- fr:idm:*: Grants full ESV access if user has openidm-admin role
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)
bearer
- Type: HTTP Bearer token authentication
Example
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING")
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