sub_accounts

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: MIT Imports: 7 Imported by: 1

README

Sub-accounts

Compatible with Logz.io's sub-accounts API.

To create a new sub-account, on a main account.

client, _ := sub_accounts.New(apiToken, apiServerAddress)
subaccount := sub_accounts.CreateOrUpdateSubAccount{
                Email:                  "some@email.test",
                AccountName:            "tf_client_test",
                MaxDailyGB:             1,
                RetentionDays:          1,
                Searchable:             strconv.FormatBool(false),
                Accessible:             strconv.FormatBool(true),
                SharingObjectsAccounts: []int32{},
                DocSizeSetting:         strconv.FormatBool(false),
            }
function func name
create sub-account func (c *SubAccountClient) CreateSubAccount(createSubAccount CreateOrUpdateSubAccount) (*SubAccountCreateResponse, error)
update sub-account func (c *SubAccountClient) UpdateSubAccount(subAccountId int64, updateSubAccount CreateOrUpdateSubAccount) error
delete sub-account func (c *SubAccountClient) DeleteSubAccount(subAccountId int64) error
get sub-account func (c *SubAccountClient) GetSubAccount(subAccountId int64) (*SubAccount, error)
get detailed sub-account func (c *SubAccountClient) GetDetailedSubAccount(subAccountId int64) (*DetailedSubAccount, error)
list sub-accounts func (c *SubAccountClient) ListSubAccounts() ([]SubAccount, error)
list detailed sub-accounts func (c *SubAccountClient) ListDetailedSubAccounts() ([]DetailedSubAccount, error)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountUtilizationSettings added in v1.8.0

type AccountUtilizationSettings struct {
	FrequencyMinutes   int32 `json:"frequencyMinutes"`
	UtilizationEnabled bool  `json:"utilizationEnabled"`
}

type AccountUtilizationSettingsCreateOrUpdate added in v1.8.0

type AccountUtilizationSettingsCreateOrUpdate struct {
	FrequencyMinutes   int32  `json:"frequencyMinutes"`
	UtilizationEnabled string `json:"utilizationEnabled"` // boolean
}

type AccountView added in v1.8.0

type AccountView struct {
	AccountId       int32   `json:"accountId"`
	AccountName     string  `json:"accountName"`
	AccountToken    string  `json:"accountToken"`
	Active          bool    `json:"active"`
	EsIndexPrefix   string  `json:"esIndexPrefix"`
	Flexible        bool    `json:"isFlexible"`
	ReservedDailyGB float32 `json:"reservedDailyGB"`
	MaxDailyGB      float32 `json:"maxDailyGB"`
	RetentionDays   int32   `json:"retentionDays"`
}

type CreateOrUpdateSubAccount added in v1.8.0

type CreateOrUpdateSubAccount struct {
	Email                  string                                   `json:"email,omitempty"`
	AccountName            string                                   `json:"accountName"`
	Flexible               string                                   `json:"isFlexible,omitempty"` // boolean
	ReservedDailyGB        float32                                  `json:"reservedDailyGB,omitempty"`
	MaxDailyGB             float32                                  `json:"maxDailyGB"`
	RetentionDays          int32                                    `json:"retentionDays"`
	Searchable             string                                   `json:"searchable,omitempty"` // boolean
	Accessible             string                                   `json:"accessible,omitempty"` // boolean
	SharingObjectsAccounts []int32                                  `json:"sharingObjectsAccounts"`
	DocSizeSetting         string                                   `json:"docSizeSetting"` // boolean
	UtilizationSettings    AccountUtilizationSettingsCreateOrUpdate `json:"utilizationSettings"`
}

type DailyUsagesListObject added in v1.8.0

type DailyUsagesListObject struct {
	Usage []LHDailyCount `json:"usage"`
}

type DetailedSubAccount added in v1.8.0

type DetailedSubAccount struct {
	SubAccountRelation     SubAccountRelationObject   `json:"subAccountRelation"`
	Account                AccountView                `json:"account"`
	SharingObjectsAccounts []AccountView              `json:"sharingObjectsAccounts"`
	UtilizationSettings    AccountUtilizationSettings `json:"utilizationSettings"`
	DailyUsagesList        DailyUsagesListObject      `json:"dailyUsagesList"`
	DocSizeSetting         bool                       `json:"docSizeSetting"`
}

