apiClient

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2020 License: MPL-2.0 Imports: 23 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 BuildHttpErrorMessage added in v1.5.0

func BuildHttpErrorMessage(err error) error

func CredentialsSet

func CredentialsSet(credentials ClientCredentials) bool

func FailedValidationError

func FailedValidationError(err error) bool

func NotFoundError

func NotFoundError(err error) 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 added in v1.2.0

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) CreateGoogleDirectoryLegacy added in v1.2.0

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

legacy create/update functions

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) 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 added in v1.2.0

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) 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) 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 added in v1.2.0

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 added in v1.6.0

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

func (*Client) ReadFolder

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

func (*Client) ReadFullResource added in v1.4.0

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) 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 added in v1.2.0

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) UpdateGoogleDirectoryLegacy added in v1.2.0

func (client *Client) UpdateGoogleDirectoryLegacy(input map[string]interface{}) (*TurbotResourceMetadata, 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 added in v1.2.0

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 added in v1.6.0

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
	HostedName        string
}

type Grant

type Grant struct {
	Turbot            TurbotGrantMetadata
	PermissionTypeId  string
	PermissionLevelId string
}

type InstallModData

type InstallModData struct {
	Build  string
	Turbot TurbotResourceMetadata
}

type InstallModResponse

type InstallModResponse struct {
	Mod InstallModData
}

Mod

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
	DirectoryPoolId string
	ProfileId       string
}

type ProfileResponse

type ProfileResponse struct {
	Resource Profile
}

Profile

type ReadActiveGrantResponse

type ReadActiveGrantResponse struct {
	ActiveGrant ActiveGrant
}

type ReadControlResponse added in v1.6.0

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 {
	ResourceList 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{}
		Turbot map[string]interface{}
		Tags   map[string]string
		Akas   []string
	}
}

type Resource

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

type ResourceResponse added in v1.2.0

type ResourceResponse struct {
	Resource Resource
}

type ResourceSchema added in v1.2.0

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 added in v1.2.0

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

Turbot directory

type TurbotDirectoryResponse added in v1.2.0

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