conductoronesdkgo

package module
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 28 Imported by: 2

README

conductorone-api

SDK Installation

go get github.com/ConductorOne/conductorone-sdk-go

SDK Example Usage

Example
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
	}
}

Available Resources and Operations

Apps
Connector
AppEntitlements
AppEntitlementUserBinding
AppEntitlementOwners
AppOwners
AppReport
AppReportAction
AppResourceType
AppResource
AppResourceOwners
AppUsageControls
AppUser
Attributes
Auth
RequestCatalogManagement
Directory
PersonalClient
Roles
Policies
PolicyValidate
AppResourceSearch
AppSearch
AttributeSearch
AppEntitlementSearch
PolicySearch
RequestCatalogSearch
TaskSearch
UserSearch
AWSExternalIDSettings
SessionSettings
Task
TaskActions
User

Error Handling

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 /
Example
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())
		}
	}
}

SDK Example Usage with Custom Server/Tenant

Example
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
	}
}

Maturity

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.

Contributions

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 !

SDK Created by Speakeasy

Documentation

Index

Constants

View Source
const ClientIdGolangSDK = "2RCzHlak5q7CY14SdBc8HoZEJRf"

Variables

View Source
var (
	ErrInvalidClientSecret = errors.New("invalid client secret")
	ErrInvalidClientID     = errors.New("invalid client id")
)
View Source
var ServerList = []string{

	"https://{tenantDomain}.conductor.one",
}

ServerList contains the list of servers available to the SDK

Functions

func Bool

func Bool(b bool) *bool

Bool provides a helper function to return a pointer to a bool

func Float32

func Float32(f float32) *float32

Float32 provides a helper function to return a pointer to a float32

func Float64

func Float64(f float64) *float64

Float64 provides a helper function to return a pointer to a float64

func Int

func Int(i int) *int

Int provides a helper function to return a pointer to an int

func Int64

func Int64(i int64) *int64

Int64 provides a helper function to return a pointer to an int64

func NewTokenSource added in v1.6.1

func NewTokenSource(ctx context.Context, clientID string, clientSecret string, tokenHost string) (oauth2.TokenSource, error)

func String

func String(s string) *string

String provides a helper function to return a pointer to a string

Types

type AWSExternalIDSettings added in v1.16.0

type AWSExternalIDSettings struct {
	// contains filtered or unexported fields
}

func (*AWSExternalIDSettings) Get added in v1.16.0

Get Invokes the c1.api.settings.v1.AWSExternalIDSettings.Get method.

type AppEntitlementOwners added in v1.15.0

type AppEntitlementOwners struct {
	// contains filtered or unexported fields
}

func (*AppEntitlementOwners) Add added in v1.15.0

Add Add an owner to a given app entitlement.

func (*AppEntitlementOwners) List added in v1.15.0

List List owners for a given app entitlement.

func (*AppEntitlementOwners) Remove added in v1.15.0

Remove Remove an owner from a given app entitlement.

func (*AppEntitlementOwners) Set added in v1.15.0

Set Sets the owners for a given app entitlement to the specified list of users.

type AppEntitlementSearch added in v1.15.0

type AppEntitlementSearch struct {
	// contains filtered or unexported fields
}

func (*AppEntitlementSearch) Search added in v1.15.0

Search Search app entitlements based on filters specified in the request body.

type AppEntitlementUserBinding added in v1.15.0

type AppEntitlementUserBinding struct {
	// contains filtered or unexported fields
}

func (*AppEntitlementUserBinding) ListAppUsersForIdentityWithGrant added in v1.15.0

ListAppUsersForIdentityWithGrant - List App Users For Identity With Grant Returns a list of app users for the identity in the app. If that app user also has a grant to the entitlement from the request, data about the grant is also returned. It will always return ALL app users for this identity, but only SOME may have grant data.

type AppEntitlements added in v1.15.0

type AppEntitlements struct {
	// contains filtered or unexported fields
}

func (*AppEntitlements) Get added in v1.15.0

Get Get an app entitlement by ID.

func (*AppEntitlements) List added in v1.15.0

List List app entitlements associated with an app.

func (*AppEntitlements) ListForAppResource added in v1.15.0

ListForAppResource - List For App Resource List app entitlements associated with an app resource.

func (*AppEntitlements) ListForAppUser added in v1.15.0

ListForAppUser - List For App User List app entitlements associated with an app user.

