ucpclient

package
v18.10.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const LegacyUCPRoleCreateJSONTemplateFullPermissions = `` /* 13614-byte string literal not displayed */

LegacyUCPRoleCreateJSONTemplateFullPermissions is the YAML required to create a new UCP Role with full control

View Source
const LegacyUCPRoleCreateJSONTemplateMinimalPermissions = `` /* 1766-byte string literal not displayed */

LegacyUCPRoleCreateJSONTemplateMinimalPermissions is the YAML required to create a new UCP Role for Trident's usecase

View Source
const UCPRoleCreateJSONTemplateFullPermissions = `` /* 49639-byte string literal not displayed */

UCPRoleCreateJSONTemplateFullPermissions is the YAML required to create a new UCP Role with full control

View Source
const UCPRoleCreateJSONTemplateMinimalPermissions = `` /* 3508-byte string literal not displayed */

UCPRoleCreateJSONTemplateMinimalPermissions is the YAML required to create a new UCP Role for Trident's usecase

Variables

This section is empty.

Functions

func GetUCPRoleCreateJSON

func GetUCPRoleCreateJSON(serverVersion, roleName string) string

GetUCPRoleCreateJSON returns the YAML neccessary to create a new UCP Role for Trident's usecase

Types

type Interface

type Interface interface {
	GetRoleIDForServiceAccount(serviceAccount string) (string, error)
	GetRolesForRoleID(roleID string) (*UCPRole, error)
	GetRoles() ([]UCPRole, error)
	GetRolesForServiceAccount(serviceAccount string) (*UCPRole, error)
	FindRoleByName(ucpRoleName string) (*UCPRole, error)
	DeleteRoleByName(ucpRoleName string) (bool, error)
	CreateTridentRole() (bool, error)
	DeleteTridentRole() (bool, error)
	AddTridentRoleToServiceAccount(TridentPodNamespace string) (bool, error)
	RemoveTridentRoleFromServiceAccount(TridentPodNamespace string) (bool, error)
}

type RestClient

type RestClient struct {
	BearerToken string
	Host        string
	Secure      bool
	Port        int
}

RestClient is a simple REST API client

func (*RestClient) Delete

func (o *RestClient) Delete(query string) ([]byte, error)

Delete performs an HTTP DELETE operation

func (*RestClient) Get

func (o *RestClient) Get(query string) ([]byte, error)

Get performs an HTTP GET operation

func (*RestClient) PostForm

func (o *RestClient) PostForm(query, jsonData string) ([]byte, error)

PostForm performs an HTTP POST of 'application/x-www-form-urlencoded' data

func (*RestClient) Put

func (o *RestClient) Put(query string) ([]byte, error)

Put performs an HTTP PUT operation

type UCP

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

UCP is an object for interacting with Docker's UCP API

func NewClient

func NewClient(ucpHost, bearerToken string) (*UCP, error)

NewClient factory method to create a new client object for use against a UCP server

func (*UCP) AddTridentRoleToServiceAccount

func (o *UCP) AddTridentRoleToServiceAccount(TridentPodNamespace string) (bool, error)

AddTridentRoleToServiceAccount adds the role to the account

func (*UCP) CreateTridentRole

func (o *UCP) CreateTridentRole() (bool, error)

CreateTridentRole creates Trident's UCP role

func (*UCP) DeleteRoleByName

func (o *UCP) DeleteRoleByName(ucpRoleName string) (bool, error)

DeleteRoleByName looks up the UCP Role object by name and deletes it

func (*UCP) DeleteTridentRole

func (o *UCP) DeleteTridentRole() (bool, error)

DeleteTridentRole delete Trident's UCP role

func (*UCP) FindRoleByName

func (o *UCP) FindRoleByName(ucpRoleName string) (*UCPRole, error)

FindRoleByName looks up the UCP Role object by name

func (*UCP) GetInfo

func (o *UCP) GetInfo() (*UCPInfo, error)

GetInfo returns information about the UCP system

func (*UCP) GetRoleIDForServiceAccount

