apiClient

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildApiUrl

func BuildApiUrl(rawWorkspace string) (string, error)

convert workspace into a fully formed api url

func CredentialsSet

func CredentialsSet(credentials ClientCredentials) bool

func ParseModUri

func ParseModUri(uri string) (org, mod string)

Types

type ActivateGrantResponse

type ActivateGrantResponse struct {
	GrantActivate struct {
		Turbot TurbotActiveGrantMetadata
	}
}

Active Grant

type ActiveGrant

type ActiveGrant struct {
	Turbot TurbotActiveGrantMetadata
}

type ApiResponse

type ApiResponse struct {
	Errors []Error
}

ApiResponse used to unmarshall API error responses

type Client

type Client struct {
	AccessKey string
	SecretKey string
	Graphql   *graphql.Client
}

Turbot API Client

func CreateClient

func CreateClient(config ClientConfig) (*Client, error)

func (*Client) AssignResourceResults

func (client *Client) AssignResourceResults(responseData interface{}, properties map[string]string) (*Resource, error)

assign the ReadResource results into a Resource object, based on the 'properties' map

func (*Client) BuildPropertiesFromUpdateSchema

func (client *Client) BuildPropertiesFromUpdateSchema(resourceId string, properties []interface{}) ([]interface{}, error)

func (*Client) CreateFolder

func (client *Client) CreateFolder(input map[string]interface{}) (*Folder, error)

func (*Client) CreateGoogleDirectory

func (client *Client) CreateGoogleDirectory(input map[string]interface{}) (*TurbotResourceMetadata, error)

func (*Client) CreateGrant

func (client *Client) CreateGrant(input map[string]interface{}) (*TurbotGrantMetadata, error)

func (*Client) CreateGrantActivation

func (client *Client) CreateGrantActivation(input map[string]interface{}) (*TurbotActiveGrantMetadata, error)

func (*Client) CreateGroupProfile

func (client *Client) CreateGroupProfile(input map[string]interface{}) (*GroupProfile, error)

func (*Client) CreateLdapDirectory

func (client *Client) CreateLdapDirectory(input map[string]interface{}) (*LdapDirectory, error)

func (*Client) CreateLocalDirectory

func (client *Client) CreateLocalDirectory(input map[string]interface{}) (*LocalDirectory, error)

func (*Client) CreateLocalDirectoryUser

func (client *Client) CreateLocalDirectoryUser(input map[string]interface{}) (*LocalDirectoryUser, error)

func (*Client) CreatePolicySetting

func (client *Client) CreatePolicySetting(input map[string]interface{}) (*PolicySetting, error)

func (*Client) CreateProfile

func (client *Client) CreateProfile(input map[string]interface{}) (*Profile, error)

func (*Client) CreateResource

func (client *Client) CreateResource(input map[string]interface{}) (*TurbotResourceMetadata, error)

func (*Client) CreateSamlDirectory

func (client *Client) CreateSamlDirectory(input map[string]interface{}) (*SamlDirectory, error)

func (*Client) CreateSmartFolder

func (client *Client) CreateSmartFolder(input map[string]interface{}) (*SmartFolder, error)

func (*Client) CreateSmartFolderAttachment

func (client *Client) CreateSmartFolderAttachment(input map[string]interface{}) (*TurbotResourceMetadata, error)

func (*Client) CreateTurbotDirectory

func (client *Client) CreateTurbotDirectory(input map[string]interface{}) (*TurbotDirectory, error)

func (*Client) DeleteGrant

func (client *Client) DeleteGrant(id string) error

func (*Client) DeleteGrantActivation

func (client *Client) DeleteGrantActivation(id string) error

func (*Client) DeleteGroupProfile

func (client *Client) DeleteGroupProfile(aka string) error

func (*Client) DeleteLdapDirectory

func (client *Client) DeleteLdapDirectory(aka string) error

func (*Client) DeletePolicySetting

func (client *Client) DeletePolicySetting(id string) error

func (*Client) DeleteResource

func (client *Client) DeleteResource(aka string) error

func (*Client) DeleteSmartFolderAttachment

func (client *Client) DeleteSmartFolderAttachment(input map[string]interface{}) error

