goxldeploy

package module
v0.0.0-...-3b58aee Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2017 License: MIT Imports: 10 Imported by: 0

README

goxldeploy

Package to interact with XL-Deploy

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Detail string
}

APIError defines the MailChimp API response error structure.

func (APIError) Error

func (e APIError) Error() string

Error method for APIError to satisfy the Error type interface

type Ci

type Ci struct {
	ID         string `json:"id"`
	Type       string `json:"type"`
	Properties map[string]interface{}

	//Always recieved .. Never sent
	Token          string `json:"$token,omitempty"`
	CreatedBy      string `json:"$createdBy,omitempty"`
	CreatedAt      string `json:"$createdAt,omitempty"`
	LastModifiedBy string `json:"$lastModifiedBy,omitempty"`
	LastModifiedAt string `json:"$lastModifiedAt,omitempty"`
}

Ci represents a configuration item in xldeploy CreatedBY, CreatedAt, LastModifiedBy, LastModifiedAt are only recieved, never sent

func FlatToCI

func FlatToCI(m map[string]interface{}) Ci

FlatToCI transforms a map[string]interface{} object into a proper CI type This is needed to properly display a ci and to communicate a ci back to xldeploy

func NewCI

func NewCI(i, t string, p map[string]interface{}) Ci

NewCI generates a new Ci object given a name a type and a properties map

func NewCIFromMap

func NewCIFromMap(m map[string]interface{}) Ci

NewCIFromMap takes a flat map of properties and turns it into a valic ci type that we can use

func (Ci) Flatten

func (c Ci) Flatten() map[string]interface{}

Flatten goes from a ci type to a flat map[string]interface this is needed when uploading a ci to xldeploy

type CiExistsAnswer

type CiExistsAnswer struct {
	Boolean bool `json:"boolean,omitempty"`
}

CIEXistsAnswer Type to catch the outcome of a ci exists query

type Cis

type Cis []Ci

Cis is a collections of Ci's Properties in xldeploy return JSON are handled as you would normally do .. they are in the json .. flat . As go does not do flat very well when it comes to json UnMarshalling we have to approche this a little different

type Client

type Client struct {

	// User agent
	UserAgent string

	// Client configuration
	Config *Config

	// Services
	Metadata   MetadataService
	Repository RepositoryService
	// contains filtered or unexported fields
}

A Client manages communication with XL-Deploy

func New

func New(config *Config) *Client

New just returns a NewClient

func NewClient

func NewClient(config *Config) *Client

NewClient returns a new functional client struct

func (*Client) Connected

func (c *Client) Connected() bool

Connected checks if the client is connected to XL-Deploy

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)

Do executes request and returns response

func (*Client) NewRequest

func (c *Client) NewRequest(urlStr string, method string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLS should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included in as the request body.

type ClientError

type ClientError struct {
	Detail string
}

func (ClientError) Error

func (e ClientError) Error() string

Error method for APIError to satisfy the Error type interface

type Config

type Config struct {
	User     string
	Password string
	Host     string
	Port     int
	Context  string
	Scheme   string
}

Config holds configuration for the client

type MetadataService

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

The MetaDataService interface definition

func (MetadataService) GetOrchestrators

func (m MetadataService) GetOrchestrators() (Orchestrators, error)

GetOrchestrators returns the entire list of metadata types in the xldeploy instance

func (MetadataService) GetPermissions

func (m MetadataService) GetPermissions() (Permissions, error)

GetPermissions returns the various that can be set withing xldeploy

func (MetadataService) GetType

func (m MetadataService) GetType(n string) (Type, error)

GetType returns a single metadata type specified by its name

func (MetadataService) GetTypeList

func (m MetadataService) GetTypeList() (TypeList, error)

GetTypeList returns the entire list of metadata types in the xldeploy instance

type Orchestrators

type Orchestrators []string

Orchestrators Struct to hold the list of orchestrators

type Permission

type Permission struct {
	Level          string `json:"level"`
	PermissionName string `json:"permissionName"`
	Root           string `json:"root,omitempty"`
}

Permission holds a single permission

type Permissions

type Permissions []Permission

Permissions struct for permissions

type Property

type Property struct {
	Name               string      `json:"name"`
	Fqn                string      `json:"fqn"`
	Label              string      `json:"label"`
	Kind               string      `json:"kind"`
	Description        string      `json:"description"`
	Category           string      `json:"category"`
	AsContainment      bool        `json:"asContainment"`
	Inspection         bool        `json:"inspection"`
	Required           bool        `json:"required"`
	RequiredInspection bool        `json:"requiredInspection"`
	Password           bool        `json:"password"`
	Transient          bool        `json:"transient"`
	Size               string      `json:"size"`
	ReferencedType     interface{} `json:"referencedType"`
	Default            interface{} `json:"default"`
}

Property struct for properties in types

type RepositoryService

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

RepositoryService is the Repository interface definition

func (RepositoryService) CIExists

func (r RepositoryService) CIExists(i string) (bool, error)

CIExists checks if a certain configuration item exists in the xldeploy repository

func (RepositoryService) CreateCI

func (r RepositoryService) CreateCI(c Ci) (Ci, error)

CreateCI creates a new ci in the xldeploy repository

func (RepositoryService) DeleteCI

func (r RepositoryService) DeleteCI(i string) (bool, error)

DeleteCI deletes a CI from xld

func (RepositoryService) GetCI

func (r RepositoryService) GetCI(i string) (Ci, error)

GetCi fetches a CI from xld

func (RepositoryService) UpdateCI

func (r RepositoryService) UpdateCI(c Ci) (Ci, error)

UpdateCI is here to update already existing ci's

type Type

type Type struct {
	Type        string     `json:"type"`
	Virtual     bool       `json:"virtual"`
	Icon        string     `json:"icon"`
	Description string     `json:"description"`
	Properties  []Property `json:"properties"`
	Interfaces  []string   `json:"interfaces"`
	SuperTypes  []string   `json:"superTypes"`
}

Type for types from metadata

type TypeList

type TypeList []Type

TypeList for a list of types

Jump to

Keyboard shortcuts

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