func (*AppEntitlements) ListUsers added in v1.15.0

ListUsers - List Users List the users, as AppEntitlementUsers objects, of an app entitlement.

func (*AppEntitlements) Update added in v1.15.0

Update Update an app entitlement by ID.

type AppOwners added in v1.15.0

type AppOwners struct {
	// contains filtered or unexported fields
}

func (*AppOwners) Add added in v1.15.0

Add Adds an owner to an app.

func (*AppOwners) List added in v1.15.0

List List owners of an app.

func (*AppOwners) Remove added in v1.15.0

Remove Removes an owner from an app.

func (*AppOwners) Set added in v1.15.0

Set Sets the owners for a given app to the specified list of users.

type AppReport added in v1.15.0

type AppReport struct {
	// contains filtered or unexported fields
}

func (*AppReport) List added in v1.15.0

List Get a list of reports for the given app.

type AppReportAction added in v1.15.0

type AppReportAction struct {
	// contains filtered or unexported fields
}

func (*AppReportAction) GenerateReport added in v1.15.0

GenerateReport - Generate Report Generate a report for the given app.

type AppResource added in v1.15.0

type AppResource struct {
	// contains filtered or unexported fields
}

func (*AppResource) Get added in v1.15.0

Get Invokes the c1.api.app.v1.AppResourceService.Get method.

func (*AppResource) List added in v1.15.0

List Invokes the c1.api.app.v1.AppResourceService.List method.

type AppResourceOwners added in v1.15.0

type AppResourceOwners struct {
	// contains filtered or unexported fields
}

func (*AppResourceOwners) List added in v1.15.0

List List all owners of an app resource.

type AppResourceSearch added in v1.15.0

type AppResourceSearch struct {
	// contains filtered or unexported fields
}

func (*AppResourceSearch) SearchAppResourceTypes added in v1.15.0

SearchAppResourceTypes - Search App Resource Types Search app resources based on filters specified in the request body.

type AppResourceType added in v1.15.0

type AppResourceType struct {
	// contains filtered or unexported fields
}

func (*AppResourceType) Get added in v1.15.0

Get Get an app resource type.

func (*AppResourceType) List added in v1.15.0

List List app resource types.

type AppSearch added in v1.15.0

type AppSearch struct {
	// contains filtered or unexported fields
}

func (*AppSearch) Search added in v1.15.0

Search Search apps based on filters specified in the request body.

type AppUsageControls added in v1.15.0

type AppUsageControls struct {
	// contains filtered or unexported fields
}

func (*AppUsageControls) Get added in v1.15.0

Get Get usage controls, as an AppUsageControls object which describes some peripheral configuration, for an app.

func (*AppUsageControls) Update added in v1.15.0

Update Update usage controls for an app.

type AppUser added in v1.15.0

type AppUser struct {
	// contains filtered or unexported fields
}

func (*AppUser) Update added in v1.15.0

Update Update an app user by ID. Only the fields specified in the update mask are updated.

Currently, only the appUserType, and identityUserId fields can be updated.

type Apps added in v1.15.0

type Apps struct {
	// contains filtered or unexported fields
}

func (*Apps) Create added in v1.15.0

Create Create a new app.

func (*Apps) Delete added in v1.15.0

Delete Delete an app.

func (*Apps) Get added in v1.15.0

Get Get an app by ID.

func (*Apps) List added in v1.15.0

List List all apps.

func (*Apps) Update added in v1.15.0

Update Update an existing app.

type AttributeSearch added in v1.15.0

type AttributeSearch struct {
	// contains filtered or unexported fields
}

func (*AttributeSearch) SearchAttributeValues added in v1.15.0

SearchAttributeValues - Search Attribute Values Search attributes based on filters specified in the request body.

type Attributes added in v1.15.0

type Attributes struct {
	// contains filtered or unexported fields
}

func (*Attributes) CreateAttributeValue added in v1.15.0

CreateAttributeValue - Create Attribute Value Create a new attribute value.

func (*Attributes) DeleteAttributeValue added in v1.15.0

DeleteAttributeValue - Delete Attribute Value Delete an attribute value by id.

func (*Attributes) GetAttributeValue added in v1.15.0

GetAttributeValue - Get Attribute Value Get an attribute value by id.

func (*Attributes) ListAttributeTypes added in v1.15.0

ListAttributeTypes - List Attribute Types List all attribute types.