type FieldError added in v1.8.0

type FieldError struct {
	Field   string
	Message string
}

func (FieldError) Error added in v1.8.0

func (e FieldError) Error() string

type LHDailyCount added in v1.8.0

type LHDailyCount struct {
	Date  int64 `json:"date"`
	Bytes int64 `json:"bytes"`
}

type SharingAccount added in v1.8.0

type SharingAccount struct {
	AccountId   int32  `json:"accountId"`
	AccountName string `json:"accountName"`
}

type SubAccount

type SubAccount struct {
	AccountId              int32                      `json:"accountId"`
	Email                  string                     `json:"email"`
	AccountName            string                     `json:"accountName"`
	Flexible               bool                       `json:"isFlexible"`
	ReservedDailyGB        float32                    `json:"reservedDailyGB"`
	MaxDailyGB             float32                    `json:"maxDailyGB"`
	RetentionDays          int32                      `json:"retentionDays"`
	Searchable             bool                       `json:"searchable"`
	Accessible             bool                       `json:"accessible"`
	DocSizeSetting         bool                       `json:"docSizeSetting"`
	SharingObjectsAccounts []SharingAccount           `json:"sharingObjectsAccounts"`
	UtilizationSettings    AccountUtilizationSettings `json:"utilizationSettings"`
}

type SubAccountClient

type SubAccountClient struct {
	*client.Client
	// contains filtered or unexported fields
}

func New

func New(apiToken string, baseUrl string) (*SubAccountClient, error)

Creates a new entry point into the sub-account functions, accepts the user's logz.io API token and account Id

func (*SubAccountClient) CreateSubAccount

func (c *SubAccountClient) CreateSubAccount(createSubAccount CreateOrUpdateSubAccount) (*SubAccountCreateResponse, error)

CreateSubAccount creates sub account, return account's id & token if successful, an error otherwise

func (*SubAccountClient) DeleteSubAccount

func (c *SubAccountClient) DeleteSubAccount(subAccountId int64) error

DeleteSubAccount deletes a sub account specified by its unique id, returns an error if a problem is encountered

func (*SubAccountClient) GetDetailedSubAccount

func (c *SubAccountClient) GetDetailedSubAccount(subAccountId int64) (*DetailedSubAccount, error)

GetDetailedSubAccount returns a detailed sub-account given its unique identifier, an error otherwise

func (*SubAccountClient) GetSubAccount

func (c *SubAccountClient) GetSubAccount(subAccountId int64) (*SubAccount, error)

GetSubAccount returns a sub account given its unique identifier, an error otherwise

func (*SubAccountClient) ListDetailedSubAccounts added in v1.8.0

func (c *SubAccountClient) ListDetailedSubAccounts() ([]DetailedSubAccount, error)

ListDetailedSubAccounts returns all the detailed sub-accounts in an array associated with the account identified by the supplied API token, returns an error if any problem occurs during the API call

func (*SubAccountClient) ListSubAccounts

func (c *SubAccountClient) ListSubAccounts() ([]SubAccount, error)

ListSubAccounts returns all the sub-accounts in an array associated with the account identified by the supplied API token, returns an error if any problem occurs during the API call

func (*SubAccountClient) UpdateSubAccount

func (c *SubAccountClient) UpdateSubAccount(subAccountId int64, updateSubAccount CreateOrUpdateSubAccount) error

type SubAccountCreateResponse added in v1.8.0

type SubAccountCreateResponse struct {
	AccountId    int32  `json:"accountId"`
	AccountToken string `json:"accountToken"`
}

type SubAccountRelationObject added in v1.8.0

type SubAccountRelationObject struct {
	OwnerAccountId    int32  `json:"ownerAccountId"`
	SubAccountId      int32  `json:"subAccountId"`
	Searchable        bool   `json:"searchable"`
	Accessible        bool   `json:"accessible"`
	CreatedDate       int64  `json:"createdDate"`
	LastUpdatedDate   int64  `json:"lastUpdatedDate"`
	LastUpdaterUserId int32  `json:"lastUpdaterUserId"`
	Type              string `json:"type"`
}

Jump to

Keyboard shortcuts

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