turboclient

package module
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

README

Turbonomic-Go-Client

Use this simple GoLang Library to access the Turbonomic API. It currently supports authentication by using a username and password.

Requirements

  • Go >= 1.23.7

Authenticating to the Turbonomic API

You can authenticate to the Turbonomic API by using either a username and password or oAuth 2.0.

Authenticating with a username and password

This library creates a client object by passing in a ClientParameters struct with the following parameters:

  • Hostname
  • Username
  • Password
  • ApiInfo

Create a client with these parameters, similar to the following example:

newClientOpts := ClientParameters{
    Hostname:   "TurboHostname",
    Username:   "TurboUsername",
    Password:   "TurboPassword",
    ApiInfo: ApiInfo{
        ApiOrigin: "your-app-name", // e.g., "terraform-provider"
        Version:   "version",         // version of your client or integration e.g : 1.0.0
    },
}

turboClient, err := NewClient(&newClientOpts)
if err != nil {
    panic(err)
}

You can then use this client to call other methods to interact with the Turbonomic API.

Authenticating with oAuth 2.0

In order to authenticate to Turbonomic's API using oAuth 2,0, you first need to create an oAuth client. Follow Creating and authenticating an OAuth 2.0 client to create the client. The output from this will be the following parameters:

  • clientId
  • clientSecret
  • role

Once you have the prerequisite parameters, you will want to create a OAuthCreds struct similar to the following example:

oauthCreds := OAuthCreds{
    ClientId:     clientId,
    ClientSecret: clientSecret,
    Role:         role,
}

Note: Valid roles are ADMINISTRATOR, SITE_ADMIN, AUTOMATOR, DEPLOYER, ADVISOR, OBSERVER, OPERATIONAL_OBSERVER, SHARED_ADVISOR, SHARED_OBSERVER, REPORT_EDITOR.

You then pass the OAuthCreds struct with the Hostname of your Turbonomic instance to a ClientParameters struct to create a Turbonomic client:

    newClientOpts := ClientParameters{
        Hostname:   TurboHost,
        OAuthCreds: oauthCreds,
        ApiInfo: ApiInfo{
            ApiOrigin: "your-app-name",
            Version:   "vesrion",
        },
    }

    if err != nil {
        panic(err)
    }

You can then use this client to call other methods to interact with the Turbonomic API.

Using a self-signed certificate

If your server has a self-signed certificate, you can skip SSL validation by also passing in the Skipverify parameter in the ClientParameters struct:

newClientOpts := ClientParameters{
    Hostname: "TurboHostname",
    Username: "TurboUsername",
    Password: "TurboPassword",
    Skipverify: true
    }

Searching for an entity by name

To search for an entity by name, pass a SearchRequest struct to the SearchEntityByName method:

    searchReq := SearchRequest{
        Name:            "VM_Test_1",
        EntityType:      "VirtualMachine",
        EnvironmentType: "ONPREM",
        CaseSensitive:   true,
    }

    entityName, err := c.SearchEntityByName(searchReq)

Retrieving an entity by UUID

To retrieve entity data based on its UUID, pass a EntityRequest struct to the GetEntity method:

    entityReq := EntityRequest{Uuid: "123456789"}

    entityName, err := c.GetEntity(entityReq)

Retrieving actions based on request parameters and entity UUID

To retrieve action data, pass an ActionsRequest struct to the GetActions method:

    actionReq := ActionsRequest{
        Uuid: "123456789",
        ActionState: []string{"READY", "ACCEPTED", "QUEUED", "IN_PROGRESS"},
        ActionType: []string{"RESIZE"},
    }

    actions, err := GetActionsByUUID(actionReq)

Logging

Additional logging can be enabled via the T8C_LOG environment variable. Valid values are:

  • INFO
  • DEBUG
  • WARN
  • ERROR

Note, the values are case insensitive.

Example
export T8C_LOG=debug

Documentation

Index

Constants