func (*Attributes) ListAttributeValues added in v1.15.0

ListAttributeValues - List Attribute Values List all attribute values for a given attribute type.

type Auth added in v1.15.0

type Auth struct {
	// contains filtered or unexported fields
}

func (*Auth) Introspect added in v1.15.0

Introspect Introspect returns the current user's principle_id, user_id and a list of roles, permissions, and enabled features.

type ClientConfig added in v1.15.0

type ClientConfig struct {
	// contains filtered or unexported fields
}

func NormalizeTenant added in v1.15.0

func NormalizeTenant(input string) (*ClientConfig, error)

func ParseClientID added in v1.15.0

func ParseClientID(input string) (*ClientConfig, error)

func (*ClientConfig) GetServerURL added in v1.15.0

func (c *ClientConfig) GetServerURL() string

GetServerURL returns the server URL. If serverURL is empty (""), it constructs the server URL using the tenant. However, if the tenant is also empty, then it will return an empty string.

func (*ClientConfig) ServerURL added in v1.15.0

func (c *ClientConfig) ServerURL() string

ServerURL returns the server URL.

func (*ClientConfig) SetServerURL added in v1.15.0

func (c *ClientConfig) SetServerURL(serverURL string) error

func (*ClientConfig) SetTenant added in v1.15.0

func (c *ClientConfig) SetTenant(tenant string) error

func (*ClientConfig) Tenant added in v1.15.0

func (c *ClientConfig) Tenant() string

func (*ClientConfig) UseWithServer added in v1.15.0

func (c *ClientConfig) UseWithServer() bool

func (*ClientConfig) UseWithTenant added in v1.15.0

func (c *ClientConfig) UseWithTenant() bool

type ClientCredentials added in v1.1.1

type ClientCredentials struct {
	ClientID     string
	ClientSecret string
}

func LoginFlow added in v1.1.1

func LoginFlow(
	ctx context.Context,
	tenantName string,
	clientID string,
	personalClientCredentialDisplayName string,
	cb func(validateDetails *DeviceCodeResponse) error,
) (*ClientCredentials, error)

type ConductoroneAPI

type ConductoroneAPI struct {
	Apps                      *Apps
	Connector                 *Connector
	AppEntitlements           *AppEntitlements
	AppEntitlementUserBinding *AppEntitlementUserBinding
	AppEntitlementOwners      *AppEntitlementOwners
	AppOwners                 *AppOwners
	AppReport                 *AppReport
	AppReportAction           *AppReportAction
	AppResourceType           *AppResourceType
	AppResource               *AppResource
	AppResourceOwners         *AppResourceOwners
	AppUsageControls          *AppUsageControls
	AppUser                   *AppUser
	Attributes                *Attributes
	Auth                      *Auth
	RequestCatalogManagement  *RequestCatalogManagement
	Directory                 *Directory
	PersonalClient            *PersonalClient
	Roles                     *Roles
	Policies                  *Policies
	PolicyValidate            *PolicyValidate
	AppResourceSearch         *AppResourceSearch
	AppSearch                 *AppSearch
	AttributeSearch           *AttributeSearch
	AppEntitlementSearch      *AppEntitlementSearch
	PolicySearch              *PolicySearch
	RequestCatalogSearch      *RequestCatalogSearch
	TaskSearch                *TaskSearch
	UserSearch                *UserSearch
	AWSExternalIDSettings     *AWSExternalIDSettings
	SessionSettings           *SessionSettings
	Task                      *Task
	TaskActions               *TaskActions
	User                      *User
	// contains filtered or unexported fields
}

ConductoroneAPI - ConductorOne API: The ConductorOne API is a HTTP API for managing ConductorOne resources.

func New

func New(opts ...SDKOption) *ConductoroneAPI

New creates a new instance of the SDK with the provided options

func NewWithCredentials added in v1.6.1

func NewWithCredentials(ctx context.Context, cred *ClientCredentials, opts ...CustomSDKOption) (*ConductoroneAPI, error)

type Connector added in v1.15.0

type Connector struct {
	// contains filtered or unexported fields
}

func (*Connector) Create added in v1.15.0

Create Create a configured connector.

func (*Connector) CreateDelegated added in v1.15.0

CreateDelegated - Create Delegated Create a connector that is pending a connector config.

func (*Connector) Delete added in v1.15.0

Delete Delete a connector.

func (*Connector) Get added in v1.15.0

Get Get a connector.