func (*Client) DoRequest

func (client *Client) DoRequest(query string, vars map[string]interface{}, responseData interface{}) error

execute graphql request

func (*Client) FindPolicySetting

func (client *Client) FindPolicySetting(policyTypeUri, resourceAka string) (PolicySetting, error)

func (*Client) GetModVersions

func (client *Client) GetModVersions(org, mod string) ([]ModRegistryVersion, error)

func (*Client) GetResourceAkas

func (client *Client) GetResourceAkas(resourceAka string) ([]string, error)

func (*Client) GetTurbotWorkspaceVersion

func (client *Client) GetTurbotWorkspaceVersion() (*semver.Version, error)

get turbot workspace version

func (*Client) GrantActivationExists

func (client *Client) GrantActivationExists(id string) (bool, error)

func (*Client) GrantExists

func (client *Client) GrantExists(id string) (bool, error)

func (*Client) InstallMod

func (client *Client) InstallMod(input map[string]interface{}) (*InstallModData, error)

func (*Client) ReadControl

func (client *Client) ReadControl(args string) (*Control, error)

func (*Client) ReadFolder

func (client *Client) ReadFolder(id string) (*Folder, error)

func (*Client) ReadFullResource

func (client *Client) ReadFullResource(resourceAka string) (*Resource, error)

func (*Client) ReadGoogleDirectory

func (client *Client) ReadGoogleDirectory(id string) (*GoogleDirectory, error)

func (*Client) ReadGrant

func (client *Client) ReadGrant(id string) (*Grant, error)

func (*Client) ReadGrantActivation

func (client *Client) ReadGrantActivation(id string) (*ActiveGrant, error)

func (*Client) ReadGroupProfile

func (client *Client) ReadGroupProfile(id string) (*GroupProfile, error)

func (*Client) ReadLdapDirectory

func (client *Client) ReadLdapDirectory(id string) (*LdapDirectory, error)

func (*Client) ReadLocalDirectory

func (client *Client) ReadLocalDirectory(id string) (*LocalDirectory, error)

func (*Client) ReadLocalDirectoryUser

func (client *Client) ReadLocalDirectoryUser(id string) (*LocalDirectoryUser, error)

func (*Client) ReadMod

func (client *Client) ReadMod(id string) (*Mod, error)

func (*Client) ReadPolicySetting

func (client *Client) ReadPolicySetting(id string) (*PolicySetting, error)

func (*Client) ReadPolicyValue

func (client *Client) ReadPolicyValue(policyTypeUri, resourceAka string) (*PolicyValue, error)

func (*Client) ReadProfile

func (client *Client) ReadProfile(id string) (*Profile, error)

func (*Client) ReadResource

func (client *Client) ReadResource(resourceAka string, properties map[string]string) (*Resource, error)

properties is a map of terraform property name to turbot property path - it is used to add 'get' resolvers to the query

func (*Client) ReadResourceList

func (client *Client) ReadResourceList(filter string, properties map[string]string) ([]Resource, error)

func (*Client) ReadSamlDirectory

func (client *Client) ReadSamlDirectory(id string) (*SamlDirectory, error)

func (*Client) ReadSerializableResource

func (client *Client) ReadSerializableResource(resourceAka string) (*SerializableResource, error)

read a resource including all properties, then convert into a 'serializable' resource, consisting of simple types and string maps

func (*Client) ReadSmartFolder

func (client *Client) ReadSmartFolder(id string) (*SmartFolder, error)

func (*Client) ReadTurbotDirectory

func (client *Client) ReadTurbotDirectory(id string) (*TurbotDirectory, error)

func (*Client) ResourceExists

func (client *Client) ResourceExists(id string) (bool, error)

func (*Client) UninstallMod

func (client *Client) UninstallMod(modId string) error

func (*Client) UpdateFolder

func (client *Client) UpdateFolder(input map[string]interface{}) (*Folder, error)

func (*Client) UpdateGoogleDirectory

func (client *Client) UpdateGoogleDirectory(input map[string]interface{}) (*TurbotResourceMetadata, error)

func (*Client) UpdateGroupProfile

func (client *Client) UpdateGroupProfile(input map[string]interface{}) (*GroupProfile, error)