View Source
const (
	BasePathv3 = "/api/v3"
)

Default base path of Turbonomic API

Variables

View Source
var ActionTests = []TestAction{
	{},
	{},
}
View Source
var DoNotVerify bool = true
View Source
var EntityTests = []TestEntity{
	{},
	{},
	{},
}
View Source
var SearchTests = []TestSearch{

	{"terraform-demo-2", "VirtualMachine", "CLOUD", true, map[string]string{"query_type": "EXACT"}, []string{"76035434868567"}, "AWS", []string{}, ""},

	{"terraform-demo-1", "VirtualMachine", "CLOUD", true, map[string]string{}, []string{"76035434868600", "76068494507792"}, "AWS", []string{}, ""},

	{"terraform-demo-1", "VirtualMachine", "CLOUD", true, map[string]string{}, []string{}, "AWS", []string{"Windows"}, ""},

	{"terraform-demo-1", "VirtualMachine", "CLOUD", true, map[string]string{}, []string{"76035434868600", "76068494507792"}, "AWS", []string{"Linux"}, ""},

	{"terraformDemo1", "VirtualMachine", "CLOUD", true, map[string]string{}, []string{"76114164892153"}, "AZURE", []string{"Linux"}, ""},

	{"terraform-demo-instance-1", "VirtualMachine", "CLOUD", true, map[string]string{}, []string{"76104347422523"}, "GCP", []string{}, ""},

	{"terraform-demo-instance-1", "VirtualMachine", "CLOUD", true, map[string]string{}, []string{"76104347422523"}, "GCP", []string{""}, ""},

	{"terraform-demo-instance-1", "VirtualMachine", "", true, map[string]string{}, []string{"76104347422523"}, "GCP", []string{}, ""},

	{"terraform-demo-instance-1", "VirtualMachine", "", true, map[string]string{}, []string{"76104347422523"}, "GCP", []string{"Lin"}, ""},

	{"terraform-demo-instance-1", "VirtualMachine", "", true, map[string]string{}, []string{}, "GCP", []string{"Windows"}, ""},

	{"terraform-demo-instance-1", "VirtualMachine", "", true, map[string]string{}, []string{"76104347422523"}, "", []string{}, ""},

	{"terraform-demo-instance-1", "VirtualMachine", "", true, map[string]string{}, []string{}, "", []string{"Windows"}, ""},

	{"terraform-demo-instance-1", "VirtualMachine", "", true, map[string]string{}, []string{"76104347422523"}, "GCP", []string{"Linux", "Rhel"}, ""},

	{"", "VirtualMachine", "CLOUD", true, map[string]string{}, []string{"76035434868567"}, "", []string{}, "i-12345678"},
}
View Source
var StatsTests = []TestStats{
	{},
}
View Source
var TurboHost string = ""
View Source
var TurboPass string = ""
View Source
var TurboUser string = ""

Functions

This section is empty.

Types

type ActionResults

