aci

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package aci provides tools for interacting with the Azure Container Instances API.

Index

Constants

View Source
const (
	KubeProxyExtensionSettingClusterCIDR string = "clusterCidr"
	KubeProxyExtensionSettingKubeVersion string = "kubeVersion"
	KubeProxyExtensionSettingKubeConfig  string = "kubeConfig"
	KubeProxyExtensionKubeVersion        string = "v1.9.10"
)

Supported kube-proxy extension constants

View Source
const (
	LogAnalyticsMetadataKeyPodUUID           string = "pod-uuid"
	LogAnalyticsMetadataKeyNodeName          string = "node-name"
	LogAnalyticsMetadataKeyClusterResourceID string = "cluster-resource-id"
)

Supported log analytics metadata keys

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregationType added in v0.5.2

type AggregationType string

AggregationType is an enum type for defining supported aggregation types

const (
	AggregationTypeCount   AggregationType = "count"
	AggregationTypeAverage AggregationType = "average"
	AggregationTypeTotal   AggregationType = "total"
)

Supported metric aggregation types

type AzureFileVolume

type AzureFileVolume struct {
	ShareName          string `json:"shareName,omitempty"`
	ReadOnly           bool   `json:"readOnly,omitempty"`
	StorageAccountName string `json:"storageAccountName,omitempty"`
	StorageAccountKey  string `json:"storageAccountKey,omitempty"`
}

AzureFileVolume is the properties of the Azure File volume. Azure File shares are mounted as volumes.

type Client

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

Client is a client for interacting with Azure Container Instances.

Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines.

func NewClient

func NewClient(auth *azure.Authentication) (*Client, error)

NewClient creates a new Azure Container Instances client.

func (*Client) CreateContainerGroup

func (c *Client) CreateContainerGroup(ctx context.Context, resourceGroup, containerGroupName string, containerGroup ContainerGroup) (*ContainerGroup, error)

CreateContainerGroup creates a new Azure Container Instance with the provided properties. From: https://docs.microsoft.com/en-us/rest/api/container-instances/containergroups/createorupdate

func (*Client) DeleteContainerGroup

func (c *Client) DeleteContainerGroup(ctx context.Context, resourceGroup, containerGroupName string) error

DeleteContainerGroup deletes an Azure Container Instance in the provided resource group with the given container group name. From: https://docs.microsoft.com/en-us/rest/api/container-instances/containergroups/delete

func (*Client) GetContainerGroup

func (c *Client) GetContainerGroup(ctx context.Context, resourceGroup, containerGroupName string) (*ContainerGroup, error, *int)

GetContainerGroup gets an Azure Container Instance in the provided resource group with the given container group name. From: https://docs.microsoft.com/en-us/rest/api/container-instances/containergroups/get

func (*Client) GetContainerGroupMetrics added in v0.5.2

func (c *Client) GetContainerGroupMetrics(ctx context.Context, resourceGroup, containerGroup string, options MetricsRequest) (*ContainerGroupMetricsResult, error)

GetContainerGroupMetrics gets metrics for the provided container group

func (*Client) GetContainerLogs

func (c *Client) GetContainerLogs(ctx context.Context, resourceGroup, containerGroupName, containerName string, tail int) (*Logs, error)

GetContainerLogs returns the logs from an Azure Container Instance in the provided resource group with the given container group name. From: https://docs.microsoft.com/en-us/rest/api/container-instances/ContainerLogs/List

func (*Client) LaunchExec added in v0.4.1

func (c *Client) LaunchExec(resourceGroup, containerGroupName, containerName, command string, terminalSize remotecommand.TerminalSize) (ExecResponse, error)

Starts the exec command for a specified container instance in a specified resource group and container group. From: https://docs.microsoft.com/en-us/rest/api/container-instances/startcontainer/launchexec

func (*Client) ListContainerGroups

func (c *Client) ListContainerGroups(ctx context.Context, resourceGroup string) (*ContainerGroupListResult, error)