func (*Client) UpdateLdapDirectory

func (client *Client) UpdateLdapDirectory(input map[string]interface{}) (*LdapDirectory, error)

func (*Client) UpdateLocalDirectory

func (client *Client) UpdateLocalDirectory(input map[string]interface{}) (*LocalDirectory, error)

func (*Client) UpdateLocalDirectoryUserResource

func (client *Client) UpdateLocalDirectoryUserResource(input map[string]interface{}) (*LocalDirectoryUser, error)

func (*Client) UpdatePolicySetting

func (client *Client) UpdatePolicySetting(input map[string]interface{}) (*PolicySetting, error)

func (*Client) UpdateProfile

func (client *Client) UpdateProfile(input map[string]interface{}) (*Profile, error)

func (*Client) UpdateResource

func (client *Client) UpdateResource(input map[string]interface{}) (*TurbotResourceMetadata, error)

func (*Client) UpdateSamlDirectory

func (client *Client) UpdateSamlDirectory(input map[string]interface{}) (*SamlDirectory, error)

func (*Client) UpdateSmartFolder

func (client *Client) UpdateSmartFolder(input map[string]interface{}) (*SmartFolder, error)

func (*Client) UpdateTurbotDirectory

func (client *Client) UpdateTurbotDirectory(input map[string]interface{}) (*TurbotDirectory, error)

func (*Client) Validate

func (client *Client) Validate() error

Validate checks if the API workspace URL and credentials are valid.

type ClientConfig

type ClientConfig struct {
	Credentials     ClientCredentials
	CredentialsPath string
	Profile         string
}

type ClientCredentials

type ClientCredentials struct {
	AccessKey string `yaml:"accessKey"`
	SecretKey string `yaml:"secretKey"`
	Workspace string
}

func GetCredentials

func GetCredentials(config ClientConfig) (ClientCredentials, error)

type Control

type Control struct {
	State       string
	Reason      string
	Details     string
	ResourceId  string
	ResourceAka string
	Type        struct {
		Uri string
	}
	Turbot map[string]string
}

type CreateGrantResponse

type CreateGrantResponse struct {
	Grants struct {
		Turbot TurbotGrantMetadata
	}
}

Grant

type CreateResourceResponse

type CreateResourceResponse struct {
	Resource struct {
		Turbot TurbotResourceMetadata
	}
}

Resource

type CreateSmartFolderAttachResponse

type CreateSmartFolderAttachResponse struct {
	SmartFolderAttach struct {
		Turbot TurbotResourceMetadata
	}
}

type Error

type Error struct {
	Message string
}

type FindPolicySettingResponse

type FindPolicySettingResponse struct {
	PolicySettings struct {
		Items []PolicySetting
	}
}

type Folder

type Folder struct {
	Turbot      TurbotResourceMetadata
	Title       string
	Description string
	Parent      string
}

type FolderResponse

type FolderResponse struct {
	Resource Folder
}

Folder

type GoogleDirectory

type GoogleDirectory struct {
	Turbot            TurbotResourceMetadata
	Parent            string
	Title             string
	ProfileIdTemplate string
	Description       string
	Status            string
	DirectoryType     string
	ClientID          string
	ClientSecret      string
	PoolId            string
	GroupIdTemplate   string
	LoginNameTemplate string
	HostedDomain      string
}

type Grant

type Grant struct {
	Turbot            TurbotGrantMetadata
	PermissionTypeId  string
	PermissionLevelId string
}

type GroupProfile

type GroupProfile struct {
	Turbot         TurbotResourceMetadata
	Directory      string
	Title          string
	Status         string
	GroupProfileId string
}

Group profile

type GroupProfileResponse

type GroupProfileResponse struct {
	Resource GroupProfile
}

type InstallModData

type InstallModData struct {
	Build  string
	Turbot TurbotResourceMetadata
}

type InstallModResponse

type InstallModResponse struct {
	Mod InstallModData
}

Mod

type LdapDirectory