func (*Connector) GetCredentials added in v1.15.0

GetCredentials - Get Credentials Get credentials for a connector.

func (*Connector) List added in v1.15.0

List List connectors for an app.

func (*Connector) RevokeCredential added in v1.15.0

RevokeCredential - Revoke Credential Revoke credentials for a connector.

func (*Connector) RotateCredential added in v1.15.0

RotateCredential - Rotate Credential Rotate credentials for a connector.

func (*Connector) Update added in v1.15.0

Update Update a connector.

func (*Connector) UpdateDelegated added in v1.15.0

UpdateDelegated - Update Delegated Update a delegated connector.

type CustomOptions added in v1.6.1

type CustomOptions struct {
	*ClientConfig
	// contains filtered or unexported fields
}

type CustomSDKOption added in v1.6.1

type CustomSDKOption func(*CustomOptions)

func WithLog added in v1.6.1

func WithLog(logger *zap.Logger) CustomSDKOption

func WithTLSConfig added in v1.6.1

func WithTLSConfig(tlsConfig *tls.Config) CustomSDKOption

func WithTenantCustom added in v1.6.1

func WithTenantCustom(input string) (CustomSDKOption, error)

func WithUserAgent added in v1.6.1

func WithUserAgent(userAgent string) CustomSDKOption

type DeviceCodeResponse added in v1.1.1

type DeviceCodeResponse struct {
	DeviceCode      string `json:"device_code"`
	UserCode        string `json:"user_code"`
	VerificationURI string `json:"verification_uri_complete"`
	ExpiresIn       int64  `json:"expires_in"`
	Interval        int64  `json:"interval"`
}

type Directory added in v1.15.0

type Directory struct {
	// contains filtered or unexported fields
}

func (*Directory) Create added in v1.15.0

Create Create a directory.

func (*Directory) Delete added in v1.15.0

Delete Delete a directory by app_id.

func (*Directory) Get added in v1.15.0

Get Get a directory by app_id.

func (*Directory) List added in v1.15.0

List List directories.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient provides an interface for suplying the SDK with a custom HTTP client

type PersonalClient added in v1.15.0

type PersonalClient struct {
	// contains filtered or unexported fields
}

func (*PersonalClient) Create added in v1.15.0

Create Create creates a new PersonalClient object for the current User.

type Policies added in v1.15.0

type Policies struct {
	// contains filtered or unexported fields
}

func (*Policies) Create added in v1.15.0

Create Create a policy.

func (*Policies) Delete added in v1.15.0

Delete Delete a policy by ID.

func (*Policies) Get added in v1.15.0

Get Get a policy by ID.

func (*Policies) List added in v1.15.0

List List policies.

func (*Policies) Update added in v1.15.0

Update Update a policy by providing a policy object and an update mask.

type PolicySearch added in v1.15.0

type PolicySearch struct {
	// contains filtered or unexported fields
}

func (*PolicySearch) Search added in v1.15.0

Search Search policies based on filters specified in the request body.

type PolicyValidate added in v1.15.0

type PolicyValidate struct {
	// contains filtered or unexported fields
}

func (*PolicyValidate) ValidateCEL added in v1.15.0

ValidateCEL - Validate Cel Validate policies

type RequestCatalogManagement added in v1.15.0

type RequestCatalogManagement struct {
	// contains filtered or unexported fields
}

func (*RequestCatalogManagement) AddAccessEntitlements added in v1.15.0

AddAccessEntitlements - Add Access Entitlements Add visibility bindings (access entitlements) to a catalog.

func (*RequestCatalogManagement) AddAppEntitlements added in v1.15.0

AddAppEntitlements - Add App Entitlements Add requestable entitlements to a catalog.

func (*RequestCatalogManagement) Create added in v1.15.0

Create Creates a new request catalog.

func (*RequestCatalogManagement) List added in v1.15.0

List Get a list of request catalogs.

func (*RequestCatalogManagement) ListEntitlementsForAccess added in v1.15.0

ListEntitlementsForAccess - List Entitlements For Access List visibility bindings (access entitlements) for a catalog.

func (*RequestCatalogManagement) ListEntitlementsPerCatalog added in v1.15.0

ListEntitlementsPerCatalog - List Entitlements Per Catalog List entitlements in a catalog that are requestable.

func (*RequestCatalogManagement) RemoveAccessEntitlements added in v1.15.0