func (o *UCP) GetRoleIDForServiceAccount(serviceAccount string) (string, error)

GetRoleIDForServiceAccount returns the Role ID for the supplied service account

func (*UCP) GetRoles

func (o *UCP) GetRoles() ([]UCPRole, error)

GetRoles returns all the UCP roles

func (*UCP) GetRolesForRoleID

func (o *UCP) GetRolesForRoleID(roleID string) (*UCPRole, error)

GetRolesForRoleID returns all the Roles for the supplied Role ID

func (*UCP) GetRolesForServiceAccount

func (o *UCP) GetRolesForServiceAccount(serviceAccount string) (*UCPRole, error)

GetRolesForServiceAccount retrieves the UCP Roles for the supplied Kubernetes service account

func (*UCP) RemoveTridentRoleFromServiceAccount

func (o *UCP) RemoveTridentRoleFromServiceAccount(TridentPodNamespace string) (bool, error)

RemoveTridentRoleFromServiceAccount removes the role from the service account

type UCPCollectionGrants

type UCPCollectionGrants struct {
	Grants []struct {
		CollectionPath string `json:"collectionPath"`
		SubjectID      string `json:"subjectID"`
		ObjectID       string `json:"objectID"`
		RoleID         string `json:"roleID"`
	} `json:"grants"`
	Subjects []struct {
		ID          string `json:"id"`
		SubjectType string `json:"subject_type"`
	} `json:"subjects"`
}

UCPCollectionGrants holds the results from calls to "/collectionGrants"

type UCPInfo

type UCPInfo struct {
	ServerVersion string `json:"ServerVersion"`
}

UCPInfo holds the results from calls to "/info"

type UCPRole