type LdapDirectory struct {
	Turbot                      TurbotResourceMetadata
	Title                       string
	Description                 string
	DirectoryType               string
	ProfileIdTemplate           string
	GroupProfileIdTemplate      string
	Url                         string
	Status                      string
	DistinguishedName           string
	Base                        string
	UserObjectFilter            string
	DisabledUserFilter          string
	UserMatchFilter             string
	UserSearchFilter            string
	UserSearchAttributes        string
	GroupObjectFilter           string
	GroupSearchFilter           string
	GroupSyncFilter             string
	UserCanonicalNameAttribute  string
	UserEmailAttribute          string
	UserDisplayNameAttribute    string
	UserGivenNameAttribute      string
	UserFamilyNameAttribute     string
	GroupCanonicalNameAttribute string
	TlsEnabled                  bool
	TlsServerCertificate        string
	GroupMemberOfAttribute      string
	GroupMembershipAttribute    string
	ConnectivityTestFilter      string
	RejectUnauthorized          bool
	DisabledGroupFilter         string
}

Ldap directory

type LdapDirectoryResponse

type LdapDirectoryResponse struct {
	Resource LdapDirectory
}

type LocalDirectory

type LocalDirectory struct {
	Turbot            TurbotResourceMetadata
	Title             string
	Description       string
	Parent            string
	Status            string
	DirectoryType     string
	ProfileIdTemplate string
}

type LocalDirectoryResponse

type LocalDirectoryResponse struct {
	Resource LocalDirectory
}

Local directory

type LocalDirectoryUser

type LocalDirectoryUser struct {
	Turbot      TurbotResourceMetadata
	Parent      string
	Title       string
	Email       string
	Status      string
	DisplayName string
	GivenName   string
	MiddleName  string
	FamilyName  string
	Picture     string
}

type LocalDirectoryUserResponse

type LocalDirectoryUserResponse struct {
	Resource LocalDirectoryUser
}

Local directory user

type Mod

type Mod struct {
	Org     string
	Mod     string
	Version string
	Parent  string
	Uri     string
}

type ModRegistryVersion

type ModRegistryVersion struct {
	Status  string
	Version string
}

type ModVersionResponse

type ModVersionResponse struct {
	Versions struct {
		Items []ModRegistryVersion
	}
}

type PolicySetting

type PolicySetting struct {
	Type struct {
		Uri string
	}
	Value              interface{}
	ValueSource        string
	Default            bool
	Precedence         string
	Template           string
	TemplateInput      interface{}
	Input              string
	Note               string
	ValidFromTimestamp string
	ValidToTimestamp   string
	Turbot             TurbotPolicyMetadata
}

type PolicySettingResponse

type PolicySettingResponse struct {
	PolicySetting PolicySetting
}

PolicySetting

type PolicyValue

type PolicyValue struct {
	Value      interface{}
	Precedence string
	State      string
	Reason     string
	Details    string
	Setting    PolicySetting
	Turbot     TurbotPolicyMetadata
}

type PolicyValueResponse

type PolicyValueResponse struct {
	PolicyValue PolicyValue
}

PolicyValue

type Profile

type Profile struct {
	Turbot             TurbotResourceMetadata
	Title              string
	Parent             string
	Status             string
	Email              string
	GivenName          string
	DisplayName        string
	FamilyName         string
	MiddleName         string
	DirectoryPoolId    string
	ProfileId          string
	Picture            string
	ExternalId         string
	LastLoginTimestamp string
}

type ProfileResponse

type ProfileResponse struct {
	Resource Profile
}

Profile

type ReadActiveGrantResponse

type ReadActiveGrantResponse struct {
	ActiveGrant ActiveGrant
}

type ReadControlResponse

type ReadControlResponse struct {
	Control Control
}

type ReadGoogleDirectoryResponse

type ReadGoogleDirectoryResponse struct {
	Directory GoogleDirectory
}

Google directory

type ReadGrantResponse

type ReadGrantResponse struct {
	Grant Grant
}

type ReadModResponse

type ReadModResponse struct {
	Mod Mod
}

type ReadResourceListResponse

type ReadResourceListResponse struct {
	Resources struct {
		Items []Resource
	}
}

type ReadResourceResponse

type ReadResourceResponse struct {
	Resource interface{}
}

note: the Resource property is just an interface{} - this is mapped manually into a Resource object, rather than unmarshalled. This is to allow for dynamic data types, while always having the Turbot property