RemoveAccessEntitlements - Remove Access Entitlements Remove visibility bindings (access entitlements) to a catalog.

func (*RequestCatalogManagement) RemoveAppEntitlements added in v1.15.0

RemoveAppEntitlements - Remove App Entitlements Remove requestable entitlements from a catalog.

type RequestCatalogSearch added in v1.15.0

type RequestCatalogSearch struct {
	// contains filtered or unexported fields
}

func (*RequestCatalogSearch) SearchEntitlements added in v1.15.0

SearchEntitlements - Search Entitlements Search request catalogs based on filters specified in the request body.

type Roles added in v1.15.0

type Roles struct {
	// contains filtered or unexported fields
}

func (*Roles) Get added in v1.15.0

Get Get a role by id.

func (*Roles) List added in v1.15.0

List List all roles for the current user.

func (*Roles) Update added in v1.15.0

Update Update a role by passing a Role object.

type SDKOption

type SDKOption func(*ConductoroneAPI)

func WithClient

func WithClient(client HTTPClient) SDKOption

WithClient allows the overriding of the default HTTP client used by the SDK

func WithRetryConfig added in v1.8.0

func WithRetryConfig(retryConfig utils.RetryConfig) SDKOption

func WithSecurity added in v1.7.0

func WithSecurity(security shared.Security) SDKOption

WithSecurity configures the SDK to use the provided security details

func WithSecuritySource added in v1.11.2

func WithSecuritySource(security func(context.Context) (shared.Security, error)) SDKOption

WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication

func WithServerIndex

func WithServerIndex(serverIndex int) SDKOption

WithServerIndex allows the overriding of the default server by index

func WithServerURL

func WithServerURL(serverURL string) SDKOption

WithServerURL allows the overriding of the default server URL

func WithTemplatedServerURL

func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOption

WithTemplatedServerURL allows the overriding of the default server URL with a templated URL populated with the provided parameters

func WithTenant added in v1.1.1

func WithTenant(input string) (SDKOption, error)

func WithTenantDomain

func WithTenantDomain(tenantDomain string) SDKOption

WithTenantDomain allows setting the tenantDomain variable for url substitution

type SessionSettings added in v1.16.0

type SessionSettings struct {
	// contains filtered or unexported fields
}

func (*SessionSettings) Get added in v1.16.0

Get Invokes the c1.api.settings.v1.SessionSettingsService.Get method.

func (*SessionSettings) Update added in v1.16.0

Update Invokes the c1.api.settings.v1.SessionSettingsService.Update method.

type Task added in v1.15.0

type Task struct {
	// contains filtered or unexported fields
}

func (*Task) CreateGrantTask added in v1.15.0

CreateGrantTask - Create Grant Task Create a grant task

func (*Task) CreateRevokeTask added in v1.15.0

CreateRevokeTask - Create Revoke Task Create a revoke task

func (*Task) Get added in v1.15.0

Get Get a task by ID

type TaskActions added in v1.15.0

type TaskActions struct {
	// contains filtered or unexported fields
}

func (*TaskActions) Approve added in v1.15.0

Approve Invokes the c1.api.task.v1.TaskActionsService.Approve method.

func (*TaskActions) Comment added in v1.15.0

Comment Invokes the c1.api.task.v1.TaskActionsService.Comment method.

func (*TaskActions) Deny added in v1.15.0

Deny Invokes the c1.api.task.v1.TaskActionsService.Deny method.

func (*TaskActions) EscalateToEmergencyAccess added in v1.15.0

EscalateToEmergencyAccess - Escalate To Emergency Access Invokes the c1.api.task.v1.TaskActionsService.EscalateToEmergencyAccess method.

func (*TaskActions) Restart added in v1.15.0

Restart Invokes the c1.api.task.v1.TaskActionsService.Restart method.

type TaskSearch added in v1.15.0

type TaskSearch struct {
	// contains filtered or unexported fields
}

func (*TaskSearch) Search added in v1.15.0

Search Search tasks based on filters specified in the request body.

type User added in v1.15.0

type User struct {
	// contains filtered or unexported fields
}

func (*User) Get added in v1.15.0

Get Get a user by ID.

func (*User) List added in v1.15.0

List List users.

type UserSearch added in v1.15.0

type UserSearch struct {
	// contains filtered or unexported fields
}

func (*UserSearch) Search added in v1.15.0

Search Search users based on filters specified in the request body.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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