type ActionResults []struct {
	UUID                   string  `json:"uuid"`
	DisplayName            string  `json:"displayName"`
	ActionImpactID         int64   `json:"actionImpactID"`
	MarketID               int     `json:"marketID"`
	CreateTime             string  `json:"createTime"`
	ActionType             string  `json:"actionType"`
	ActionState            string  `json:"actionState"`
	ActionMode             string  `json:"actionMode"`
	ActionStateDescription string  `json:"actionStateDescription"`
	Details                string  `json:"details"`
	Importance             float32 `json:"importance"`
	Target                 struct {
		UUID            string `json:"uuid"`
		DisplayName     string `json:"displayName"`
		ClassName       string `json:"className"`
		EnvironmentType string `json:"environmentType"`
		DiscoveredBy    struct {
			UUID              string `json:"uuid"`
			DisplayName       string `json:"displayName"`
			Category          string `json:"category"`
			IsProbeRegistered bool   `json:"isProbeRegistered"`
			Type              string `json:"type"`
			Readonly          bool   `json:"readonly"`
		} `json:"discoveredBy"`
		VendorIds map[string]string   `json:"vendorIds"`
		State     string              `json:"state"`
		Aspects   json.RawMessage     `json:"aspects"`
		Tags      map[string][]string `json:"tags"`
	} `json:"target"`
	CurrentEntity struct {
		UUID            string `json:"uuid"`
		DisplayName     string `json:"displayName"`
		ClassName       string `json:"className"`
		EnvironmentType string `json:"environmentType"`
		DiscoveredBy    struct {
			UUID              string `json:"uuid"`
			DisplayName       string `json:"displayName"`
			Category          string `json:"category"`
			IsProbeRegistered bool   `json:"isProbeRegistered"`
			Type              string `json:"type"`
			Readonly          bool   `json:"readonly"`
		} `json:"discoveredBy"`
		VendorIds map[string]string `json:"vendorIds"`
		State     string            `json:"state"`
	} `json:"currentEntity"`
	NewEntity struct {
		UUID            string `json:"uuid"`
		DisplayName     string `json:"displayName"`
		ClassName       string `json:"className"`
		EnvironmentType string `json:"environmentType"`
		DiscoveredBy    struct {
			UUID              string `json:"uuid"`
			DisplayName       string `json:"displayName"`
			Category          string `json:"category"`
			IsProbeRegistered bool   `json:"isProbeRegistered"`
			Type              string `json:"type"`
			Readonly          bool   `json:"readonly"`
		} `json:"discoveredBy"`
		VendorIds map[string]string `json:"vendorIds"`
		State     string            `json:"state"`
	} `json:"newEntity"`
	CurrentValue    string `json:"currentValue"`
	NewValue        string `json:"newValue"`
	ValueUnits      string `json:"valueUnits"`
	ResizeAttribute string `json:"resizeAttribute"`
	Template        struct {
		UUID        string `json:"uuid"`
		DisplayName string `json:"displayName"`
		ClassName   string `json:"className"`
		Discovered  bool   `json:"discovered"`
		EnableMatch bool   `json:"enableMatch"`
	} `json:"template"`
	Risk struct {
		SubCategory       string   `json:"subCategory"`
		Description       string   `json:"description"`
		Severity          string   `json:"severity"`
		Importance        float32  `json:"importance"`
		ReasonCommodities []string `json:"reasonCommodities"`
	} `json:"risk"`
	Stats []struct {
		Name    string `json:"name"`
		Filters []struct {
			Type        string `json:"type"`
			Value       string `json:"value"`
			DisplayName string `json:"displayName"`
		} `json:"filters"`
		Units string  `json:"units"`
		Value float64 `json:"value"`
	} `json:"stats"`
	CurrentLocation struct {
		UUID            string `json:"uuid"`
		DisplayName     string `json:"displayName"`
		ClassName       string `json:"className"`
		EnvironmentType string `json:"environmentType"`
		DiscoveredBy    struct {
			UUID              string `json:"uuid"`
			DisplayName       string `json:"displayName"`
			Category          string `json:"category"`
			IsProbeRegistered bool   `json:"isProbeRegistered"`
			Type              string `json:"type"`
			Readonly          bool   `json:"readonly"`
		} `json:"discoveredBy"`
		VendorIds map[string]string `json:"vendorIds"`
	} `json:"currentLocation"`
	NewLocation struct {
		UUID            string `json:"uuid"`
		DisplayName     string `json:"displayName"`
		ClassName       string `json:"className"`
		EnvironmentType string `json:"environmentType"`
		DiscoveredBy    struct {
			UUID              string `json:"uuid"`
			DisplayName       string `json:"displayName"`
			Category          string `json:"category"`
			IsProbeRegistered bool   `json:"isProbeRegistered"`
			Type              string `json:"type"`
			Readonly          bool   `json:"readonly"`
		} `json:"discoveredBy"`
		VendorIds map[string]string `json:"vendorIds"`
	} `json:"newLocation"`
	ActionSchedule struct {
		UUID                               string `json:"uuid"`
		DisplayName                        string `json:"displayName"`
		NextOccurrence                     string `json:"nextOccurrence"`
		NextOccurrenceTimestamp            int64  `json:"nextOccurrenceTimestamp"`
		TimeZoneId                         string `json:"timeZoneId"`
		Mode                               string `json:"mode"`
		AcceptedByUserForMaintenanceWindow bool   `json:"acceptedByUserForMaintenanceWindow"`
		RemaingTimeActiveInMs              int64  `json:"remaingTimeActiveInMs"`
	}
	CompoundActions []struct {
		DisplayName string `json:"displayName"`
		ActionType  string `json:"actionType"`
		ActionState string `json:"actionState"`
		ActionMode  string `json:"actionMode"`
		Details     string `json:"details"`
		Target      struct {
			UUID            string `json:"uuid"`
			DisplayName     string `json:"displayName"`
			ClassName       string `json:"className"`
			EnvironmentType string `json:"environmentType"`
			DiscoveredBy    struct {
				UUID              string `json:"uuid"`
				DisplayName       string `json:"displayName"`
				Category          string `json:"category"`
				IsProbeRegistered bool   `json:"isProbeRegistered"`
				Type              string `json:"type"`
				Readonly          bool   `json:"readonly"`
			} `json:"discoveredBy"`
			VendorIds map[string]string   `json:"vendorIds"`
			State     string              `json:"state"`
			Tags      map[string][]string `json:"tags"`
		} `json:"target"`
		CurrentEntity struct {
			UUID            string `json:"uuid"`
			DisplayName     string `json:"displayName"`
			ClassName       string `json:"className"`
			EnvironmentType string `json:"environmentType"`
			DiscoveredBy    struct {
				UUID              string `json:"uuid"`
				DisplayName       string `json:"displayName"`
				Category          string `json:"category"`
				IsProbeRegistered bool   `json:"isProbeRegistered"`
				Type              string `json:"type"`
				Readonly          bool   `json:"readonly"`
			} `json:"discoveredBy"`
			VendorIds map[string]string `json:"vendorIds"`
			State     string            `json:"state"`
		} `json:"currentEntity"`
		NewEntity struct {
			UUID            string `json:"uuid"`
			DisplayName     string `json:"displayName"`
			ClassName       string `json:"className"`
			EnvironmentType string `json:"environmentType"`
			DiscoveredBy    struct {
				UUID              string `json:"uuid"`
				DisplayName       string `json:"displayName"`
				Category          string `json:"category"`
				IsProbeRegistered bool   `json:"isProbeRegistered"`
				Type              string `json:"type"`
				Readonly          bool   `json:"readonly"`
			} `json:"discoveredBy"`
			VendorIds map[string]string `json:"vendorIds"`
			State     string            `json:"state"`
		} `json:"newEntity"`
		CurrentValue    string `json:"currentValue"`
		NewValue        string `json:"newValue"`
		ValueUnits      string `json:"valueUnits"`
		ResizeAttribute string `json:"resizeAttribute"`
		Risk            struct {
			SubCategory       string   `json:"subCategory"`
			Description       string   `json:"description"`
			Severity          string   `json:"severity"`
			Importance        float32  `json:"importance"`
			ReasonCommodities []string `json:"reasonCommodities"`
		} `json:"risk"`
	} `json:"compoundActions"`
	Source   string `json:"source"`
	ActionID int64  `json:"actionID"`
}