ListContainerGroups lists an Azure Container Instance Groups, if a resource group is given it will list by resource group. It optionally accepts a resource group name and will filter based off of it if it is not empty. From: https://docs.microsoft.com/en-us/rest/api/container-instances/containergroups/list From: https://docs.microsoft.com/en-us/rest/api/container-instances/containergroups/listbyresourcegroup

func (*Client) UpdateContainerGroup

func (c *Client) UpdateContainerGroup(ctx context.Context, resourceGroup, containerGroupName string, containerGroup ContainerGroup) (*ContainerGroup, error)

UpdateContainerGroup updates an Azure Container Instance with the provided properties. From: https://docs.microsoft.com/en-us/rest/api/container-instances/containergroups/createorupdate

type Container

type Container struct {
	Name                string `json:"name,omitempty"`
	ContainerProperties `json:"properties,omitempty"`
}

Container is a container instance.

type ContainerExecProbe added in v0.5.0

type ContainerExecProbe struct {
	Command []string `json:"command,omitempty"`
}

ContainerExecProbe defines a command based probe

type ContainerGroup

type ContainerGroup struct {
	api.ResponseMetadata     `json:"-"`
	ID                       string            `json:"id,omitempty"`
	Name                     string            `json:"name,omitempty"`
	Type                     string            `json:"type,omitempty"`
	Location                 string            `json:"location,omitempty"`
	Tags                     map[string]string `json:"tags,omitempty"`
	ContainerGroupProperties `json:"properties,omitempty"`
}

ContainerGroup is a container group.

type ContainerGroupDiagnostics added in v0.5.0

type ContainerGroupDiagnostics struct {
	LogAnalytics *LogAnalyticsWorkspace `json:"loganalytics,omitempty"`
}

ContainerGroupDiagnostics contains an instance of LogAnalyticsWorkspace

func NewContainerGroupDiagnostics added in v0.5.0

func NewContainerGroupDiagnostics(logAnalyticsID, logAnalyticsKey string) (*ContainerGroupDiagnostics, error)

func NewContainerGroupDiagnosticsFromFile added in v0.5.0

func NewContainerGroupDiagnosticsFromFile(filepath string) (*ContainerGroupDiagnostics, error)

type ContainerGroupListResult

type ContainerGroupListResult struct {
	api.ResponseMetadata `json:"-"`
	Value                []ContainerGroup `json:"value,omitempty"`
	NextLink             string           `json:"nextLink,omitempty"`
}

ContainerGroupListResult is the container group list response that contains the container group properties.

type ContainerGroupMetricsResult added in v0.5.2

type ContainerGroupMetricsResult struct {
	Value []MetricValue `json:"value"`
}

ContainerGroupMetricsResult stores all the results for a container group metrics request.

type ContainerGroupNetworkProtocol

type ContainerGroupNetworkProtocol string

ContainerGroupNetworkProtocol enumerates the values for container group network protocol.

const (
	// TCP specifies the tcp state for container group network protocol.
	TCP ContainerGroupNetworkProtocol = "TCP"
	// UDP specifies the udp state for container group network protocol.
	UDP ContainerGroupNetworkProtocol = "UDP"
)

type ContainerGroupProperties

type ContainerGroupProperties struct {
	ProvisioningState        string                               `json:"provisioningState,omitempty"`
	Containers               []Container                          `json:"containers,omitempty"`
	ImageRegistryCredentials []ImageRegistryCredential            `json:"imageRegistryCredentials,omitempty"`
	RestartPolicy            ContainerGroupRestartPolicy          `json:"restartPolicy,omitempty"`
	IPAddress                *IPAddress                           `json:"ipAddress,omitempty"`
	OsType                   OperatingSystemTypes                 `json:"osType,omitempty"`
	Volumes                  []Volume                             `json:"volumes,omitempty"`
	InstanceView             ContainerGroupPropertiesInstanceView `json:"instanceView,omitempty"`
	Diagnostics              *ContainerGroupDiagnostics           `json:"diagnostics,omitempty"`
	NetworkProfile           *NetworkProfileDefinition            `json:"networkProfile,omitempty"`
	Extensions               []*Extension                         `json:"extensions,omitempty"`
	DNSConfig                *DNSConfig                           `json:"dnsConfig,omitempty"`
}

