client

package
v0.0.0-...-925ca1e Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ActivityLogsAPIVersion = "2017-03-01-preview"

Variables

This section is empty.

Functions

This section is empty.

Types

type AppInfo

type AppInfo struct {
	Name   string
	Owners []string
}

type CallerType

type CallerType string
const (
	CallerTypeUser CallerType = "user"
	CallerTypeApp  CallerType = "app"
)

type Client

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

func New

func New(subscriptionId string, credential azcore.TokenCredential, option *arm.ClientOptions) (*Client, error)

func (*Client) GetAppInfo

func (c *Client) GetAppInfo(ctx context.Context, id string) (*AppInfo, error)

GetAppInfo gets the AAD application's information by its obejct id.

func (*Client) List

func (c *Client) List(ctx context.Context, filter *Filter) (Events, error)

List lists the activity events, with resource id further filtered by the filter option, and any application based caller will be enriched by its display name.

type EventCaller

type EventCaller interface {
	// CallerIdentifier returns name for the user type; object id for the app type.
	CallerIdentifier() string
}

type EventCallerApp

type EventCallerApp struct {
	Type     CallerType `json:"type"`
	ObjectId string     `json:"object_id"`
	Name     string     `json:"name"`
	Owners   []string   `json:"owners"`
}

func (*EventCallerApp) CallerIdentifier

func (c *EventCallerApp) CallerIdentifier() string

type EventCallerUser

type EventCallerUser struct {
	Type CallerType `json:"type"`
	Name string     `json:"name"`
}

func (*EventCallerUser) CallerIdentifier

func (c *EventCallerUser) CallerIdentifier() string

type EventData

type EventData struct {
	armmonitor.EventData
	// contains filtered or unexported fields
}

func (EventData) GetCaller

func (d EventData) GetCaller() EventCaller

type EventGroup

type EventGroup struct {
	// The Azure resource id
	Id string
	// Events that are sorted by `.eventTimestamp`
	Events []EventData
}

type EventGroups

type EventGroups map[string]EventGroup

type Events

type Events []EventData

func (Events) Group

func (events Events) Group() EventGroups

Group groups events by resource id with events sorted by timestamp.

type Filter

type Filter struct {
	ResourceId        string
	ResourceGroupName string
	ResourceTypes     []string
	Caller            string
	// contains filtered or unexported fields
}

func NewFilter

func NewFilter(opt *FilterOption) *Filter

func (Filter) Match

func (f Filter) Match(resourceId string) (bool, error)

Match is used to match the resource id of the event being returned by the List call. This is because some of the events returns resources beyond. E.g. Querying by resourceTypes of resource group can return resources within it.

(It seems the resourceTypes filter applies to the authZ scope of the operation).

func (Filter) String

func (f Filter) String() string

type FilterOption

type FilterOption struct {
	// ResourceId can't be resource group id. Use ResourceGroupName instead.
	ResourceId string

	// The name of the resource group
	ResourceGroupName string

	// ResourceTypes is a list of resource types (in the form of "Microsoft.Foo/bars/bazs").
	// E.g. Microsoft.Resources/subscriptions/resourceGroups
	ResourceTypes []string

	// The object id of the caller
	Caller string
}

Jump to

Keyboard shortcuts

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