Results of GetActions Turbonomc API call

type ActionsCriteria

type ActionsCriteria struct {
	ActionStateList []string `json:"actionStateList"`
	ActionTypeList  []string `json:"actionTypeList"`
	DetailLevel     string   `json:"detailLevel,omitempty"`
}

Criteria passed for retriving actions

type ActionsRequest

type ActionsRequest struct {
	Uuid            string
	ActionState     []string
	ActionType      []string
	DetailLevel     string
	Headers         map[string]string
	QueryParameters map[string]string
}

Parameters for retriving actions from Turbonomic's API

type ApiInfo added in v1.2.0

type ApiInfo struct {
	ApiOrigin string
	Version   string
}

type AuthRequest

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

Parameters for authenticating to the Turbonomic API

type Client

type Client struct {
	BaseURL    string
	HTTPClient *http.Client
	Headers    map[string]string
	Logger     logging.LoggerCustom
	Ctx        context.Context
}

Turbonomic Client

func (*Client) GetActionsByUUID

func (c *Client) GetActionsByUUID(actionReq ActionsRequest) (ActionResults, error)

Retrives actions from Turbonomic's API based on request parameters

func (*Client) GetEntity

func (c *Client) GetEntity(reqOpts EntityRequest) (*EntityResults, error)

Retrives entity based on its provided uuid