ContainerGroupProperties is

type ContainerGroupPropertiesInstanceView

type ContainerGroupPropertiesInstanceView struct {
	Events []Event `json:"events,omitempty"`
	State  string  `json:"state,omitempty"`
}

ContainerGroupPropertiesInstanceView is the instance view of the container group. Only valid in response.

type ContainerGroupRestartPolicy

type ContainerGroupRestartPolicy string

ContainerGroupRestartPolicy enumerates the values for container group restart policy.

const (
	// Always specifies the always state for container group restart policy.
	Always ContainerGroupRestartPolicy = "Always"
	// Never specifies the never state for container group restart policy.
	Never ContainerGroupRestartPolicy = "Never"
	// OnFailure specifies the on failure state for container group restart policy.
	OnFailure ContainerGroupRestartPolicy = "OnFailure"
)

type ContainerHTTPGetProbe added in v0.5.0

type ContainerHTTPGetProbe struct {
	Port   int    `json:"port"`
	Path   string `json:"path,omitempty"`
	Scheme string `json:"scheme,omitempty"`
}

ContainerHTTPGetProbe defines an HTTP probe

type ContainerNetworkProtocol

type ContainerNetworkProtocol string

ContainerNetworkProtocol enumerates the values for container network protocol.

const (
	// ContainerNetworkProtocolTCP specifies the container network protocol tcp state for container network protocol.
	ContainerNetworkProtocolTCP ContainerNetworkProtocol = "TCP"
	// ContainerNetworkProtocolUDP specifies the container network protocol udp state for container network protocol.
	ContainerNetworkProtocolUDP ContainerNetworkProtocol = "UDP"
)

type ContainerPort

type ContainerPort struct {
	Protocol ContainerNetworkProtocol `json:"protocol,omitempty"`
	Port     int32                    `json:"port,omitempty"`
}

ContainerPort is the port exposed on the container instance.

type ContainerProbe added in v0.5.0

type ContainerProbe struct {
	Exec                *ContainerExecProbe    `json:"exec,omitempty"`
	HTTPGet             *ContainerHTTPGetProbe `json:"httpGet,omitempty"`
	InitialDelaySeconds int32                  `json:"initialDelaySeconds,omitempty"`
	Period              int32                  `json:"periodSeconds,omitempty"`
	FailureThreshold    int32                  `json:"failureThreshold,omitempty"`
	SuccessThreshold    int32                  `json:"successThreshold,omitempty"`
	TimeoutSeconds      int32                  `json:"timeoutSeconds,omitempty"`
}

ContainerProbe is a probe definition that can be used for Liveness or Readiness checks.

type ContainerProperties

type ContainerProperties struct {
	Image                string                          `json:"image,omitempty"`
	Command              []string                        `json:"command,omitempty"`
	Ports                []ContainerPort                 `json:"ports,omitempty"`
	EnvironmentVariables []EnvironmentVariable           `json:"environmentVariables,omitempty"`
	InstanceView         ContainerPropertiesInstanceView `json:"instanceView,omitempty"`
	Resources            ResourceRequirements            `json:"resources,omitempty"`
	VolumeMounts         []VolumeMount                   `json:"volumeMounts,omitempty"`
	LivenessProbe        *ContainerProbe                 `json:"livenessProbe,omitempty"`
	ReadinessProbe       *ContainerProbe                 `json:"readinessProbe,omitempty"`
}

ContainerProperties is the container instance properties.

type ContainerPropertiesInstanceView

type ContainerPropertiesInstanceView struct {
	RestartCount  int32          `json:"restartCount,omitempty"`
	CurrentState  ContainerState `json:"currentState,omitempty"`
	PreviousState ContainerState `json:"previousState,omitempty"`
	Events        []Event        `json:"events,omitempty"`
}

ContainerPropertiesInstanceView is the instance view of the container instance. Only valid in response.