type UCPRole struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	SystemRole bool   `json:"system_role"`
	Operations struct {
		Config struct {
			ConfigView []interface{} `json:"Config View"`
		} `json:"Config"`
		Container struct {
			ContainerLogs  []interface{} `json:"Container Logs"`
			ContainerStats []interface{} `json:"Container Stats"`
			ContainerTop   []interface{} `json:"Container Top"`
			ContainerView  []interface{} `json:"Container View"`
		} `json:"Container"`
		Image struct {
			ImageHistory []interface{} `json:"Image History"`
			ImageView    []interface{} `json:"Image View"`
		} `json:"Image"`
		KubernetesCertificateSigningRequest struct {
			CertificateSigningRequestGet   []interface{} `json:"CertificateSigningRequest Get"`
			CertificateSigningRequestList  []interface{} `json:"CertificateSigningRequest List"`
			CertificateSigningRequestWatch []interface{} `json:"CertificateSigningRequest Watch"`
		} `json:"Kubernetes Certificate Signing Request"`
		KubernetesClusterRole struct {
			ClusterRoleGet   []interface{} `json:"ClusterRole Get"`
			ClusterRoleList  []interface{} `json:"ClusterRole List"`
			ClusterRoleWatch []interface{} `json:"ClusterRole Watch"`
		} `json:"Kubernetes Cluster Role"`
		KubernetesClusterRoleBinding struct {
			ClusterRoleBindingGet   []interface{} `json:"ClusterRoleBinding Get"`
			ClusterRoleBindingList  []interface{} `json:"ClusterRoleBinding List"`
			ClusterRoleBindingWatch []interface{} `json:"ClusterRoleBinding Watch"`
		} `json:"Kubernetes Cluster Role Binding"`
		KubernetesComponentStatus struct {
			ComponentStatusGet   []interface{} `json:"ComponentStatus Get"`
			ComponentStatusList  []interface{} `json:"ComponentStatus List"`
			ComponentStatusWatch []interface{} `json:"ComponentStatus Watch"`
		} `json:"Kubernetes Component Status"`
		KubernetesConfigMap struct {
			ConfigMapGet   []interface{} `json:"ConfigMap Get"`
			ConfigMapList  []interface{} `json:"ConfigMap List"`
			ConfigMapWatch []interface{} `json:"ConfigMap Watch"`
		} `json:"Kubernetes Config Map"`
		KubernetesControllerRevision struct {
			ControllerRevisionGet   []interface{} `json:"ControllerRevision Get"`
			ControllerRevisionList  []interface{} `json:"ControllerRevision List"`
			ControllerRevisionWatch []interface{} `json:"ControllerRevision Watch"`
		} `json:"Kubernetes Controller Revision"`
		KubernetesCronJob struct {
			CronJobGet   []interface{} `json:"CronJob Get"`
			CronJobList  []interface{} `json:"CronJob List"`
			CronJobWatch []interface{} `json:"CronJob Watch"`
		} `json:"Kubernetes Cron Job"`
		KubernetesCustomResourceDefinition struct {
			CustomResourceDefinitionGet   []interface{} `json:"CustomResourceDefinition Get"`
			CustomResourceDefinitionList  []interface{} `json:"CustomResourceDefinition List"`
			CustomResourceDefinitionWatch []interface{} `json:"CustomResourceDefinition Watch"`
		} `json:"Kubernetes Custom Resource Definition"`
		KubernetesDaemonset struct {
			DaemonsetGet   []interface{} `json:"Daemonset Get"`
			DaemonsetList  []interface{} `json:"Daemonset List"`
			DaemonsetWatch []interface{} `json:"Daemonset Watch"`
		} `json:"Kubernetes Daemonset"`
		KubernetesDeployment struct {
			DeploymentGet   []interface{} `json:"Deployment Get"`
			DeploymentList  []interface{} `json:"Deployment List"`
			DeploymentWatch []interface{} `json:"Deployment Watch"`
		} `json:"Kubernetes Deployment"`
		KubernetesEndpoint struct {
			EndpointGet   []interface{} `json:"Endpoint Get"`
			EndpointList  []interface{} `json:"Endpoint List"`
			EndpointWatch []interface{} `json:"Endpoint Watch"`
		} `json:"Kubernetes Endpoint"`
		KubernetesEvent struct {
			EventGet   []interface{} `json:"Event Get"`
			EventList  []interface{} `json:"Event List"`
			EventWatch []interface{} `json:"Event Watch"`
		} `json:"Kubernetes Event"`
		KubernetesExternalAdmissionHookConfiguration struct {
			ExternalAdmissionHookConfigurationGet   []interface{} `json:"ExternalAdmissionHookConfiguration Get"`
			ExternalAdmissionHookConfigurationList  []interface{} `json:"ExternalAdmissionHookConfiguration List"`
			ExternalAdmissionHookConfigurationWatch []interface{} `json:"ExternalAdmissionHookConfiguration Watch"`
		} `json:"Kubernetes External Admission Hook Configuration"`
		KubernetesHorizontalPodAutoscaler struct {
			HorizontalPodAutoscalerGet   []interface{} `json:"HorizontalPodAutoscaler Get"`
			HorizontalPodAutoscalerList  []interface{} `json:"HorizontalPodAutoscaler List"`
			HorizontalPodAutoscalerWatch []interface{} `json:"HorizontalPodAutoscaler Watch"`
		} `json:"Kubernetes Horizontal Pod Autoscaler"`
		KubernetesIngress struct {
			IngressGet   []interface{} `json:"Ingress Get"`
			IngressList  []interface{} `json:"Ingress List"`
			IngressWatch []interface{} `json:"Ingress Watch"`
		} `json:"Kubernetes Ingress"`
		KubernetesInitializerConfiguration struct {
			InitializerConfigurationGet   []interface{} `json:"InitializerConfiguration Get"`
			InitializerConfigurationList  []interface{} `json:"InitializerConfiguration List"`
			InitializerConfigurationWatch []interface{} `json:"InitializerConfiguration Watch"`
		} `json:"Kubernetes Initializer Configuration"`
		KubernetesJob struct {
			JobGet   []interface{} `json:"Job Get"`
			JobList  []interface{} `json:"Job List"`
			JobWatch []interface{} `json:"Job Watch"`
		} `json:"Kubernetes Job"`
		KubernetesLimitRange struct {
			LimitRangeGet   []interface{} `json:"LimitRange Get"`
			LimitRangeList  []interface{} `json:"LimitRange List"`
			LimitRangeWatch []interface{} `json:"LimitRange Watch"`
		} `json:"Kubernetes Limit Range"`
		KubernetesNamespace struct {
			NamespaceGet   []interface{} `json:"Namespace Get"`
			NamespaceList  []interface{} `json:"Namespace List"`
			NamespaceWatch []interface{} `json:"Namespace Watch"`
		} `json:"Kubernetes Namespace"`
		KubernetesNetworkPolicy struct {
			NetworkPolicyGet   []interface{} `json:"NetworkPolicy Get"`
			NetworkPolicyList  []interface{} `json:"NetworkPolicy List"`
			NetworkPolicyWatch []interface{} `json:"NetworkPolicy Watch"`
		} `json:"Kubernetes Network Policy"`
		KubernetesNode struct {
			NodeGet   []interface{} `json:"Node Get"`
			NodeList  []interface{} `json:"Node List"`
			NodeWatch []interface{} `json:"Node Watch"`
		} `json:"Kubernetes Node"`
		KubernetesPersistentVolume struct {
			PersistentVolumeGet   []interface{} `json:"PersistentVolume Get"`
			PersistentVolumeList  []interface{} `json:"PersistentVolume List"`
			PersistentVolumeWatch []interface{} `json:"PersistentVolume Watch"`
		} `json:"Kubernetes Persistent Volume"`
		KubernetesPersistentVolumeClaim struct {
			PersistentVolumeClaimGet   []interface{} `json:"PersistentVolumeClaim Get"`
			PersistentVolumeClaimList  []interface{} `json:"PersistentVolumeClaim List"`
			PersistentVolumeClaimWatch []interface{} `json:"PersistentVolumeClaim Watch"`
		} `json:"Kubernetes Persistent Volume Claim"`
		KubernetesPod struct {
			PodGet   []interface{} `json:"Pod Get"`
			PodList  []interface{} `json:"Pod List"`
			PodWatch []interface{} `json:"Pod Watch"`
		} `json:"Kubernetes Pod"`
		KubernetesPodDisruptionBudget struct {
			PodDisruptionBudgetGet   []interface{} `json:"PodDisruptionBudget Get"`
			PodDisruptionBudgetList  []interface{} `json:"PodDisruptionBudget List"`
			PodDisruptionBudgetWatch []interface{} `json:"PodDisruptionBudget Watch"`
		} `json:"Kubernetes Pod Disruption Budget"`
		KubernetesPodPreset struct {
			PodPresetGet   []interface{} `json:"PodPreset Get"`
			PodPresetList  []interface{} `json:"PodPreset List"`
			PodPresetWatch []interface{} `json:"PodPreset Watch"`
		} `json:"Kubernetes Pod Preset"`
		KubernetesPodSecurityPolicy struct {
			PodSecurityPolicyGet   []interface{} `json:"PodSecurityPolicy Get"`
			PodSecurityPolicyList  []interface{} `json:"PodSecurityPolicy List"`
			PodSecurityPolicyWatch []interface{} `json:"PodSecurityPolicy Watch"`
		} `json:"Kubernetes Pod Security Policy"`
		KubernetesPodTemplate struct {
			PodTemplateGet   []interface{} `json:"PodTemplate Get"`
			PodTemplateList  []interface{} `json:"PodTemplate List"`
			PodTemplateWatch []interface{} `json:"PodTemplate Watch"`
		} `json:"Kubernetes Pod Template"`
		KubernetesReplicaSet struct {
			ReplicaSetGet   []interface{} `json:"ReplicaSet Get"`
			ReplicaSetList  []interface{} `json:"ReplicaSet List"`
			ReplicaSetWatch []interface{} `json:"ReplicaSet Watch"`
		} `json:"Kubernetes Replica Set"`
		KubernetesReplicationController struct {
			ReplicationControllerGet   []interface{} `json:"ReplicationController Get"`
			ReplicationControllerList  []interface{} `json:"ReplicationController List"`
			ReplicationControllerWatch []interface{} `json:"ReplicationController Watch"`
		} `json:"Kubernetes Replication Controller"`
		KubernetesResourceQuota struct {
			ResourceQuotaGet   []interface{} `json:"ResourceQuota Get"`
			ResourceQuotaList  []interface{} `json:"ResourceQuota List"`
			ResourceQuotaWatch []interface{} `json:"ResourceQuota Watch"`
		} `json:"Kubernetes Resource Quota"`
		KubernetesRole struct {
			RoleGet   []interface{} `json:"Role Get"`
			RoleList  []interface{} `json:"Role List"`
			RoleWatch []interface{} `json:"Role Watch"`
		} `json:"Kubernetes Role"`
		KubernetesRoleBinding struct {
			RoleBindingGet   []interface{} `json:"RoleBinding Get"`
			RoleBindingList  []interface{} `json:"RoleBinding List"`
			RoleBindingWatch []interface{} `json:"RoleBinding Watch"`
		} `json:"Kubernetes Role Binding"`
		KubernetesSecret struct {
			SecretGet   []interface{} `json:"Secret Get"`
			SecretList  []interface{} `json:"Secret List"`
			SecretWatch []interface{} `json:"Secret Watch"`
		} `json:"Kubernetes Secret"`
		KubernetesService struct {
			ServiceGet   []interface{} `json:"Service Get"`
			ServiceList  []interface{} `json:"Service List"`
			ServiceWatch []interface{} `json:"Service Watch"`
		} `json:"Kubernetes Service"`
		KubernetesServiceAccount struct {
			ServiceAccountGet   []interface{} `json:"ServiceAccount Get"`
			ServiceAccountList  []interface{} `json:"ServiceAccount List"`
			ServiceAccountWatch []interface{} `json:"ServiceAccount Watch"`
		} `json:"Kubernetes Service Account"`
		KubernetesStack struct {
			StackGet   []interface{} `json:"Stack Get"`
			StackList  []interface{} `json:"Stack List"`
			StackWatch []interface{} `json:"Stack Watch"`
		} `json:"Kubernetes Stack"`
		KubernetesStatefulSet struct {
			StatefulSetGet   []interface{} `json:"StatefulSet Get"`
			StatefulSetList  []interface{} `json:"StatefulSet List"`
			StatefulSetWatch []interface{} `json:"StatefulSet Watch"`
		} `json:"Kubernetes Stateful Set"`
		KubernetesStorageClass struct {
			StorageClassGet   []interface{} `json:"StorageClass Get"`
			StorageClassList  []interface{} `json:"StorageClass List"`
			StorageClassWatch []interface{} `json:"StorageClass Watch"`
		} `json:"Kubernetes Storage Class"`
		KubernetesThirdPartyResource struct {
			ThirdPartyResourceGet   []interface{} `json:"ThirdPartyResource Get"`
			ThirdPartyResourceList  []interface{} `json:"ThirdPartyResource List"`
			ThirdPartyResourceWatch []interface{} `json:"ThirdPartyResource Watch"`
		} `json:"Kubernetes Third Party Resource"`
		KubernetesUser struct {
			UserGet   []interface{} `json:"User Get"`
			UserList  []interface{} `json:"User List"`
			UserWatch []interface{} `json:"User Watch"`
		} `json:"Kubernetes User"`
		Network struct {
			NetworkView []interface{} `json:"Network View"`
		} `json:"Network"`
		Node struct {
			NodeView []interface{} `json:"Node View"`
		} `json:"Node"`
		Secret struct {
			SecretView []interface{} `json:"Secret View"`
		} `json:"Secret"`
		Service struct {
			ServiceLogs      []interface{} `json:"Service Logs"`
			ServiceView      []interface{} `json:"Service View"`
			ServiceViewTasks []interface{} `json:"Service View Tasks"`
		} `json:"Service"`
		Volume struct {
			VolumeView []interface{} `json:"Volume View"`
		} `json:"Volume"`
	} `json:"operations"`
}

UCPRole holds the results from calls to "/roles"

Jump to

Keyboard shortcuts

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