handlers

package
v1.1.371 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SubscriptionType defines a sub
	SubscriptionType = "subscription"

	// ResourceType defines a top level resource such as a Storage Account or VM
	ResourceType = "resource"
	// MetricsType defines an item which returns a graph
	MetricsType = "metrics"
	// SubResourceType defines a resource under a resource such as a VM Extension under a VM
	SubResourceType = "subResource"

	// ActionType defines an action like `listkey` etc
	ActionType = "action"

	// ExpandURLNotSupported is used to identify items which don't support generic expansion
	ExpandURLNotSupported = "notsupported"
)

Variables

View Source
var ItemWidgetHeight int

ItemWidgetHeight tracks height of item widget

View Source
var ItemWidgetWidth int

ItemWidgetWidth track width of item widget

Register tracks all the current handlers add new handlers to the array to augment the processing of items in the

Functions

func DrawStatus

func DrawStatus(s string) string

DrawStatus converts a status string to an icon

func GetActivityLogExpandURL added in v1.1.72

func GetActivityLogExpandURL(subscriptionID, resourceName string) string

GetActivityLogExpandURL gets the urls which should be used to get activity logs

Types

type APISetExpandResponse added in v1.1.363

type APISetExpandResponse struct {
	Response     string
	ResponseType ExpanderResponseType
	SubResources []SubResource
}

APISetExpandResponse returns the result of expanding a Resource

type ActionExpander

type ActionExpander struct{}

ActionExpander handles actions

func (*ActionExpander) DoesExpand

func (e *ActionExpander) DoesExpand(ctx context.Context, currentItem *TreeNode) (bool, error)

DoesExpand checks if it is an action

func (*ActionExpander) Expand

func (e *ActionExpander) Expand(ctx context.Context, currentItem *TreeNode) ExpanderResult

Expand performs the action

func (*ActionExpander) Name

func (e *ActionExpander) Name() string

Name returns the name of the expander

type ActivityLogExpander added in v1.1.58

type ActivityLogExpander struct{}

ActivityLogExpander expands activity logs under an RG

func (*ActivityLogExpander) DoesExpand added in v1.1.58

func (e *ActivityLogExpander) DoesExpand(ctx context.Context, currentItem *TreeNode) (bool, error)

DoesExpand checks if this is an RG

func (*ActivityLogExpander) Expand added in v1.1.58

func (e *ActivityLogExpander) Expand(ctx context.Context, currentItem *TreeNode) ExpanderResult

Expand returns Resources in the RG

func (*ActivityLogExpander) Name added in v1.1.58

func (e *ActivityLogExpander) Name() string

Name returns the name of the expander

type AppInsightsExpander added in v1.1.269

type AppInsightsExpander struct {
}

AppInsightsExpander expands aspects of App Insights that don't naturally flow from the api spec

func (*AppInsightsExpander) DoesExpand added in v1.1.269

func (e *AppInsightsExpander) DoesExpand(ctx context.Context, currentItem *TreeNode) (bool, error)

DoesExpand checks if this is a node we should extend

func (*AppInsightsExpander) Expand added in v1.1.269

func (e *AppInsightsExpander) Expand(ctx context.Context, currentItem *TreeNode) ExpanderResult

Expand returns nodes for App Insights

func (*AppInsightsExpander) Name added in v1.1.269

func (e *AppInsightsExpander) Name() string

Name returns the name of the expander

type AzureKubernetesServiceExpander added in v1.1.363

type AzureKubernetesServiceExpander struct {
}

AzureKubernetesServiceExpander expands the kubernetes aspects of AKS

func (*AzureKubernetesServiceExpander) DoesExpand added in v1.1.363

func (e *AzureKubernetesServiceExpander) DoesExpand(ctx context.Context, currentItem *TreeNode) (bool, error)

DoesExpand checks if this is a storage account

func (*AzureKubernetesServiceExpander) Expand added in v1.1.363

Expand returns ManagementPolicies in the StorageAccount

func (*AzureKubernetesServiceExpander) Name added in v1.1.363

Name returns the name of the expander

type ContainerInstanceExpander added in v1.1.251

type ContainerInstanceExpander struct {
}

ContainerInstanceExpander expands the data-plane aspects of a Container Instance

func (*ContainerInstanceExpander) DoesExpand added in v1.1.251

func (e *ContainerInstanceExpander) DoesExpand(ctx context.Context, currentItem *TreeNode) (bool, error)

DoesExpand checks if this is a storage account

func (*ContainerInstanceExpander) Expand added in v1.1.251

func (e *ContainerInstanceExpander) Expand(ctx context.Context, currentItem *TreeNode) ExpanderResult

Expand adds items for container instance items to the list

func (*ContainerInstanceExpander) Name added in v1.1.251

Name returns the name of the expander

