tracker

package
v0.5.10 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Package tracker provides operation records for cloud service resources.

Example to List Tracker

listTracker := tracker.ListOpts{}
allTracker, err := tracker.List(client,listTracker)
if err != nil {
	panic(err)
}
fmt.Println(allTracker)

Example to Create a Tracker

createTracker:=tracker.CreateOpts{
	BucketName: "obs-e51d",
	FilePrefixName: "mytracker",
	SimpleMessageNotification:tracker.SimpleMessageNotification{
		IsSupportSMN: true,
		TopicID: "urn:smn:eu-de:626ce20e52a346c090b09cffc3e038e5:c2c-topic",
		IsSendAllKeyOperation: false,
		Operations: []string{"login"},
		NeedNotifyUserList: []string{"user1","user2"},
}}
out,err:=tracker.Create(client, createTracker).Extract()
fmt.Println(out)
fmt.Println(err)

Example to Update a Tracker

updateTracker:=tracker.UpdateOpts{
	BucketName : "ciros-img",
	FilePrefixName : "mytracker",
	Status : "disabled",
	SimpleMessageNotification:tracker.SimpleMessageNotification{
		IsSupportSMN: false,
		TopicID: "urn:smn:eu-de:626ce20e52a346c090b09cffc3e038e5:c2c-topic",
		IsSendAllKeyOperation:false,
		Operations: []string{"delete","create","login"},
		NeedNotifyUserList:[]string{"user1","user2"},
	},
	   }
out,err:=tracker.Update(client, updateTracker).Extract()
fmt.Println(out)

Example to Delete a Tracker

out:= tracker.Delete(client).ExtractErr()
fmt.Println(out)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOpts

type CreateOpts struct {
	BucketName     string `json:"bucket_name" required:"true"`
	FilePrefixName string `json:"file_prefix_name,omitempty"`
}

CreateOpts contains the options for create a Tracker. This object is passed to tracker.Create().

func (CreateOpts) ToTrackerCreateMap

func (opts CreateOpts) ToTrackerCreateMap() (map[string]interface{}, error)

ToTrackerCreateMap assembles a request body based on the contents of a CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToTrackerCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateOptsWithSMN

type CreateOptsWithSMN struct {
	BucketName                string                    `json:"bucket_name" required:"true"`
	FilePrefixName            string                    `json:"file_prefix_name,omitempty"`
	SimpleMessageNotification SimpleMessageNotification `json:"smn,omitempty"`
}

CreateOptsWithSMN contains the options for create a Tracker. This object is passed to tracker.Create().

func (CreateOptsWithSMN) ToTrackerCreateMap

func (opts CreateOptsWithSMN) ToTrackerCreateMap() (map[string]interface{}, error)

ToTrackerCreateMap assembles a request body based on the contents of a CreateOpts.

type CreateResult

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

func Create

func Create(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create will create a new tracker based on the values in CreateOpts. To extract the tracker name from the response, call the Extract method on the CreateResult.

func (CreateResult) Extract

func (r CreateResult) Extract() (*Tracker, error)

Extract will get the tracker object from the commonResult

func (CreateResult) ExtractTracker

func (r CreateResult) ExtractTracker() ([]Tracker, error)

ExtractTracker accepts a Page struct, specifically a TrackerPage struct, and extracts the elements into a slice of Tracker structs. In other words, a generic collection is mapped into a relevant slice.

type DeleteResult

type DeleteResult struct {
	golangsdk.ErrResult
}

func Delete

func Delete(client *golangsdk.ServiceClient) (r DeleteResult)

Delete will permanently delete a particular tracker.

type ListOpts

type ListOpts struct {
	TrackerName    string `q:"tracker_name"`
	BucketName     string
	FilePrefixName string
	Status         string
}

ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the attributes you want to see returned.

type ListResult

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

func (ListResult) Extract

func (r ListResult) Extract() (*Tracker, error)

Extract will get the tracker object from the commonResult

func (ListResult) ExtractTracker

func (r ListResult) ExtractTracker() ([]Tracker, error)

ExtractTracker accepts a Page struct, specifically a TrackerPage struct, and extracts the elements into a slice of Tracker structs. In other words, a generic collection is mapped into a relevant slice.

type SimpleMessageNotification

type SimpleMessageNotification struct {
	IsSupportSMN          bool     `json:"is_support_smn"`
	TopicID               string   `json:"topic_id"`
	Operations            []string `json:"operations,omitempty"`
	IsSendAllKeyOperation bool     `json:"is_send_all_key_operation"`
	NeedNotifyUserList    []string `json:"need_notify_user_list,omitempty"`
}

type Tracker

type Tracker struct {
	Status                    string                    `json:"status"`
	BucketName                string                    `json:"bucket_name"`
	FilePrefixName            string                    `json:"file_prefix_name"`
	TrackerName               string                    `json:"tracker_name"`
	SimpleMessageNotification SimpleMessageNotification `json:"smn"`
}

func FilterTracker

func FilterTracker(tracker []Tracker, opts ListOpts) ([]Tracker, error)

func List

func List(client *golangsdk.ServiceClient, opts ListOpts) ([]Tracker, error)

List returns collection of Tracker. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

type TrackerPage

type TrackerPage struct {
	pagination.LinkedPageBase
}

type UpdateOpts

type UpdateOpts struct {
	Status         string `json:"status,omitempty"`
	BucketName     string `json:"bucket_name" required:"true"`
	FilePrefixName string `json:"file_prefix_name,omitempty"`
}

UpdateOpts contains all the values needed to update a tracker

func (UpdateOpts) ToTrackerUpdateMap

func (opts UpdateOpts) ToTrackerUpdateMap() (map[string]interface{}, error)

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToTrackerUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateOptsWithSMN

type UpdateOptsWithSMN struct {
	Status                    string                    `json:"status,omitempty"`
	BucketName                string                    `json:"bucket_name" required:"true"`
	FilePrefixName            string                    `json:"file_prefix_name,omitempty"`
	SimpleMessageNotification SimpleMessageNotification `json:"smn,omitempty"`
}

UpdateOptsWithSMN contains all the values needed to update a tracker

func (UpdateOptsWithSMN) ToTrackerUpdateMap

func (opts UpdateOptsWithSMN) ToTrackerUpdateMap() (map[string]interface{}, error)

ToTrackerUpdateMap builds an update body based on UpdateOpts.

type UpdateResult

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

func Update

func Update(client *golangsdk.ServiceClient, opts UpdateOptsBuilder) (r UpdateResult)

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*Tracker, error)

Extract will get the tracker object from the commonResult

func (UpdateResult) ExtractTracker

func (r UpdateResult) ExtractTracker() ([]Tracker, error)

ExtractTracker accepts a Page struct, specifically a TrackerPage struct, and extracts the elements into a slice of Tracker structs. In other words, a generic collection is mapped into a relevant slice.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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