func (*Client) GetEntityTags added in v1.2.0

func (c *Client) GetEntityTags(reqOpts EntityRequest) ([]Tag, error)

Retrives entity tags by provided entity uuid

func (*Client) GetStats added in v1.5.0

func (c *Client) GetStats(statsReq StatsRequest) (StatsResponse, error)

GetStats retrieves statistics from Turbonomic's API based on request parameters

func (*Client) SearchEntities

func (c *Client) SearchEntities(
	searchCriteria SearchDTO, reqParams CommonReqParams) (SearchResults, error)

func (*Client) SearchEntityByName

func (c *Client) SearchEntityByName(searchReq SearchRequest) (SearchResults, error)

Retrives the results of a search of Turbonomic's API based on provided parameters

func (*Client) SearchEntityByVendorId added in v1.6.0

func (c *Client) SearchEntityByVendorId(searchReq SearchRequestByVendorId) (SearchResults, error)

Retrives the results of a search of Turbonomic's API based on provided parameters

func (*Client) TagEntity added in v1.2.0

func (c *Client) TagEntity(reqOpts TagEntityRequest) ([]Tag, error)

Tags entity by provided entity uuid

type ClientParameters

type ClientParameters struct {
	Baseurl    string
	Hostname   string
	Username   string
	Password   string
	OAuthCreds OAuthCreds
	Skipverify bool
	ApiInfo    ApiInfo
}

Parameters for creating a Turbonomic client

type CommonReqParams

type CommonReqParams struct {
	QueryParameters map[string]string
	Headers         map[string]string
}

type Criteria

type Criteria struct {
	CaseSensitive bool   `json:"caseSensitive"`
	ExpType       string `json:"expType"`
	ExpVal        string `json:"expVal"`
	FilterType    string `json:"filterType"`
}

Criterion for a Turbonomic API search request

type EntityRequest

type EntityRequest struct {
	Uuid             string
	CommonReqOptions CommonReqParams
}

Parameters for retriving an entity from Turbonomic's API

type EntityResults

type EntityResults struct {
	UUID            string `json:"uuid,omitempty"`
	DisplayName     string `json:"displayName,omitempty"`
	ClassName       string `json:"className,omitempty"`
	EnvironmentType string `json:"environmentType,omitempty"`
	DiscoveredBy    struct {
		UUID        string `json:"uuid,omitempty"`
		DisplayName string `json:"displayName,omitempty"`
		Category    string `json:"category,omitempty"`
		Type        string `json:"type,omitempty"`
		Readonly    bool   `json:"readonly,omitempty"`
	} `json:"discoveredBy,omitempty"`
	VendorIds struct {
		Turbonomicamp string `json:"turbonomicamp,omitempty"`
	} `json:"vendorIds,omitempty"`
	State             string  `json:"state,omitempty"`
	Severity          string  `json:"severity,omitempty"`
	CostPrice         float64 `json:"costPrice,omitempty"`
	SeverityBreakdown struct {
		UNKNOWN  int `json:"UNKNOWN,omitempty"`
		NORMAL   int `json:"NORMAL,omitempty"`
		MINOR    int `json:"MINOR,omitempty"`
		MAJOR    int `json:"MAJOR,omitempty"`
		CRITICAL int `json:"CRITICAL,omitempty"`
	} `json:"severityBreakdown,omitempty"`
	Providers []struct {
		UUID        string `json:"uuid,omitempty"`
		DisplayName string `json:"displayName,omitempty"`
		ClassName   string `json:"className,omitempty"`
	} `json:"providers,omitempty"`
	Template struct {
		UUID        string  `json:"uuid,omitempty"`
		DisplayName string  `json:"displayName,omitempty"`
		Price       float64 `json:"price,omitempty"`
		Discovered  bool    `json:"discovered,omitempty"`
		EnableMatch bool    `json:"enableMatch,omitempty"`
	} `json:"template,omitempty"`
	Tags      struct{} `json:"tags,omitempty"`
	Staleness string   `json:"staleness,omitempty"`
}

