go get github.com/ConductorOne/conductorone-sdk-go
package main
import (
"context"
conductoronesdkgo "github.com/conductorone/conductorone-sdk-go/v2"
"github.com/conductorone/conductorone-sdk-go/v2/pkg/models/shared"
"log"
)
func main() {
ctx := context.Background()
s := NewWithCredentials(ctx, &ClientCredentials{
ClientID: "",
ClientSecret: "",
} )
res, err := s.Apps.Create(ctx, &shared.CreateAppRequest{
Owners: []string{
"string",
},
})
if err != nil {
log.Fatal(err)
}
if res.CreateAppResponse != nil {
// handle response
}
}
- CancelAppAccessRequestsDefaults - Cancel App Access Requests Defaults
- CreateAppAccessRequestsDefaults - Create App Access Requests Defaults
- GetAppAccessRequestsDefaults - Get App Access Requests Defaults
- Create - Create
- CreateDelegated - Create Delegated
- Delete - Delete
- ForceSync - Force Sync
- Get - Get
- GetCredentials - Get Credentials
- List - List
- RevokeCredential - Revoke Credential
- RotateCredential - Rotate Credential
- Update - Update
- UpdateDelegated - Update Delegated
- Get - Get
- List - List
- ListForAppResource - List For App Resource
- ListForAppUser - List For App User
ListUsers- List Users⚠️ Deprecated- Update - Update
- Search - Search
- SearchAppEntitlementsWithExpired - Search App Entitlements With Expired
- ListAppUsersForIdentityWithGrant - List App Users For Identity With Grant
- SearchPastGrants - Search Past Grants
- List - List
- GenerateReport - Generate Report
- List - List
- Update - Update
- CreateAttributeValue - Create Attribute Value
- DeleteAttributeValue - Delete Attribute Value
- GetAttributeValue - Get Attribute Value
- ListAttributeTypes - List Attribute Types
- ListAttributeValues - List Attribute Values
- Introspect - Introspect
- AddAccessEntitlements - Add Access Entitlements
- AddAppEntitlements - Add App Entitlements
- Create - Create
- Delete - Delete
- Get - Get
- GetBundleAutomation - Get Bundle Automation
- List - List
- ListEntitlementsForAccess - List Entitlements For Access
- ListEntitlementsPerCatalog - List Entitlements Per Catalog
- RemoveAccessEntitlements - Remove Access Entitlements
- RemoveAppEntitlements - Remove App Entitlements
- SetBundleAutomation - Set Bundle Automation
- Update - Update
- Create - Create
- ValidateCEL - Validate Cel
- SearchAppResourceTypes - Search App Resource Types
- Search - Search
- SearchAttributeValues - Search Attribute Values
- Search - Search
- SearchEntitlements - Search Entitlements
- Search - Search
- Search - Search
- Search - Search
- Search - Search
- Get - Get
- ListEvents - List Events
- CreateGrantTask - Create Grant Task
- CreateOffboardingTask - Create Offboarding Task
- CreateRevokeTask - Create Revoke Task
- Get - Get
- Approve - Approve
- Comment - Comment
- Deny - Deny
- EscalateToEmergencyAccess - Escalate To Emergency Access
- Reassign - Reassign
- Restart - Restart
Handling errors in this SDK should largely match your expectations. All operations return a response object or an error, they will never return both. When specified by the OpenAPI spec document, the SDK will return the appropriate subclass.
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 400-600 | / |
package main
import (
"context"
"errors"
conductoronesdkgo "github.com/conductorone/conductorone-sdk-go/v2"
"github.com/conductorone/conductorone-sdk-go/v2/pkg/models/sdkerrors"
"github.com/conductorone/conductorone-sdk-go/v2/pkg/models/shared"
"log"
)
func main() {
ctx := context.Background()
s := NewWithCredentials(ctx, &ClientCredentials{
ClientID: "",
ClientSecret: "",
})
res, err := s.Apps.Create(ctx, &shared.CreateAppRequest{
Owners: []string{
"string",
},
})
if err != nil {
var e *sdkerrors.SDKError
if errors.As(err, &e) {
// handle error
log.Fatal(e.Error())
}
}
}
package main
import (
"context"
conductoronesdkgo "github.com/conductorone/conductorone-sdk-go/v2"
"github.com/conductorone/conductorone-sdk-go/v2/pkg/models/shared"
"log"
)
func main() {
ctx := context.Background()
/* Optional Override
* Server URL will be extracted from client, optionally, you can
* provide a server URL or a tenant domain (will create URL https://{tenant_domain}.conductor.one)
*/
opts := []sdk.CustomSDKOption{}
opt, _ := sdk.WithTenantCustom("Server URL or Tenant Domain")
opts = append(opts, opt)
s := NewWithCredentials(ctx, &ClientCredentials{
ClientID: "",
ClientSecret: "",
} opts...)
res, err := s.Apps.Create(ctx, &shared.CreateAppRequest{
Owners: []string{
"string",
},
})
if err != nil {
log.Fatal(err)
}
if res.CreateAppResponse != nil {
// handle response
}
}
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply provide a retry.Config
object to the call by using the WithRetries
option:
package main
import (
"context"
conductoronesdkgo "github.com/conductorone/conductorone-sdk-go"
"github.com/conductorone/conductorone-sdk-go/pkg/models/shared"
"github.com/conductorone/conductorone-sdk-go/pkg/retry"
"log"
"pkg/models/operations"
)
func main() {
s := conductoronesdkgo.New(
conductoronesdkgo.WithSecurity(shared.Security{
BearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
Oauth: "<YOUR_OAUTH_HERE>",
}),
)
ctx := context.Background()
res, err := s.Apps.Create(ctx, nil, operations.WithRetries(
retry.Config{
Strategy: "backoff",
Backoff: &retry.BackoffStrategy{
InitialInterval: 1,
MaxInterval: 50,
Exponent: 1.1,
MaxElapsedTime: 100,
},
RetryConnectionErrors: false,
}))
if err != nil {
log.Fatal(err)
}
if res.CreateAppResponse != nil {
// handle response
}
}
If you'd like to override the default retry strategy for all operations that support retries, you can use the WithRetryConfig
option at SDK initialization:
package main
import (
"context"
conductoronesdkgo "github.com/conductorone/conductorone-sdk-go"
"github.com/conductorone/conductorone-sdk-go/pkg/models/shared"
"github.com/conductorone/conductorone-sdk-go/pkg/retry"
"log"
)
func main() {
s := conductoronesdkgo.New(
conductoronesdkgo.WithRetryConfig(
retry.Config{
Strategy: "backoff",
Backoff: &retry.BackoffStrategy{
InitialInterval: 1,
MaxInterval: 50,
Exponent: 1.1,
MaxElapsedTime: 100,
},
RetryConnectionErrors: false,
}),
conductoronesdkgo.WithSecurity(shared.Security{
BearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
Oauth: "<YOUR_OAUTH_HERE>",
}),
)
ctx := context.Background()
res, err := s.Apps.Create(ctx, nil)
if err != nil {
log.Fatal(err)
}
if res.CreateAppResponse != nil {
// handle response
}
}
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release !