type ContainerRegistryExpander added in v1.1.231

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

ContainerRegistryExpander expands Tthe data-plane aspects of a Container Registry

func NewContainerRegistryExpander added in v1.1.231

func NewContainerRegistryExpander() *ContainerRegistryExpander

NewContainerRegistryExpander creates a new instance of ContainerRegistryExpander

func (*ContainerRegistryExpander) DoesExpand added in v1.1.231

func (e *ContainerRegistryExpander) DoesExpand(ctx context.Context, currentItem *TreeNode) (bool, error)

DoesExpand checks if this is a storage account

func (*ContainerRegistryExpander) Expand added in v1.1.231

func (e *ContainerRegistryExpander) Expand(ctx context.Context, currentItem *TreeNode) ExpanderResult

Expand returns ManagementPolicies in the StorageAccount

func (*ContainerRegistryExpander) Name added in v1.1.231

Name returns the name of the expander

type DefaultExpander

type DefaultExpander struct{}

DefaultExpander expands RGs under a subscription

var DefaultExpanderInstance DefaultExpander

DefaultExpanderInstance provides an instance of the default expander for use

func (*DefaultExpander) DoesExpand

func (e *DefaultExpander) DoesExpand(ctx context.Context, currentItem *TreeNode) (bool, error)

DoesExpand checks if this handler can expand this item

func (*DefaultExpander) Expand

func (e *DefaultExpander) Expand(ctx context.Context, currentItem *TreeNode) ExpanderResult

Expand returns resource

func (*DefaultExpander) Name

func (e *DefaultExpander) Name() string

Name returns the name of the expander

type DeploymentsExpander added in v1.0.218

type DeploymentsExpander struct{}

DeploymentsExpander expands RGs under a subscription

func (*DeploymentsExpander) DoesExpand added in v1.0.218

func (e *DeploymentsExpander) DoesExpand(ctx context.Context, currentItem *TreeNode) (bool, error)

DoesExpand checks if this is an RG

func (*DeploymentsExpander) Expand added in v1.0.218

func (e *DeploymentsExpander) Expand(ctx context.Context, currentItem *TreeNode) ExpanderResult

Expand returns Resources in the RG

func (*DeploymentsExpander) Name added in v1.0.218

func (e *DeploymentsExpander) Name() string

Name returns the name of the expander

type Expander

type Expander interface {
	DoesExpand(ctx context.Context, currentNode *TreeNode) (bool, error)
	Expand(ctx context.Context, currentNode *TreeNode) ExpanderResult
	Name() string
}

Expander is used to open/expand items in the left list panel a single item can be expanded by 1 or more expanders each Expander provides two methods. `DoesExpand` should return true if this expander can expand the resource `Expand` returns the list of sub items from the resource

type ExpanderResponse added in v1.1.363

type ExpanderResponse struct {
	Response     string               // the response text
	ResponseType ExpanderResponseType // the response
}

ExpanderResponse captures the response text and formt of an expander response

type ExpanderResponseType added in v1.1.363

type ExpanderResponseType string

ExpanderResponseType is used to indicate the text format of a response

const (
	// ResponsePlainText indicates the response type should not be parsed or colourised
	ResponsePlainText ExpanderResponseType = "Text"
	// ResponseJSON indicates the response type can be parsed and colourised as JSON
	ResponseJSON ExpanderResponseType = "JSON"
	// ResponseYAML indicates the response type can be parsed and colourised as YAML
	ResponseYAML ExpanderResponseType = "YAML"
)

type ExpanderResult

type ExpanderResult struct {
	Response          ExpanderResponse
	Nodes             []*TreeNode
	Err               error
	SourceDescription string
	// When set to true this causes the response
	// in the result to be displayed in the content panel
	IsPrimaryResponse bool
}

ExpanderResult used to wrap mult-value return for use in channels

type JSONExpander added in v1.1.58

type JSONExpander struct{}

JSONExpander expands an item with "jsonItem" in its metadata

func (*JSONExpander) DoesExpand added in v1.1.58

func (e *JSONExpander) DoesExpand(ctx context.Context, currentItem *TreeNode) (bool, error)

DoesExpand checks if this is an RG

func (*JSONExpander) Expand added in v1.1.58

func (e *JSONExpander) Expand(ctx context.Context, currentItem *TreeNode) ExpanderResult

Expand returns Resources in the RG

func (*JSONExpander) Name added in v1.1.58

func (e *JSONExpander) Name() string

Name returns the name of the expander

type MetricsExpander added in v1.1.263

type MetricsExpander struct {
}

MetricsExpander expands the data-plane aspects of the Microsoft.Insights RP

func (*MetricsExpander) DoesExpand added in v1.1.263

func (e *MetricsExpander) DoesExpand(ctx context.Context, currentItem *TreeNode) (bool, error)

