# 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

ClassMethodHTTP requestDescription
CSRsAPICreateCertificateSigningRequestPost /environment/csrsCreate CSR
CSRsAPIDeleteCertificateSigningRequestByIdDelete /environment/csrs/{id}Delete CSR by ID
CSRsAPIGetCertificateSigningRequestByIdGet /environment/csrs/{id}Get CSR by ID
CSRsAPIGetCertificateSigningRequestsGet /environment/csrsGet all CSRs
CSRsAPIUpdateCertificateSigningRequestByIdPatch /environment/csrs/{id}Update CSR by ID
CertificatesAPICreateCertificatePost /environment/certificatesCreate certificate
CertificatesAPIDeleteCertificateByIDDelete /environment/certificates/{id}Delete certificate by ID
CertificatesAPIGetCertificateByIDGet /environment/certificates/{id}Get certificate by ID
CertificatesAPIGetCertificatesGet /environment/certificatesGet all certificates
CertificatesAPIUpdateCertificateByIDPatch /environment/certificates/{id}Update certificate by ID
ContentSecurityPolicyAPIGetEnforcedContentSecurityPolicyGet /environment/content-security-policy/enforcedGet enforced content security policy
ContentSecurityPolicyAPIGetReportOnlyContentSecurityPolicyGet /environment/content-security-policy/report-onlyGet report-only content security policy
ContentSecurityPolicyAPISetEnforcedContentSecurityPolicyPut /environment/content-security-policy/enforcedSet enforced content security policy
ContentSecurityPolicyAPISetReportOnlyContentSecurityPolicyPut /environment/content-security-policy/report-onlySet report-only content security policy
CookieDomainsAPIGetCookieDomainsGet /environment/cookie-domainsGet cookie domains
CookieDomainsAPISetCookieDomainsPut /environment/cookie-domainsSet cookie domains
CountAPIGetCountGet /environment/countGet count of ESVs
CustomDomainsAPIGetCustomDomainsGet /environment/custom-domains/{realm}Get custom domains
CustomDomainsAPISetCustomDomainsPut /environment/custom-domains/{realm}Set custom domains
CustomDomainsAPIVerifyCustomDomainsPost /environment/custom-domainsVerify a CNAME
FederationEnforcementAPIGetEnforcementGet /environment/federation/enforcementGet enforcement of federation
FederationEnforcementAPISetEnforcementPut /environment/federation/enforcementSet enforcement of federation
PromotionAPICheckLockGet /environment/promotion/lock/stateGet lock status
PromotionAPIGetLastReportGet /environment/promotion/reportGet last promotion report
PromotionAPIGetProvisionalReportGet /environment/promotion/report/provisionalGet a provisional promotion report
PromotionAPIGetProvisionalRollbackReportGet /environment/promotion/report/provisional-rollbackGet a provisional rollback report
PromotionAPIGetReportGet /environment/promotion/report/{reportId}Get a promotion report
PromotionAPIGetReportListGet /environment/promotion/reportsGet promotion reports
PromotionAPILockPost /environment/promotion/lockLock environments
PromotionAPIProgressGet /environment/promotion/promoteGet promotion status
PromotionAPIRollbackPost /environment/promotion/rollbackRollback a promotion
PromotionAPIStartPost /environment/promotion/promoteRun a promotion
PromotionAPIUnlockDelete /environment/promotion/lock/{promotionId}Unlock environments
ReleaseAPIGetReleaseInfoGet /environment/releaseGet release information
RestartAPIGetRestartStatusGet /environment/startupGet restart status
RestartAPIRestartPost /environment/startupInitiate restart
SSOCookieAPIGetSSOCookieGet /environment/sso-cookieGet SSO cookie configuration
SSOCookieAPIResetSSOCookiePost /environment/sso-cookieReset SSO cookie configuration
SSOCookieAPISetSSOCookiePut /environment/sso-cookieSet SSO cookie configuration
SecretsAPIActionSecretPost /environment/secrets/{secretId}Set a secret description
SecretsAPIChangeSecretVersionPost /environment/secrets/{secretId}/versions/{versionId}Update the status of a version of a secret
SecretsAPICreateSecretPut /environment/secrets/{secretId}Create a secret
SecretsAPICreateSecretVersionPost /environment/secrets/{secretId}/versionsCreate a new version of a secret
SecretsAPIDeleteSecretDelete /environment/secrets/{secretId}Delete a secret
SecretsAPIDeleteSecretVersionDelete /environment/secrets/{secretId}/versions/{versionId}Delete a version of a secret
SecretsAPIGetAllSecretsGet /environment/secretsGet all secrets
SecretsAPIGetSecretGet /environment/secrets/{secretId}Get a secret
SecretsAPIGetSecretVersionGet /environment/secrets/{secretId}/versions/{versionId}Get a version of a secret
SecretsAPIGetSecretVersionsGet /environment/secrets/{secretId}/versionsGet all versions of a secret
VariablesAPIActionVariablePost /environment/variables/{variableId}Set a variable description
VariablesAPICreateVariablesPut /environment/variables/{variableId}Create or update a variable
VariablesAPIDeleteVariableDelete /environment/variables/{variableId}Delete a variable
VariablesAPIGetAllVariablesGet /environment/variablesGet all variables
VariablesAPIGetVariableGet /environment/variables/{variableId}Get a variable

Documentation For Models

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

Author