type ContainerState

type ContainerState struct {
	State        string       `json:"state,omitempty"`
	StartTime    api.JSONTime `json:"startTime,omitempty"`
	ExitCode     int32        `json:"exitCode,omitempty"`
	FinishTime   api.JSONTime `json:"finishTime,omitempty"`
	DetailStatus string       `json:"detailStatus,omitempty"`
}

ContainerState is the container instance state.

type DNSConfig added in v0.6.0

type DNSConfig struct {
	NameServers   []string `json:"nameServers"`
	SearchDomains string   `json:"searchDomains,omitempty"`
	Options       string   `json:"options,omitempty"`
}

DNSConfig is the DNS config for container group

type EnvironmentVariable

type EnvironmentVariable struct {
	Name        string `json:"name,omitempty"`
	Value       string `json:"value,omitempty"`
	SecureValue string `json:"secureValue,omitempty"`
}

EnvironmentVariable is the environment variable to set within the container instance.

type Event

type Event struct {
	Count          int32        `json:"count,omitempty"`
	FirstTimestamp api.JSONTime `json:"firstTimestamp,omitempty"`
	LastTimestamp  api.JSONTime `json:"lastTimestamp,omitempty"`
	Name           string       `json:"name,omitempty"`
	Message        string       `json:"message,omitempty"`
	Type           string       `json:"type,omitempty"`
}

Event is a container group or container instance event.

type ExecRequest added in v0.4.1

type ExecRequest struct {
	Command      string       `json:"command,omitempty"`
	TerminalSize TerminalSize `json:"terminalSize,omitempty"`
}

ExecRequest is a request for Launch Exec API response for ACI.

type ExecResponse added in v0.4.1

type ExecResponse struct {
	WebSocketUri string `json:"webSocketUri,omitempty"`
	Password     string `json:"password,omitempty"`
}

ExecResponse is a request for Launch Exec API response for ACI.

type Extension added in v0.6.0

type Extension struct {
	Name       string               `json:"name"`
	Properties *ExtensionProperties `json:"properties"`
}

Extension is the container group extension

type ExtensionProperties added in v0.6.0

type ExtensionProperties struct {
	Type              ExtensionType     `json:"extensionType"`
	Version           ExtensionVersion  `json:"version"`
	Settings          map[string]string `json:"settings,omitempty"`
	ProtectedSettings map[string]string `json:"protectedSettings,omitempty"`
}

ExtensionProperties is the properties for extension

type ExtensionType added in v0.6.0

type ExtensionType string

ExtensionType is an enum type for defining supported extension types

const (
	ExtensionTypeKubeProxy ExtensionType = "kube-proxy"
)

Supported extension types

type ExtensionVersion added in v0.6.0

type ExtensionVersion string

ExtensionVersion is an enum type for defining supported extension versions

const (
	ExtensionVersion1_0 ExtensionVersion = "1.0"
)

Supported extension version

type GitRepoVolume

type GitRepoVolume struct {
	Directory  string `json:"directory,omitempty"`
	Repository string `json:"repository,omitempty"`
	Revision   string `json:"revision,omitempty"`
}

GitRepoVolume is represents a volume that is populated with the contents of a git repository

type IPAddress

type IPAddress struct {
	Ports        []Port `json:"ports,omitempty"`
	Type         string `json:"type,omitempty"`
	IP           string `json:"ip,omitempty"`
	DNSNameLabel string `json:"dnsNameLabel,omitempty"`
}

IPAddress is IP address for the container group.

type ImageRegistryCredential

