Documentation
¶
Overview ¶
* moesifapi-go
* moesifapi-go
* moesifapi-go
Index ¶
- Constants
- Variables
- func Template(t string, vars map[string]string) string
- type API
- type BodyTemplate
- type Client
- func (c *Client) Close()
- func (c *Client) CreateEvent(event *models.EventModel) (http.Header, error)
- func (c *Client) CreateEventsBatch(events []*models.EventModel) (http.Header, error)
- func (c *Client) Flush()
- func (c *Client) GetAppConfig() (*http.Response, error)
- func (c *Client) GetGovernanceRules() (r GovernanceRulesResponse, err error)
- func (c *Client) QueueCompanies(u []*models.CompanyModel) error
- func (c *Client) QueueCompany(u *models.CompanyModel) error
- func (c *Client) QueueEvent(e *models.EventModel) error
- func (c *Client) QueueEvents(e []*models.EventModel) error
- func (c *Client) QueueSubscription(u *models.SubscriptionModel) error
- func (c *Client) QueueSubscriptions(u []*models.SubscriptionModel) error
- func (c *Client) QueueUser(u *models.UserModel) error
- func (c *Client) QueueUsers(u []*models.UserModel) error
- func (c *Client) SendDataToMoesif(body []byte, rawPath string)
- func (c *Client) SetEventsHeaderCallback(header string, callback func(string))
- func (c *Client) UpdateCompaniesBatch(companies []*models.CompanyModel) error
- func (c *Client) UpdateCompany(company *models.CompanyModel) error
- func (c *Client) UpdateSubscription(subscription *models.SubscriptionModel) error
- func (c *Client) UpdateSubscriptionsBatch(subscriptions []*models.SubscriptionModel) error
- func (c *Client) UpdateUser(user *models.UserModel) error
- func (c *Client) UpdateUsersBatch(users []*models.UserModel) error
- type GovernanceRule
- type GovernanceRulesResponse
- type RegexCondition
- type RegexConditionsAnd
- type ResponseOverrides
- type Variable
Constants ¶
View Source
const Version string = "1.0.6"
* Version of this lib
Variables ¶
View Source
var Config = config{}
Functions ¶
Types ¶
type API ¶
type API interface {
/**
* Queue Single API Event Call to be created
* @param *models.EventModel body parameter: Required
* @return Returns the response from the API call
*/
QueueEvent(*models.EventModel) error
/**
* Queue multiple API Events to be added
* @param []*models.EventModel body parameter: Required
* @return Returns the response from the API call
*/
QueueEvents([]*models.EventModel) error
/**
* Queue Single User to be updated
* @param *models.UserModel body parameter: Required
* @return Returns the response from the API call
*/
QueueUser(*models.UserModel) error
/**
* Queue multiple Users to be updated
* @param []*models.UserModel body parameter: Required
* @return Returns the response from the API call
*/
QueueUsers([]*models.UserModel) error
/**
* Queue Single Company to be added
* @param *models.CompanyModel body parameter: Required
* @return Returns the response from the API call
*/
QueueCompany(*models.CompanyModel) error
/**
* Queue multiple companies to be added
* @param []*models.CompanyModel body parameter: Required
* @return Returns the response from the API call
*/
QueueCompanies([]*models.CompanyModel) error
/**
* Queue Single Subscription to be added
* @param *models.SubscriptionModel body parameter: Required
* @return Returns the response from the API call
*/
QueueSubscription(*models.SubscriptionModel) error
/**
* Queue multiple Subscriptions to be added
* @param []*models.SubscriptionModel body parameter: Required
* @return Returns the response from the API call
*/
QueueSubscriptions([]*models.SubscriptionModel) error
/**
* Add Single API Event Call
* @param *models.EventModel body parameter: Required
* @return Returns the response from the API call
*/
CreateEvent(*models.EventModel) (http.Header, error)
/**
* Add multiple API Events in a single batch (batch size must be less than 250kb)
* @param []*models.EventModel body parameter: Required
* @return Returns the response from the API call
*/
CreateEventsBatch([]*models.EventModel) (http.Header, error)
/**
* Update a Single User
* @param *models.UserModel body parameter: Required
* @return Returns the response from the API call
*/
UpdateUser(*models.UserModel) error
/**
* Update multiple Users in a single batch (batch size must be less than 250kb)
* @param []*models.UserModel body parameter: Required
* @return Returns the response from the API call
*/
UpdateUsersBatch([]*models.UserModel) error
/**
* Get Application configuration
* @param nil body parameter: Required
* @return Returns the response from the API call
*/
GetAppConfig() (*http.Response, error)
/**
* Update a Single Company
* @param *models.CompanyModel body parameter: Required
* @return Returns the response from the API call
*/
UpdateCompany(*models.CompanyModel) error
/**
* Update multiple companies in a single batch (batch size must be less than 250kb)
* @param []*models.CompanyModel body parameter: Required
* @return Returns the response from the API call
*/
UpdateCompaniesBatch([]*models.CompanyModel) error
/**
* Update a Single Subscription
* @param *models.SubscriptionModel body parameter: Required
* @return Returns the response from the API call
*/
UpdateSubscription(*models.SubscriptionModel) error
/**
* Update multiple Subscriptions in a single batch (batch size must be less than 250kb)
* @param []*models.SubscriptionModel body parameter: Required
* @return Returns the response from the API call
*/
UpdateSubscriptionsBatch([]*models.SubscriptionModel) error
// GetGovernanceRules gets the collector's /v1/rules endpoint which contains
// regex governance rules and user/company governance rule templates which are
// templated with individual user and company info from the /v1/config endpoint
GetGovernanceRules() (GovernanceRulesResponse, error)
// SetEventsHeaderCallback sets a Moesif API response header value and callback
// function which is called with
SetEventsHeaderCallback(string, func(string))
Flush()
Close()
}
* Interface for the Client
type BodyTemplate ¶ added in v1.1.0
type BodyTemplate string
func (*BodyTemplate) UnmarshalJSON ¶ added in v1.1.0
func (b *BodyTemplate) UnmarshalJSON(data []byte) error
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
* Client structure as interface implementation
func (*Client) CreateEvent ¶
*
- Add Single API Event Call
- @param *models.EventModel body parameter: Required
- @return Returns the response from the API call
func (*Client) CreateEventsBatch ¶
*
- Add multiple API Events in a single batch (batch size must be less than 250kb)
- @param []*models.EventModel body parameter: Required
- @return Returns the response from the API call
func (*Client) GetAppConfig ¶
*
- Get Application configuration
- @param nil parameter: Required
- @return Returns the response from the API call
func (*Client) GetGovernanceRules ¶ added in v1.1.0
func (c *Client) GetGovernanceRules() (r GovernanceRulesResponse, err error)
func (*Client) QueueCompanies ¶
func (c *Client) QueueCompanies(u []*models.CompanyModel) error
*
- Queue multiple companies to be added
- @param []*models.UserModel body parameter: Required
- @return Returns the response from the API call
func (*Client) QueueCompany ¶
func (c *Client) QueueCompany(u *models.CompanyModel) error
*
- Queue Single Company to be added
- @param *models.CompanyModel body parameter: Required
- @return Returns the response from the API call
func (*Client) QueueEvent ¶
func (c *Client) QueueEvent(e *models.EventModel) error
*
- Queue Single API Event Call to be created
- @param *models.EventModel body parameter: Required
- @return Returns the response from the API call
func (*Client) QueueEvents ¶
func (c *Client) QueueEvents(e []*models.EventModel) error
*
- Queue multiple API Events to be added
- @param []*models.EventModel body parameter: Required
- @return Returns the response from the API call
func (*Client) QueueSubscription ¶ added in v1.1.5
func (c *Client) QueueSubscription(u *models.SubscriptionModel) error
func (*Client) QueueSubscriptions ¶ added in v1.1.5
func (c *Client) QueueSubscriptions(u []*models.SubscriptionModel) error
func (*Client) QueueUser ¶
*
- Queue Single User to be updated
- @param *models.UserModel body parameter: Required
- @return Returns the response from the API call
func (*Client) QueueUsers ¶
*
- Queue multiple Users to be updated
- @param []*models.UserModel body parameter: Required
- @return Returns the response from the API call
func (*Client) SendDataToMoesif ¶ added in v1.0.6
func (*Client) SetEventsHeaderCallback ¶ added in v1.1.1
SetEventsHeaderCallback takes a response header name and callback function on SendDataToMoesif, the callback headers are read from the response and passed to the callback functions
func (*Client) UpdateCompaniesBatch ¶
func (c *Client) UpdateCompaniesBatch(companies []*models.CompanyModel) error
*
- Update multiple companies in a single batch (batch size must be less than 250kb)
- @param []*models.CompanyModel body parameter: Required
- @return Returns the response from the API call
func (*Client) UpdateCompany ¶
func (c *Client) UpdateCompany(company *models.CompanyModel) error
*
- Update a Single Company
- @param *models.CompanyModel body parameter: Required
- @return Returns the response from the API call
func (*Client) UpdateSubscription ¶ added in v1.1.5
func (c *Client) UpdateSubscription(subscription *models.SubscriptionModel) error
*
- Update a Single Subscription
- @param *models.SubscriptionModel body parameter: Required
- @return Returns the response from the API call
func (*Client) UpdateSubscriptionsBatch ¶ added in v1.1.5
func (c *Client) UpdateSubscriptionsBatch(subscriptions []*models.SubscriptionModel) error
*
- Update multiple Subscriptions in a single batch (batch size must be less than 250kb)
- @param []*models.SubscriptionModel body parameter: Required
- @return Returns the response from the API call
func (*Client) UpdateUser ¶
*
- Update a Single User
- @param *models.UserModel body parameter: Required
- @return Returns the response from the API call
type GovernanceRule ¶ added in v1.1.0
type GovernanceRule struct {
ID string `json:"_id"`
Name string `json:"name"`
Type string `json:"type"`
Block bool `json:"block"`
ApplyTo string `json:"applied_to"` // "matching" or "not_matching"
ApplyUnidentified bool `json:"applied_to_unidentified"` // true if rule applies to unidentified entities
// RegexConfigOr is a boolean expression tree with a fixed depth of two,
// a slice of slices of regex patterns. The regex rule as a whole is a match,
// evals to true, if one OR more of the top level slice items is true.
// One of the top level slices is a slice of regex patterns to match, and
// one slice is true of one pattern AND the others are all matches.
RegexConfigOr []RegexConditionsAnd `json:"regex_config"`
ResponseOverrides ResponseOverrides `json:"response"`
Variables []Variable `json:"variables"`
OrgID string `json:"org_id"`
AppID string `json:"app_id"`
CreatedAt string `json:"created_at"`
}
implement support for regex AND user/company cohort. Logically both conditions must be true also make example of regex with OR/AND conditions between expressions
type GovernanceRulesResponse ¶ added in v1.1.0
type GovernanceRulesResponse struct {
Rules []GovernanceRule
ETag string
}
type RegexCondition ¶ added in v1.1.0
type RegexConditionsAnd ¶ added in v1.1.0
type RegexConditionsAnd struct {
Conditions []RegexCondition `json:"conditions"`
}
type ResponseOverrides ¶ added in v1.1.0
type ResponseOverrides struct {
Body BodyTemplate `json:"body"`
Headers map[string]string `json:"headers"`
Status int `json:"status"`
}
Click to show internal directories.
Click to hide internal directories.