Results from GetEntity request

type EntityStats added in v1.5.0

type EntityStats struct {
	DisplayName string      `json:"displayName"`
	Date        time.Time   `json:"date"`
	Statistics  []Statistic `json:"statistics"`
	Epoch       string      `json:"epoch"`
}

EntityStats represents statistics for a single entity

type Filter added in v1.5.0

type Filter struct {
	Type        string      `json:"type"`
	Value       string      `json:"value"`
	DisplayName interface{} `json:"displayName"`
}

Filter represents a filter to be applied to the statistics

type HistUtilization added in v1.5.0

type HistUtilization struct {
	Type     string  `json:"type"`
	Usage    float64 `json:"usage"`
	Capacity float64 `json:"capacity"`
}

HistUtilization represents historical utilization data

type OAuthCreds added in v1.1.0

type OAuthCreds struct {
	ClientId     string
	ClientSecret string
	Role         TurboRoles
}

type RelatedEntity added in v1.5.0

type RelatedEntity struct {
	UUID string `json:"uuid"`
}

RelatedEntity represents a related entity in a statistic

type RequestOptions

type RequestOptions struct {
	Method          string
	Path            string
	ReqDTO          *bytes.Buffer
	CommonReqParams CommonReqParams
}

Parameters for making a request to Turbonomic's API

type SearchDTO

type SearchDTO struct {
	CriteriaList    []Criteria `json:"criteriaList"`
	LogicalOperator string     `json:"logicalOperator"`
	ClassName       string     `json:"className"`
	Scope           string     `json:"scope,omitempty"`
	EnvironmentType string     `json:"environmentType,omitempty"`
	CloudType       string     `json:"cloudType,omitempty"`
}

Body for POST request of Turbonomic API search request

type SearchRequest

type SearchRequest struct {
	Name             string
	EntityType       string
	EnvironmentType  string
	CloudType        string
	OSNames          []string
	CaseSensitive    bool
	CommonReqParams  CommonReqParams
	SearchParameters map[string]string
}

Parameters for searching Turbonomic's API

type SearchRequestByVendorId added in v1.6.0

type SearchRequestByVendorId struct {
	EntityType      string
	VendorId        string
	CaseSensitive   bool
	CommonReqParams CommonReqParams
}

type SearchResults