type ImageRegistryCredential struct {
	Server   string `json:"server,omitempty"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

ImageRegistryCredential is image registry credential.

type LogAnalyticsLogType added in v0.6.0

type LogAnalyticsLogType string

LogAnalyticsLogType is an enum type for defining supported log analytics log types

const (
	LogAnlyticsLogTypeContainerInsights LogAnalyticsLogType = "ContainerInsights"
	LogAnlyticsLogTypeContainerInstance LogAnalyticsLogType = "ContainerInstance"
)

Supported log analytics log types

type LogAnalyticsWorkspace added in v0.5.0

type LogAnalyticsWorkspace struct {
	WorkspaceID  string              `json:"workspaceID,omitempty"`
	WorkspaceKey string              `json:"workspaceKey,omitempty"`
	LogType      LogAnalyticsLogType `json:"logType,omitempty"`
	Metadata     map[string]string   `json:"metadata,omitempty"`
}

LogAnalyticsWorkspace defines details for a Log Analytics workspace

type Logs

type Logs struct {
	api.ResponseMetadata `json:"-"`
	Content              string `json:"content,omitempty"`
}

Logs is the logs.

type MetricDescriptor added in v0.5.2

type MetricDescriptor struct {
	Value          MetricType `json:"value"`
	LocalizedValue string     `json:"localizedValue"`
}

MetricDescriptor stores the name for a given metric and the localized version of that name.

type MetricMetadataValue added in v0.5.2

type MetricMetadataValue struct {
	Name  ValueDescriptor `json:"name"`
	Value string          `json:"value"`
}

MetricMetadataValue stores extra metadata about a metric In particular it is used to provide details about the breakdown of a metric dimension.

type MetricTimeSeries added in v0.5.2

type MetricTimeSeries struct {
	Data           []TimeSeriesEntry     `json:"data"`
	MetadataValues []MetricMetadataValue `json:"metadatavalues,omitempty"`
}

MetricTimeSeries is the time series for a given metric It contains all the metrics values and other details for the dimension the metrics are aggregated on.

type MetricType added in v0.5.2

type MetricType string

MetricType is an enum type for defining supported metric types.

const (
	MetricTypeCPUUsage                          MetricType = "CpuUsage"
	MetricTypeMemoryUsage                       MetricType = "MemoryUsage"
	MetricTyperNetworkBytesRecievedPerSecond    MetricType = "NetworkBytesReceivedPerSecond"
	MetricTyperNetworkBytesTransmittedPerSecond MetricType = "NetworkBytesTransmittedPerSecond"
)

Supported metric types

type MetricValue added in v0.5.2

type MetricValue struct {
	ID         string             `json:"id"`
	Desc       MetricDescriptor   `json:"name"`
	Timeseries []MetricTimeSeries `json:"timeseries"`
	Type       string             `json:"type"`
	Unit       string             `json:"unit"`
}

MetricValue stores metrics results

type MetricsRequest added in v0.5.2

type MetricsRequest struct {
	Start        time.Time
	End          time.Time
	Types        []MetricType
	Aggregations []AggregationType

	// Note that a dimension may not be available for certain metrics.
	// In such cases, you will need to make separate requests.
	Dimension string
}

MetricsRequest is an options struct used when getting container group metrics

type NetworkProfileDefinition added in v0.6.0

type NetworkProfileDefinition struct {
	ID string `json:"id,omitempty"`
}

NetworkProfileDefinition is the network profile definition. ID should be of the form /subscriptions/{subscriptionId} or /providers/{resourceProviderNamespace}/

type OperatingSystemTypes

type OperatingSystemTypes string

OperatingSystemTypes enumerates the values for operating system types.

const (
	// Linux specifies the linux state for operating system types.
	Linux OperatingSystemTypes = "Linux"
	// Windows specifies the windows state for operating system types.
	Windows OperatingSystemTypes = "Windows"
)

type Operation

type Operation struct {
	Name    string           `json:"name,omitempty"`
	Display OperationDisplay `json:"display,omitempty"`
	Origin  OperationsOrigin `json:"origin,omitempty"`
}

Operation is an operation for Azure Container Instance service.

type OperationDisplay

type OperationDisplay struct {
	Provider    string `json:"provider,omitempty"`
	Resource    string `json:"resource,omitempty"`
	Operation   string `json:"operation,omitempty"`
	Description string `json:"description,omitempty"`
}

OperationDisplay is the display information of the operation.

type OperationListResult

type OperationListResult struct {
	api.ResponseMetadata `json:"-"`
	Value                []Operation `json:"value,omitempty"`
	NextLink             string      `json:"nextLink,omitempty"`
}

OperationListResult is the operation list response that contains all operations for Azure Container Instance service.

type OperationsOrigin

type OperationsOrigin string

OperationsOrigin enumerates the values for operations origin.

const (
	// System specifies the system state for operations origin.
	System OperationsOrigin = "System"
	// User specifies the user state for operations origin.
	User OperationsOrigin = "User"
)

type Port

type Port struct {
	Protocol ContainerGroupNetworkProtocol `json:"protocol,omitempty"`
	Port     int32                         `json:"port,omitempty"`
}

Port is the port exposed on the container group.

type Resource

type Resource struct {
	ID       string            `json:"id,omitempty"`
	Name     string            `json:"name,omitempty"`
	Type     string            `json:"type,omitempty"`
	Location string            `json:"location,omitempty"`
	Tags     map[string]string `json:"tags,omitempty"`
}

Resource is the Resource model definition.

type ResourceLimits

type ResourceLimits struct {
	MemoryInGB float64 `json:"memoryInGB,omitempty"`
	CPU        float64 `json:"cpu,omitempty"`
}

ResourceLimits is the resource limits.

type ResourceRequests

type ResourceRequests struct {
	MemoryInGB float64 `json:"memoryInGB,omitempty"`
	CPU        float64 `json:"cpu,omitempty"`
}

ResourceRequests is the resource requests.

type ResourceRequirements

type ResourceRequirements struct {
	Requests *ResourceRequests `json:"requests,omitempty"`
	Limits   *ResourceLimits   `json:"limits,omitempty"`
}

ResourceRequirements is the resource requirements.

type TerminalSize added in v0.4.1

type TerminalSize struct {
	Rows int `json:"rows,omitempty"`
	Cols int `json:"cols,omitempty"`
}

TerminalSize is the size of the Launch Exec terminal

type TerminalSizeRequest added in v0.4.1

type TerminalSizeRequest struct {
	Width  int
	Height int
}

type TimeSeriesEntry added in v0.5.2

type TimeSeriesEntry struct {
	Timestamp time.Time `json:"timestamp"`
	Average   float64   `json:"average"`
	Total     float64   `json:"total"`
	Count     float64   `json:"count"`
}

TimeSeriesEntry is the metric data for a given timestamp/metric type

type Usage

type Usage struct {
	Unit         string    `json:"unit,omitempty"`
	CurrentValue int32     `json:"currentValue,omitempty"`
	Limit        int32     `json:"limit,omitempty"`
	Name         UsageName `json:"name,omitempty"`
}

Usage is a single usage result

type UsageListResult

type UsageListResult struct {
	api.ResponseMetadata `json:"-"`
	Value                []Usage `json:"value,omitempty"`
}

UsageListResult is the response containing the usage data

type UsageName

type UsageName struct {
	Value          string `json:"value,omitempty"`
	LocalizedValue string `json:"localizedValue,omitempty"`
}

UsageName is the name object of the resource

type ValueDescriptor added in v0.5.2

type ValueDescriptor struct {
	Value          string `json:"value"`
	LocalizedValue string `json:"localizedValue"`
}

ValueDescriptor describes a generic value. It is used to describe metadata fields.

type Volume

type Volume struct {
	Name      string                 `json:"name,omitempty"`
	AzureFile *AzureFileVolume       `json:"azureFile,omitempty"`
	EmptyDir  map[string]interface{} `json:"emptyDir"`
	Secret    map[string]string      `json:"secret,omitempty"`
	GitRepo   *GitRepoVolume         `json:"gitRepo,omitempty"`
}

Volume is the properties of the volume.

type VolumeMount

type VolumeMount struct {
	Name      string `json:"name,omitempty"`
	MountPath string `json:"mountPath,omitempty"`
	ReadOnly  bool   `json:"readOnly,omitempty"`
}

VolumeMount is the properties of the volume mount.

Jump to

Keyboard shortcuts

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