handlers

package
v1.0.247 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

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

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

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

Variables

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

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

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

ResourceType holds information about resources that can be displayed

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 []ResourceType
	// 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 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 *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