type SearchResults []struct {
	UUID            string `json:"uuid"`
	DisplayName     string `json:"displayName"`
	ClassName       string `json:"className"`
	EnvironmentType string `json:"environmentType"`
	DiscoveredBy    struct {
		UUID        string `json:"uuid"`
		DisplayName string `json:"displayName"`
		Category    string `json:"category"`
		Type        string `json:"type"`
		Readonly    bool   `json:"readonly"`
	} `json:"discoveredBy"`
	VendorIds         map[string]string `json:"vendorIds"`
	State             string            `json:"state"`
	Severity          string            `json:"severity"`
	CostPrice         float64           `json:"costPrice"`
	SeverityBreakdown struct{}          `json:"severityBreakdown"`
	Template          struct {
		Price       float64 `json:"price"`
		Discovered  bool    `json:"discovered"`
		EnableMatch bool    `json:"enableMatch"`
		DisplayName string  `json:"displayName"`
	} `json:"template"`
	Aspects struct {
		VirtualMachineAspect struct {
			Os                string   `json:"os"`
			IP                []string `json:"ip"`
			NumVCPUs          int      `json:"numVCPUs"`
			EbsOptimized      bool     `json:"ebsOptimized"`
			ResourceID        string   `json:"resourceId"`
			CreationTimeStamp int      `json:"creationTimeStamp"`
			Type              string   `json:"type"`
		} `json:"virtualMachineAspect"`
		VirtualDisksAspect struct {
			VirtualDisks []struct {
				UUID        string `json:"uuid"`
				DisplayName string `json:"displayName"`
				Tier        string `json:"tier"`
				Stats       []struct {
					Name     string `json:"name"`
					Capacity struct {
						Max   int `json:"max"`
						Min   int `json:"min"`
						Avg   int `json:"avg"`
						Total int `json:"total"`
					} `json:"capacity"`
					Filters []struct {
						Type        string      `json:"type"`
						Value       string      `json:"value"`
						DisplayName interface{} `json:"displayName"`
					} `json:"filters"`
					Units  string `json:"units"`
					Values struct {
						Max   int `json:"max"`
						Min   int `json:"min"`
						Avg   int `json:"avg"`
						Total int `json:"total"`
					} `json:"values"`
					Value int `json:"value"`
				} `json:"stats"`
				AttachedVirtualMachine struct {
					UUID        string `json:"uuid"`
					DisplayName string `json:"displayName"`
					ClassName   string `json:"className"`
				} `json:"attachedVirtualMachine"`
				Provider struct {
					UUID        string `json:"uuid"`
					DisplayName string `json:"displayName"`
					ClassName   string `json:"className"`
				} `json:"provider"`
				DataCenter struct {
					UUID        string `json:"uuid"`
					DisplayName string `json:"displayName"`
					ClassName   string `json:"className"`
				} `json:"dataCenter"`
				EnvironmentType string `json:"environmentType"`
				LastModified    int64  `json:"lastModified"`
				BusinessAccount struct {
					UUID            string `json:"uuid"`
					DisplayName     string `json:"displayName"`
					ClassName       string `json:"className"`
					EnvironmentType string `json:"environmentType"`
					DiscoveredBy    struct {
						UUID        string `json:"uuid"`
						DisplayName string `json:"displayName"`
						Category    string `json:"category"`
						Type        string `json:"type"`
						Readonly    bool   `json:"readonly"`
					} `json:"discoveredBy"`
					VendorIds struct {
						Turbonomicamp string `json:"turbonomicamp"`
					} `json:"vendorIds"`
					State             string `json:"state"`
					Severity          string `json:"severity"`
					SeverityBreakdown struct {
						NORMAL int `json:"NORMAL"`
					} `json:"severityBreakdown"`
					Tags struct {
						Usage []string `json:"Usage"`
					} `json:"tags"`
					Staleness string `json:"staleness"`
				} `json:"businessAccount"`
				SnapshotID        string  `json:"snapshotId"`
				Encryption        string  `json:"encryption"`
				AttachmentState   string  `json:"attachmentState"`
				HourlyBilledOps   float64 `json:"hourlyBilledOps"`
				CreationTimeStamp int64   `json:"creationTimeStamp"`
				ResourceID        string  `json:"resourceId"`
			} `json:"virtualDisks"`
			Type string `json:"type"`
		} `json:"virtualDisksAspect"`
	} `json:"aspects"`
	Tags struct{} `json:"tags"`
}

Results of a search request to Turbonomic's API

type StatValues added in v1.5.0

