handlers

package
v1.1.307 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: MIT Imports: 18 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 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 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 ExpanderResult

type ExpanderResult struct {
	Response          string
	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 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 SwaggerResourceExpander added in v1.0.247

type SwaggerResourceExpander struct {
	ResourceTypes []SwaggerResourceType
	// contains filtered or unexported fields
}

SwaggerResourceExpander expands resource under an AppService

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) Name added in v1.0.247

func (e *SwaggerResourceExpander) Name() string

Name returns the name of the expander

type SwaggerResourceType added in v1.1.58

type SwaggerResourceType struct {
	Display        string
	Endpoint       *endpoints.EndpointInfo
	Verb           string
	DeleteEndpoint *endpoints.EndpointInfo
	PatchEndpoint  *endpoints.EndpointInfo
	PutEndpoint    *endpoints.EndpointInfo
	Children       []SwaggerResourceType // Children are auto-loaded (must be able to build the URL => no additional template URL values)
	SubResources   []SwaggerResourceType // SubResources are not auto-loaded (these come from the request to the endpoint)
}

SwaggerResourceType holds information about resources that can be displayed

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 *SwaggerResourceType // 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