DoesExpand checks if this is a storage account

func (*MetricsExpander) Expand added in v1.1.263

func (e *MetricsExpander) Expand(ctx context.Context, currentItem *TreeNode) ExpanderResult

Expand adds items for metrics to the list

func (*MetricsExpander) Name added in v1.1.263

func (e *MetricsExpander) Name() string

Name returns the name of the expander

type ResourceGroupResourceExpander

type ResourceGroupResourceExpander struct{}

ResourceGroupResourceExpander expands resource under an RG

func (*ResourceGroupResourceExpander) DoesExpand

func (e *ResourceGroupResourceExpander) DoesExpand(ctx context.Context, currentItem *TreeNode) (bool, error)

DoesExpand checks if this is an RG

func (*ResourceGroupResourceExpander) Expand

Expand returns Resources in the RG

func (*ResourceGroupResourceExpander) Name

Name returns the name of the expander

type StorageManagementPoliciesExpander added in v1.1.214

type StorageManagementPoliciesExpander struct{}

StorageManagementPoliciesExpander expands The default management policy under a storage account

func (*StorageManagementPoliciesExpander) DoesExpand added in v1.1.214

func (e *StorageManagementPoliciesExpander) DoesExpand(ctx context.Context, currentItem *TreeNode) (bool, error)

DoesExpand checks if this is a storage account

func (*StorageManagementPoliciesExpander) Expand added in v1.1.214

Expand returns ManagementPolicies in the StorageAccount

func (*StorageManagementPoliciesExpander) Name added in v1.1.214

Name returns the name of the expander

type SubResource added in v1.1.363

type SubResource struct {
	ID           string
	Name         string
	ResourceType swagger.ResourceType
	ExpandURL    string
	DeleteURL    string
}

SubResource is used to pass sub resource information from SwaggerAPISet to the expander

type SubscriptionExpander

type SubscriptionExpander struct{}

SubscriptionExpander expands RGs under a subscription

func (*SubscriptionExpander) DoesExpand

func (e *SubscriptionExpander) DoesExpand(ctx context.Context, currentItem *TreeNode) (bool, error)

DoesExpand checks if this is an RG

func (*SubscriptionExpander) Expand

func (e *SubscriptionExpander) Expand(ctx context.Context, currentItem *TreeNode) ExpanderResult

Expand returns Resources in the RG

func (*SubscriptionExpander) Name

func (e *SubscriptionExpander) Name() string

Name returns the name of the expander

type SwaggerAPISet added in v1.1.363

type SwaggerAPISet interface {
	ID() string
	GetResourceTypes() []swagger.ResourceType
	AppliesToNode(node *TreeNode) bool
	ExpandResource(context context.Context, node *TreeNode, resourceType swagger.ResourceType) (APISetExpandResponse, error)
	MatchChildNodesByName() bool
	Delete(context context.Context, node *TreeNode) (bool, error)
}

SwaggerAPISet represents the configuration for a set of swagger API endpoints that the SwaggerResourceExpander can handle

type SwaggerAPISetARMResources added in v1.1.363

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

SwaggerAPISetARMResources holds the config for working with ARM resources as per the published Swagger specs

func NewSwaggerAPISetARMResources added in v1.1.363

func NewSwaggerAPISetARMResources() SwaggerAPISetARMResources

NewSwaggerAPISetARMResources creates a new SwaggerAPISetARMResources

func (SwaggerAPISetARMResources) AppliesToNode added in v1.1.363

func (c SwaggerAPISetARMResources) AppliesToNode(node *TreeNode) bool

AppliesToNode is called by the Swagger exapnder to test whether the node applies to this APISet

func (SwaggerAPISetARMResources) Delete added in v1.1.363

func (c SwaggerAPISetARMResources) Delete(ctx context.Context, item *TreeNode) (bool, error)

Delete attempts to delete the item. Returns true if deleted, false if not handled, an error if an error occurred attempting to delete

func (SwaggerAPISetARMResources) ExpandResource added in v1.1.363

func (c SwaggerAPISetARMResources) ExpandResource(ctx context.Context, currentItem *TreeNode, resourceType swagger.ResourceType) (APISetExpandResponse, error)

ExpandResource returns metadata about child resources of the specified resource node

func (SwaggerAPISetARMResources) GetResourceTypes added in v1.1.363

func (c SwaggerAPISetARMResources) GetResourceTypes() []swagger.ResourceType

GetResourceTypes returns the ResourceTypes for the API Set

func (SwaggerAPISetARMResources) ID added in v1.1.363

ID returns the ID for the APISet

func (SwaggerAPISetARMResources) MatchChildNodesByName added in v1.1.363

func (c SwaggerAPISetARMResources) MatchChildNodesByName() bool