type StatValues struct {
	Max      float64 `json:"max"`
	Min      float64 `json:"min"`
	Avg      float64 `json:"avg"`
	Total    float64 `json:"total"`
	TotalMax float64 `json:"totalMax,omitempty"`
	TotalMin float64 `json:"totalMin,omitempty"`
}

StatValues represents statistical values

type Statistic added in v1.5.0

type Statistic struct {
	Name             string                 `json:"name"`
	Capacity         StatValues             `json:"capacity"`
	Reserved         StatValues             `json:"reserved"`
	Filters          []Filter               `json:"filters"`
	RelatedEntity    *RelatedEntity         `json:"relatedEntity,omitempty"`
	Units            string                 `json:"units"`
	Values           StatValues             `json:"values"`
	Value            float64                `json:"value"`
	CommoditySource  map[string]interface{} `json:"commoditySource"`
	HistUtilizations []HistUtilization      `json:"histUtilizations,omitempty"`
}

Statistic represents a single statistic in the response

type StatisticRequest added in v1.5.0

type StatisticRequest struct {
	Name              string   `json:"name"`
	RelatedEntityType string   `json:"relatedEntityType,omitempty"`
	Filters           []Filter `json:"filters,omitempty"`
}

StatisticRequest represents a single statistic to be requested

type StatsRequest added in v1.5.0

type StatsRequest struct {
	EntityUUID      string
	StartDate       string
	EndDate         string
	Statistics      []StatisticRequest
	CommonReqParams CommonReqParams
}

StatsRequest represents the parameters for retrieving statistics from Turbonomic's API

type StatsRequestBody added in v1.5.0

type StatsRequestBody struct {
	StartDate  string             `json:"startDate,omitempty"`
	EndDate    string             `json:"endDate,omitempty"`
	Statistics []StatisticRequest `json:"statistics"`
}

StatsRequestBody represents the request body for the statistics API

type StatsResponse added in v1.5.0

type StatsResponse []EntityStats

StatsResponse represents the response from the statistics API

type T8cClient added in v1.0.2

type T8cClient interface {
	GetActionsByUUID(actionReq ActionsRequest) (ActionResults, error)
	GetEntity(reqOpts EntityRequest) (*EntityResults, error)
	GetEntityTags(reqOpts EntityRequest) ([]Tag, error)
	TagEntity(reqOpts TagEntityRequest) ([]Tag, error)
	SearchEntities(searchCriteria SearchDTO, reqParams CommonReqParams) (SearchResults, error)
	SearchEntityByName(searchReq SearchRequest) (SearchResults, error)
	SearchEntityByVendorId(searchReq SearchRequestByVendorId) (SearchResults, error)
	GetStats(statsReq StatsRequest) (StatsResponse, error)
}

func NewClient

func NewClient(clientParams *ClientParameters, options ...logging.LoggingOption) (T8cClient, error)

Creates a new instance of the Turbonomic Client

type Tag added in v1.2.0

type Tag struct {
	Key    string   `json:"key"`
	Values []string `json:"values"`
}

Result for retriving an entity tag from Turbonomic's API

type TagEntityRequest added in v1.2.0

type TagEntityRequest struct {
	Uuid             string
	Tags             []Tag
	CommonReqOptions CommonReqParams
}

Parameters for tagging an entity using Turbonomic's API

type TestAction added in v1.0.2

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

type TestEntity added in v1.0.2

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

type TestSearch added in v1.0.2

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

type TestStats added in v1.5.0

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

type TurboRoles added in v1.0.2

type TurboRoles int
const (
	ADMINISTRATOR TurboRoles = iota + 1
	SITE_ADMIN
	AUTOMATOR
	DEPLOYER
	ADVISOR
	OBSERVER
	OPERATIONAL_OBSERVER
	SHARED_ADVISOR
	SHARED_OBSERVER
	REPORT_EDITOR
)

func GetRolefromString added in v1.1.0

func GetRolefromString(role string) TurboRoles

func (TurboRoles) String added in v1.0.2

func (t TurboRoles) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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