type ReadSerializableResourceResponse

type ReadSerializableResourceResponse struct {
	Resource struct {
		Data   map[string]interface{}
		Object map[string]interface{}
		Turbot map[string]interface{}
		Tags   map[string]string
		Akas   []string
	}
}

type Resource

type Resource struct {
	Turbot   TurbotResourceMetadata
	Data     map[string]interface{}
	Object   map[string]interface{}
	Metadata map[string]interface{}
	Type     struct {
		Uri string
	}
}

type ResourceResponse

type ResourceResponse struct {
	Resource Resource
}

type ResourceSchema

type ResourceSchema struct {
	Resource struct {
		Turbot       TurbotResourceMetadata
		UpdateSchema interface{}
		CreateSchema interface{}
		Type         struct {
			Uri string
		}
	}
}

type SamlDirectory

type SamlDirectory struct {
	Turbot                 TurbotResourceMetadata
	Title                  string
	Description            string
	Parent                 string
	Status                 string
	DirectoryType          string
	ProfileIdTemplate      string
	EntryPoint             string
	Certificate            string
	Issuer                 string
	GroupIdTemplate        string
	NameIdFormat           string
	SignRequests           string
	SignaturePrivateKey    string
	SignatureAlgorithm     string
	PoolId                 string
	ProfileGroupsAttribute string
	AllowGroupSyncing      bool
	AllowIdpInitiatedSso   bool
	GroupFilter            string
}

type SamlDirectoryResponse

type SamlDirectoryResponse struct {
	Resource SamlDirectory
}

Saml directory

type SerializableResource

type SerializableResource struct {
	Data     string
	Metadata string
	Tags     map[string]string
	Akas     []string
	Turbot   map[string]string
}

type SmartFolder

type SmartFolder struct {
	Turbot            TurbotResourceMetadata
	Title             string
	Description       string
	Filters           []string
	Parent            string
	AttachedResources struct {
		Items []struct {
			Turbot TurbotResourceMetadata
		}
	}
}

type SmartFolderAttachment

type SmartFolderAttachment struct {
	Turbot      TurbotResourceMetadata
	Title       string
	Description string
	Filters     map[string]interface{}
	Parent      string
}

Smart folder attachment

type SmartFolderResponse

type SmartFolderResponse struct {
	SmartFolder SmartFolder
}

type TurbotActiveGrantMetadata

type TurbotActiveGrantMetadata struct {
	Id         string
	GrantId    string
	ResourceId string
}

type TurbotDirectory

type TurbotDirectory struct {
	Turbot            TurbotResourceMetadata
	Title             string
	Description       string
	ProfileIdTemplate string
	Status            string
	Server            string
}

Turbot directory

type TurbotDirectoryResponse

type TurbotDirectoryResponse struct {
	Resource TurbotDirectory
}

type TurbotGrantMetadata

type TurbotGrantMetadata struct {
	Id         string
	ProfileId  string
	ResourceId string
}

type TurbotPolicyMetadata

type TurbotPolicyMetadata struct {
	Id         string
	ParentId   string
	ResourceId string
	Akas       []string
}

type TurbotResourceMetadata

type TurbotResourceMetadata struct {
	Id                string
	ParentId          string
	Akas              []string
	Custom            map[string]interface{}
	Metadata          map[string]interface{}
	Tags              map[string]interface{}
	Title             string
	VersionId         string
	ActorIdentityId   string
	ActorPersonaId    string
	ActorRoleId       string
	ResourceParentAka string
	CreateTimestamp   string
	DeleteTimestamp   string
	UpdateTimestamp   string
	Path              string
	ResourceGroupIds  []string
	ResourceTypeId    string
	State             string
	Terraform         map[string]interface{}
}

Metadata

type UninstallModResponse

type UninstallModResponse struct {
	UninstallMod struct {
		Success bool
	}
}

type UpdateResourceResponse

type UpdateResourceResponse struct {
	Resource struct {
		Turbot TurbotResourceMetadata
	}
}

type ValidationResponse

type ValidationResponse struct {
	Schema struct {
		QueryType struct {
			Name string
		}
	}
}

Validation response

Jump to

Keyboard shortcuts

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