MatchChildNodesByName indicates whether child nodes should be matched by name (or position)

type SwaggerAPISetContainerService added in v1.1.363

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

SwaggerAPISetContainerService holds the config for working with an AKS cluster API

func NewSwaggerAPISetContainerService added in v1.1.363

func NewSwaggerAPISetContainerService(resourceTypes []swagger.ResourceType, httpClient http.Client, clusterID string, serverURL string) SwaggerAPISetContainerService

NewSwaggerAPISetContainerService creates a new SwaggerAPISetContainerService

func (SwaggerAPISetContainerService) AppliesToNode added in v1.1.363

func (c SwaggerAPISetContainerService) AppliesToNode(node *TreeNode) bool

AppliesToNode is called by the Swagger exapnder to test whether the node applies to this APISet

func (SwaggerAPISetContainerService) Delete added in v1.1.363

Delete attempts to delete the item. Returns true if deleted, false if not handled, an error if an error occurred attempting to delete

func (SwaggerAPISetContainerService) ExpandResource added in v1.1.363

func (c SwaggerAPISetContainerService) ExpandResource(ctx context.Context, currentItem *TreeNode, resourceType swagger.ResourceType) (APISetExpandResponse, error)

ExpandResource returns metadata about child resources of the specified resource node

func (SwaggerAPISetContainerService) GetResourceTypes added in v1.1.363

func (c SwaggerAPISetContainerService) GetResourceTypes() []swagger.ResourceType

GetResourceTypes returns the ResourceTypes for the API Set

func (SwaggerAPISetContainerService) ID added in v1.1.363

ID returns the ID for the APISet

func (SwaggerAPISetContainerService) MatchChildNodesByName added in v1.1.363

func (c SwaggerAPISetContainerService) MatchChildNodesByName() bool

MatchChildNodesByName indicates whether child nodes should be matched by name (or position)

type SwaggerResourceExpander added in v1.0.247

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

SwaggerResourceExpander expands resource under an AppService

func GetSwaggerResourceExpander added in v1.1.363

func GetSwaggerResourceExpander() *SwaggerResourceExpander

GetSwaggerResourceExpander returns the (singleton) instance of SwaggerResourceExpander

func NewSwaggerResourcesExpander added in v1.1.363

func NewSwaggerResourcesExpander() *SwaggerResourceExpander

NewSwaggerResourcesExpander creates a new SwaggerResourceExpander

func (*SwaggerResourceExpander) AddAPISet added in v1.1.363

func (e *SwaggerResourceExpander) AddAPISet(apiSet SwaggerAPISet)

AddAPISet adds a SwaggerAPISet to the APIs that the expander will handle

func (*SwaggerResourceExpander) Delete added in v1.1.363

func (e *SwaggerResourceExpander) Delete(context context.Context, item *TreeNode) (bool, error)

Delete attempts to delete the item. Returns true if deleted, false if not handled, an error if an error occurred attempting to delete

func (*SwaggerResourceExpander) DoesExpand added in v1.0.247

func (e *SwaggerResourceExpander) DoesExpand(ctx context.Context, currentItem *TreeNode) (bool, error)

DoesExpand checks if this is an RG

func (*SwaggerResourceExpander) Expand added in v1.0.247

func (e *SwaggerResourceExpander) Expand(ctx context.Context, currentItem *TreeNode) ExpanderResult

Expand returns Resources in the RG

func (*SwaggerResourceExpander) GetAPISet added in v1.1.363

func (e *SwaggerResourceExpander) GetAPISet(id string) *SwaggerAPISet

GetAPISet returns a SwaggerAPISet by id

func (*SwaggerResourceExpander) Name added in v1.0.247

func (e *SwaggerResourceExpander) Name() string

Name returns the name of the expander

type TreeNode

type TreeNode struct {
	Parentid            string                // The ID of the parent resource
	ID                  string                // The ID of the resource in ARM
	Name                string                // The name of the object returned by the API
	Display             string                // The Text used to draw the object in the list
	ExpandURL           string                // The URL to call to expand the item
	ItemType            string                // The type of item either subscription, resourcegroup, resource, deployment or action
	ExpandReturnType    string                // The type of the items returned by the expandURL
	DeleteURL           string                // The URL to call to delete the current resource
	Namespace           string                // The ARM Namespace of the item eg StorageAccount
	ArmType             string                // The ARM type of the item eg Microsoft.Storage/StorageAccount
	Metadata            map[string]string     // Metadata is used to pass arbritray data between `Expander`'s
	SubscriptionID      string                // The SubId of this item
	StatusIndicator     string                // Displays the resources status
	SwaggerResourceType *swagger.ResourceType // caches the swagger ResourceType to avoid repeated lookups
}

TreeNode is an item in the ListWidget

Jump to

Keyboard shortcuts

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