Documentation
¶
Overview ¶
Package xmatters provides a Go client for interacting with the XMatters REST API.
xMatters is a communication platform that enables enterprises to manage and automate communication with their employees, customers, and other stakeholders during incidents and other critical events. This package allows you to programmatically access and utilize the xMatters REST API to integrate xMatters functionality into your Go applications.
API Documentation:
https://help.xmatters.com/xmapi/
Usage:
// Create a new XMattersAPI client with your API Token
apiToken := "your-api-token"
xmattersClient, err := xmatters.NewWithAPIToken(&apiToken)
if err != nil {
log.Fatal(err)
}
// Use the client to interact with the xMatters REST API
// For example, retrieve information about users:
users, err := xmattersClient.GetPersonList(nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(users)
Index ¶
- Constants
- Variables
- func ContainsMember(member GroupMember, target []*GroupMember) bool
- func StringPtr(value string) *string
- type Device
- type DevicePagination
- type DeviceTimeframe
- type DeviceTimeframePagination
- type GetDevicesParams
- type GetGroupsParams
- type GetPeopleParams
- type GetServicesParams
- type GetSitesParams
- type GetTemplatesParams
- type Group
- type GroupMember
- type GroupMembership
- type GroupMembershipPagination
- type GroupPagination
- type GroupReference
- type GroupRoster
- type Option
- type Pagination
- type PaginationLinks
- type Person
- type PersonPagination
- type PersonReference
- type PushDeviceParams
- type PushGroupParams
- type PushPersonParams
- type PushServiceDependencyParams
- type PushServiceParams
- type PushSiteParams
- type PushTemplateParams
- type QuotaDetails
- type RecipientPointer
- type RecipientReference
- type ReferenceById
- type ReferenceByName
- type RetryPolicy
- type Role
- type RolePagination
- type Service
- type ServiceDependency
- type ServiceDependencyPagination
- type ServiceLink
- type ServiceLinksPagination
- type ServicePagination
- type ServiceReference
- type Shift
- type ShiftEnd
- type ShiftMember
- type ShiftPagination
- type ShiftRecurrence
- type Site
- type SitePagination
- type Template
- type TemplateObject
- type TemplatePagination
- type UserQuotas
- type XMattersAPI
- func (xmatters *XMattersAPI) DeleteDevice(params string) error
- func (xmatters *XMattersAPI) DeleteGroup(groupId string) error
- func (xmatters *XMattersAPI) DeleteGroupMembership(groupId, memberId string) error
- func (xmatters *XMattersAPI) DeleteGroupRoster(groupId string) error
- func (xmatters *XMattersAPI) DeletePerson(personId *string) error
- func (xmatters *XMattersAPI) DeleteService(serviceId string) error
- func (xmatters *XMattersAPI) DeleteServiceDependency(serviceDepId string) error
- func (xmatters *XMattersAPI) DeleteSite(siteId *string) error
- func (xmatters *XMattersAPI) DeleteTemplate(templateId *string) error
- func (xmatters *XMattersAPI) GetDevice(deviceId string) (Device, error)
- func (xmatters *XMattersAPI) GetDeviceList(params GetDevicesParams) ([]*Device, error)
- func (xmatters *XMattersAPI) GetDevicePaginationSet(uri string) ([]*Device, error)
- func (xmatters XMattersAPI) GetGroup(groupId string) (Group, error)
- func (xmatters *XMattersAPI) GetGroupList(params GetGroupsParams) ([]*Group, error)
- func (xmatters *XMattersAPI) GetGroupPaginationSet(uri string) ([]*Group, error)
- func (xmatters *XMattersAPI) GetGroupRoster(groupId string) (GroupRoster, error)
- func (xmatters *XMattersAPI) GetGroupRosterPaginationSet(uri string) (GroupRoster, error)
- func (xmatters *XMattersAPI) GetPerson(personId string) (Person, error)
- func (xmatters *XMattersAPI) GetPersonList(params GetPeopleParams) ([]*Person, error)
- func (xmatters *XMattersAPI) GetPersonPaginationSet(uri string) ([]*Person, error)
- func (xmatters *XMattersAPI) GetService(serviceId string) (Service, error)
- func (xmatters *XMattersAPI) GetServiceDependency(dependencyId string) (ServiceDependency, error)
- func (xmatters *XMattersAPI) GetServiceList(params GetServicesParams) ([]*Service, error)
- func (xmatters *XMattersAPI) GetServicePaginationSet(uri string) ([]*Service, error)
- func (xmatters *XMattersAPI) GetSite(siteId string) (Site, error)
- func (xmatters *XMattersAPI) GetSiteList(params GetSitesParams) ([]*Site, error)
- func (xmatters *XMattersAPI) GetSitePaginationSet(uri string) ([]*Site, error)
- func (xmatters *XMattersAPI) GetTemplate(templateId *string) (Template, error)
- func (xmatters *XMattersAPI) GetTemplateList(params GetTemplatesParams) ([]*Template, error)
- func (xmatters *XMattersAPI) GetUserQuotas() (UserQuotas, error)
- func (xmatters *XMattersAPI) PushDevice(params PushDeviceParams) (Device, error)
- func (xmatters *XMattersAPI) PushGroup(params PushGroupParams) (Group, error)
- func (xmatters *XMattersAPI) PushGroupMembership(groupId string, params *GroupMember) (GroupMember, error)
- func (xmatters *XMattersAPI) PushGroupRoster(groupId string, params []*GroupMember) (GroupRoster, error)
- func (xmatters *XMattersAPI) PushPerson(params PushPersonParams) (Person, error)
- func (xmatters *XMattersAPI) PushService(params PushServiceParams) (Service, error)
- func (xmatters *XMattersAPI) PushServiceDependency(params PushServiceDependencyParams) (ServiceDependency, error)
- func (xmatters *XMattersAPI) PushSite(params PushSiteParams) (Site, error)
- func (xmatters *XMattersAPI) PushTemplate(params PushTemplateParams) (Template, error)
- func (xmatters *XMattersAPI) Request(httpMethod, uri, contentType string, body interface{}) ([]byte, error)
- type XMattersError
Constants ¶
const ( ContentJSON = "application/json" StatusOK = 200 StatusCreated = 201 StatusNoContent = 204 )
Variables ¶
var ( // ErrNoContent is a generic 204 Error output used to return appropriate output to the user after a failed DELETE request. ErrNoContent = XMattersError{ Code: StatusNoContent, Message: "A resource was not found in response to a DELETE request.", Reason: "No Content", } ErrInavlidCredentials = XMattersError{ Code: StatusUnauthorized, Message: "Invalid Credentials", Reason: "Unauthorized", } // ErrNoHostname is a generic Error output used to return appropriate output to the user after a failed request due to missing hostname. ErrNoHostname = XMattersError{ Code: 0, Message: "Missing Hostname", Reason: "Bad Request", } )
var ( Version string = "1" AuthTypeBasic string = "Basic" AuthTypeOAuth string = "OAuth" )
Functions ¶
func ContainsMember ¶
func ContainsMember(member GroupMember, target []*GroupMember) bool
ContainsMember is a helper function that checks if a GroupMember is in a given list of GroupMembers. It takes a GroupMember and a slice of GroupMembers as input and returns true if the member is found in the list, false otherwise. This function is used internally by the PushGroupRoster method to check if a member is already in the group.
Types ¶
type Device ¶
type Device struct {
ID *string `json:"id"`
TargetName *string `json:"targetName,omitempty"`
Country *string `json:"country,omitempty"`
DefaultDevice *bool `json:"defaultDevice,omitempty"`
Delay *int32 `json:"delay,omitempty"`
DeviceType *string `json:"deviceType"`
EmailAddress *string `json:"emailAddress,omitempty"`
ExternalKey *string `json:"externalKey,omitempty"`
ExternallyOwned *bool `json:"externallyOwned,omitempty"`
Name *string `json:"name"`
Owner *PersonReference `json:"owner"`
PhoneNumber *string `json:"phoneNumber,omitempty"`
PIN *string `json:"pin,omitempty"`
PriorityThreshold *string `json:"priorityThreshold,omitempty"`
Sequence *int32 `json:"sequence,omitempty"`
Status *string `json:"status,omitempty"`
TestStatus *string `json:"testStatus,omitempty"`
Timeframes []*DeviceTimeframe `json:"timeframes,omitempty"`
TwoWayDevice *bool `json:"twoWayDevice,omitempty"`
}
Device represents a device in xMatters.
func (*Device) UnmarshalJSON ¶
Custom Unmarshaller for Device to handle embedded timeframes This is necessary because the JSON structure for timeframes is nested within a pagination object.
type DevicePagination ¶
type DevicePagination struct {
Devices []*Device `json:"data,omitempty"`
*Pagination
}
DevicePagination contains a paginated list of devices. It extends the Pagination struct containing links to additional pages.
type DeviceTimeframe ¶
type DeviceTimeframe struct {
Name *string `json:"name" tfsdk:"name"`
StartTime *string `json:"startTime" tfsdk:"start_time"`
DurationInMinutes *int32 `json:"durationInMinutes" tfsdk:"duration_in_minutes"`
Days []*string `json:"days" tfsdk:"days"`
ExcludeHolidays *bool `json:"excludeHolidays" tfsdk:"exclude_holidays"`
}
DeviceTimeframe represents a timeframe during which a device is active and able to receive notifications.
type DeviceTimeframePagination ¶
type DeviceTimeframePagination struct {
*Pagination
Data []*DeviceTimeframe `json:"data,omitempty"`
}
DeviceTimeframePagination contains a paginated list of device timeframes. It extends the Pagination struct containing links to additional pages.
type GetDevicesParams ¶
type GetDevicesParams struct {
Embed string `url:"embed,omitempty"`
DeviceStatus string `url:"deviceStatus,omitempty"`
DeviceType string `url:"deviceType,omitempty"`
DeviceNames string `url:"deviceNames,omitempty"`
}
GetDevicesParams contains available API query parameters for the GetDeviceList method.
type GetGroupsParams ¶
type GetGroupsParams struct {
Embed string `url:"embed,omitempty"`
// Provider Search Object
Terms string `url:"search,omitempty"`
Fields string `url:"fields,omitempty"`
Operand string `url:"operand,omitempty"`
// Provider Filters Object
GroupType string `url:"groupType,omitempty"`
MemberExists string `url:"member.exists,omitempty"`
Members string `url:"members,omitempty"`
Sites string `url:"sites,omitempty"`
Status string `url:"status,omitempty"`
Supervisors string `url:"supervisors,omitempty"`
// Provider Options Object
SortBy string `url:"sortBy,omitempty"`
SortOrder string `url:"sortOrder,omitempty"`
}
GetGroupsParams contains available API query parameters for the GetGroupList method.
type GetPeopleParams ¶
type GetPeopleParams struct {
Embed string `url:"embed,omitempty"`
// Provider Search Object
Terms string `url:"search,omitempty"`
Fields string `url:"fields,omitempty"`
Operand string `url:"operand,omitempty"`
// Provider Filters Object
CreatedAfter string `url:"createdAfter,omitempty"`
CreatedBefore string `url:"createdBefore,omitempty"`
CreatedFrom string `url:"createdFrom,omitempty"`
CreatedTo string `url:"createdTo,omitempty"`
DevicesExists *bool `url:"devices.exists,omitempty"`
DevicesEmailExists *bool `url:"devices.email.exists,omitempty"`
DevicesFailsafe *bool `url:"devices.failsafe.exists,omitempty"`
DevicesMobile *bool `url:"devices.mobile.exists,omitempty"`
DevicesSMS *bool `url:"devices.sms.exists,omitempty"`
DevicesVoice *bool `url:"devices.voice.exists,omitempty"`
DevicesStatus string `url:"devices.status,omitempty"`
DevicesTestStatus string `url:"devices.testStatus,omitempty"`
EmailAddress string `url:"emailAddress,omitempty"`
FirstName string `url:"firstName,omitempty"`
Groups string `url:"groups,omitempty"`
GroupsExists *bool `url:"groups.exists,omitempty"`
LastName string `url:"lastName,omitempty"`
LicenseType string `url:"licenseType,omitempty"`
PhoneNumber string `url:"phoneNumber,omitempty"`
Roles string `url:"roles,omitempty"`
Site string `url:"site,omitempty"`
Status string `url:"status,omitempty"`
Supervisors string `url:"supervisors,omitempty"`
SupervisorsExists *bool `url:"supervisors.exists,omitempty"`
TargetName string `url:"targetName,omitempty"`
WebLogin string `url:"webLogin,omitempty"`
// Provider Options Object
SortBy string `url:"sortBy,omitempty"`
SortOrder string `url:"sortOrder,omitempty"`
}
GetPeopleParams contains available API query parameters for the GetPersonList method.
type GetServicesParams ¶
type GetServicesParams struct {
Search string `url:"search,omitempty"`
Fields string `url:"fields,omitempty"`
Operand string `url:"operand,omitempty"`
OwnedBy string `url:"ownedBy,omitempty"`
}
GetServicesParams contains available API query parameters for the GetServiceList method.
type GetSitesParams ¶
type GetSitesParams struct {
Search string `url:"search,omitempty"`
Operand string `url:"operand,omitempty"`
Fields string `url:"fields,omitempty"`
Country string `url:"country,omitempty"`
Geocoded *bool `url:"geocoded,omitempty"`
Status string `url:"status,omitempty"`
}
GetSitesParams contains available API query parameters for the GetSiteList method.
type GetTemplatesParams ¶
type GetTemplatesParams struct {
Search string `url:"search,omitempty"`
Fields string `url:"fields,omitempty"`
Operand string `url:"operand,omitempty"`
OwnedBy string `url:"ownedBy,omitempty"`
}
GetTemplatesParams represents parameters for getting a list of templates.
type Group ¶
type Group struct {
ID *string `json:"id"`
TargetName *string `json:"targetName"`
Status *string `json:"status"`
Description *string `json:"description,omitempty"`
GroupType *string `json:"groupType,omitempty"`
AllowDuplicates *bool `json:"allowDuplicates,omitempty"`
Timezone *string `json:"timezone,omitempty"`
Site *ReferenceById `json:"site,omitempty"`
ObservedByAll *bool `json:"observedByAll,omitempty"`
Observers []*ReferenceByName `json:"observers,omitempty"`
UseDefaultDevices *bool `json:"useDefaultDevices,omitempty"`
Supervisors []*ReferenceById `json:"supervisors,omitempty"`
Services []*Service `json:"services,omitempty"`
ExternalKey *string `json:"externalKey,omitempty"`
ExternallyOwned *bool `json:"externallyOwned,omitempty"`
}
Group represents a group in xMatters.
func (*Group) UnmarshalJSON ¶
Custom Unmarshaller for Group to handle embedded observers, supervisors, and services This is necessary because the JSON structure for these fields are nested within pagination objects.
type GroupMember ¶
type GroupMember struct {
ID *string `json:"id" tfsdk:"id"`
MemberType *string `json:"recipientType" tfsdk:"member_type"`
}
GroupMember represents a shorthand version of a group member. It contains the ID and type of the member, which can be a person, device, or group.
type GroupMembership ¶
type GroupMembership struct {
Group GroupReference `json:"group" validate:"required"`
Member RecipientReference `json:"member" validate:"required"`
Shifts ShiftPagination `json:"shifts,omitempty"`
}
GroupMembership represents the membership of a person, group, or device within this group. It contains a reference to the group and member, and for On-Call groups may optionally contain information about the specific shifts the member belongs to.
type GroupMembershipPagination ¶
type GroupMembershipPagination struct {
Pagination
Memberships []*GroupMembership `json:"data"`
}
GroupMembershipPagination contains a paginated list of group memberships. It extends the Pagination struct containing links to additional pages.
type GroupPagination ¶
type GroupPagination struct {
*Pagination
Groups []*Group `json:"data,omitempty"`
}
GroupPagination contains a paginated list of groups. It extends the Pagination struct containing links to additional pages.
type GroupReference ¶
type GroupReference struct {
ID *string `json:"id,omitempty"`
TargetName *string `json:"targetName,omitempty"`
RecipientType *string `json:"recipientType,omitempty"`
GroupType *string `json:"groupType,omitempty"`
}
GroupReference represents a shorthand version of a group in xMatters.
type GroupRoster ¶
type GroupRoster struct {
ID *string `json:"groupId"`
Group *GroupReference `json:"group"`
Members []*GroupMember
}
GroupRoster represents a group roster in xMatters.
type Option ¶
type Option func(*XMattersAPI) error
Option is a functional option for configuring the XMattersAPI client
func Debug ¶
Debug is an option for configuring the XMattersAPI client to enable or disable debugging mode. When debugging is enabled, additional information and logs may be output to aid in troubleshooting. Use this option by passing a pointer to a boolean indicating whether debugging should be enabled. Example usage:
client := NewXMattersAPI(Debug(true)) // Debug mode is now enabled for the client.
func WithBaseURL ¶
WithBaseURL overrides the default base URL used for API calls
func WithHTTPClient ¶
HTTPClient accepts a custom *http.Client for making XMattersAPI calls
func WithHeaders ¶
Headers allows you to set custom HTTP headers when making XMattersAPI calls
func WithRateLimit ¶
WithRateLimit applies a non-default rate limit to client API requests If not specified the default of 4rps will be applied.
type Pagination ¶
type Pagination struct {
Count *int64 `json:"count"`
Total *int64 `json:"total"`
Links *PaginationLinks `json:"links"`
}
Pagination represents a page of results. Use the links in the links field to retrieve the rest of the result set.
type PaginationLinks ¶
type PaginationLinks struct {
Next *string `json:"next"`
Previous *string `json:"previous"`
Self *string `json:"self"`
}
PaginationLinks provides links to the current, previous, and next pages of a paginated result set.
type Person ¶
type Person struct {
ID *string `json:"id"`
TargetName *string `json:"targetName"`
FirstName *string `json:"firstName"`
LastName *string `json:"lastName"`
Roles []*Role `json:"roles"`
Status *string `json:"status,omitempty"`
WebLogin *string `json:"webLogin,omitempty"`
Site *ReferenceById `json:"site,omitempty"`
Timezone *string `json:"timezone,omitempty"`
Language *string `json:"language,omitempty"`
Supervisors []*Person `json:"supervisors,omitempty"`
PhoneLogin *string `json:"phoneLogin,omitempty"`
LicenseType *string `json:"licenseType,omitempty"`
ExternalKey *string `json:"externalKey,omitempty"`
ExternallyOwned *bool `json:"externallyOwned,omitempty"`
LastLogin *string `json:"lastLogin,omitempty"`
}
Person represents a person in xMatters.
func (*Person) UnmarshalJSON ¶
Custom Unmarshaller for Person to handle embedded roles and supervisors This is necessary because the JSON structure for roles and supervisors is nested within pagination objects.
type PersonPagination ¶
type PersonPagination struct {
*Pagination
People []*Person `json:"data"`
}
PersonPagination contains a paginated list of people. It extends the Pagination struct containing links to additional pages.
type PersonReference ¶
type PersonReference struct {
ID *string `json:"id"`
TargetName *string `json:"targetName"`
FirstName *string `json:"firstName"`
LastName *string `json:"lastName"`
}
PersonReference represents a shorthand version of a person in xMatters.
type PushDeviceParams ¶
type PushDeviceParams struct {
// Required Fields
DeviceType string `json:"deviceType"`
Name string `json:"name"`
Owner string `json:"owner"`
PriorityThreshold string `json:"priorityThreshold"`
TestStatus string `json:"testStatus"`
Timeframes []*DeviceTimeframe `json:"timeframes"`
// Optional Fields
ID string `json:"id,omitempty"`
Country string `json:"country,omitempty"`
DefaultDevice *bool `json:"defaultDevice,omitempty"`
Delay *int32 `json:"delay"`
EmailAddress string `json:"emailAddress,omitempty"`
ExternalKey *string `json:"externalKey"`
ExternallyOwned *bool `json:"externallyOwned"`
PhoneNumber string `json:"phoneNumber,omitempty"`
PIN string `json:"pin"`
Status string `json:"status,omitempty"`
TwoWayDevice *bool `json:"twoWayDevice"`
}
PushDeviceParams contains available API body parameters for the PushDevice method.
type PushGroupParams ¶
type PushGroupParams struct {
ID string `json:"id,omitempty"`
TargetName string `json:"targetName"`
AllowDuplicates *bool `json:"allowDuplicates,omitempty"`
Description string `json:"description,omitempty"`
ExternalKey string `json:"externalKey,omitempty"`
ExternallyOwned *bool `json:"externallyOwned,omitempty"`
GroupType string `json:"groupType,omitempty"`
ObservedByAll *bool `json:"observedByAll,omitempty"`
Observers []*ReferenceByName `json:"observers,omitempty"`
Site string `json:"site,omitempty"`
Status string `json:"status,omitempty"`
UseDefaultDevices *bool `json:"useDefaultDevices,omitempty"`
Supervisors []*ReferenceById `json:"supervisors,omitempty"`
}
PushGroupParams contains available API body parameters for the PushGroup method.
type PushPersonParams ¶
type PushPersonParams struct {
// Required Fields
TargetName string `json:"targetName"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Roles []*string `json:"roles"`
LicenseType string `json:"licenseType"`
Site string `json:"site"`
Language string `json:"language"`
Supervisors []*string `json:"supervisors"`
Timezone string `json:"timezone"`
WebLogin string `json:"webLogin"`
// Optional Fields
ID string `json:"id,omitempty"`
Status string `json:"status,omitempty"`
PhoneLogin *string `json:"phoneLogin"`
PhonePin string `json:"phonePin,omitempty"`
ExternalKey *string `json:"externalKey"`
ExternallyOwned *bool `json:"externallyOwned"`
}
PushPersonParams contains available API body parameters for the PushPerson method.
type PushServiceDependencyParams ¶
type PushServiceDependencyParams struct {
ID string `json:"id"`
ServiceID string `json:"serviceId"`
DependentServiceID string `json:"dependentServiceId"`
}
PushServiceDependencyParams contains available API body parameters for the PushServiceDependency method.
type PushServiceParams ¶
type PushServiceParams struct {
ID string `json:"id,omitempty"`
TargetName string `json:"targetName"`
Description *string `json:"description"`
ServiceType string `json:"serviceType"`
ServiceTier *string `json:"serviceTier"`
OwnedBy *GroupReference `json:"ownedBy"`
ServiceLinks []*ServiceLink `json:"serviceLinks"`
}
PushServiceParams contains available API body parameters for the PushService method.
type PushSiteParams ¶
type PushSiteParams struct {
// Required Fields
Name string `json:"name"`
Country string `json:"country"`
Language string `json:"language"`
Timezone string `json:"timezone"`
// Optional Fields
Address1 *string `json:"address1"`
Address2 *string `json:"address2"`
City *string `json:"city"`
ID string `json:"id,omitempty"`
Latitude *float64 `json:"latitude"`
Longitude *float64 `json:"longitude"`
PostalCode *string `json:"postalCode"`
State *string `json:"state"`
Status string `json:"status,omitempty"`
}
GetSiteParams contains available API body parameters for the PushSite method.
type PushTemplateParams ¶
type PushTemplateParams struct {
ID string `json:"id,omitempty"`
TargetName string `json:"targetName,omitempty"`
}
PushTemplateParams represents parameters for creating or modifying a template.
type QuotaDetails ¶
type QuotaDetails struct {
Total *int64 `json:"total"`
Active *int64 `json:"active"`
Unused *int64 `json:"unused"`
}
QuotaDetails represents the details of the quotas applied to User Type for an xMatters instance.
type RecipientPointer ¶
RecipientPointer is a reference to a recipient.
type RecipientReference ¶
type RecipientReference struct {
ID *string `json:"id"`
TargetName *string `json:"targetName"`
RecipientType *string `json:"recipientType"`
// Optional Shared Fields
Site *ReferenceById `json:"site,omitempty"`
Supervisors *PersonPagination `json:"supervisors,omitempty"`
Description *string `json:"description,omitempty"`
Observers *RolePagination `json:"observers,omitempty"`
// Optional Group Fields
AllowDuplicates *bool `json:"allowDuplicates,omitempty"`
GroupType *string `json:"groupType,omitempty"`
ObservedByAll *bool `json:"observedByAll,omitempty"`
ResponseCount *int64 `json:"responseCount,omitempty"`
ResponseCountThreshold *int64 `json:"responseCountThreshold,omitempty"`
UseDefaultDevices *bool `json:"useDefaultDevices,omitempty"`
Services *ServicePagination `json:"services,omitempty"`
// Optional Person Fields
FirstName *string `json:"firstName,omitempty"`
Language *string `json:"language,omitempty"`
LastName *string `json:"lastName,omitempty"`
LicenseType *string `json:"licenseType,omitempty"`
PhoneLogin *string `json:"phoneLogin,omitempty"`
PhonePin *string `json:"phonePin,omitempty"`
Properties *map[string]string `json:"properties,omitempty"`
Roles *RolePagination `json:"roles,omitempty"`
Timezone *string `json:"timezone,omitempty"`
LastLogin *string `json:"lastLogin,omitempty"`
WebLogin *string `json:"webLogin,omitempty"`
// Opional Device Fields
DefaultDevice *bool `json:"defaultDevice,omitempty"`
Delay *int64 `json:"delay,omitempty"`
DeviceType *string `json:"deviceType,omitempty"`
Name *string `json:"name,omitempty"`
Owner *PersonReference `json:"owner,omitempty"`
PriorityThreshold *string `json:"priorityThreshold,omitempty"`
Provider *ReferenceById `json:"provider,omitempty"`
Sequence *string `json:"sequence,omitempty"`
TestStatus *string `json:"testStatus,omitempty"`
Timeframes *[]DeviceTimeframe `json:"timeframes,omitempty"`
// Optional DynamicTeam Fields
ExternallyOwned *bool `json:"externallyOwned,omitempty"`
}
RecipientReference represents a group member in xMatters. Group members can be people, devices, or groups This object might include additional information depending on the type of group member, as defined
type ReferenceById ¶
type ReferenceById struct {
ID *string `json:"id"`
}
ReferenceById represents the identifier of a resource.
type ReferenceByName ¶
type ReferenceByName struct {
Name *string `json:"name"`
}
ReferenceByName identifies a resource by name.
type RetryPolicy ¶
RetryPolicy specifies number of retries and min/max retry delays This config is used when the client exponentially backs off after errored requests.
type Role ¶
type Role struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name"`
Description *string `json:"description"`
}
Role represents a role in xMatters.
type RolePagination ¶
type RolePagination struct {
*Pagination
Roles []*Role `json:"data,omitempty"`
}
RolePagination contains a paginated list of roles. It extends the Pagination struct containing links to additional pages.
type Service ¶
type Service struct {
ID *string `json:"id"`
TargetName *string `json:"targetName,omitempty"`
RecipientType *string `json:"recipientType,omitempty"`
ServiceType *string `json:"serviceType,omitempty"`
ServiceTier *string `json:"serviceTier,omitempty"`
Description *string `json:"description,omitempty"`
ServiceLinks []*ServiceLink `json:"serviceLinks"`
OwnedBy *GroupReference `json:"ownedBy,omitempty"`
ExternallyOwned *bool `json:"externallyOwned,omitempty"`
Status *string `json:"status,omitempty"`
}
Service represents a service in xMatters.
func (*Service) UnmarshalJSON ¶
Custom Unmarshaller for Service to handle embedded service links This is necessary because the JSON structure for service links is nested within a pagination object.
type ServiceDependency ¶
type ServiceDependency struct {
ID *string `json:"id"`
Service *ServiceReference `json:"service"`
DependentService *ServiceReference `json:"dependentService"`
}
ServiceDependency represents a service dependency relationship in xMatters.
type ServiceDependencyPagination ¶
type ServiceDependencyPagination struct {
*Pagination
Data []*ServiceDependency `json:"data"`
}
ServiceDependencyPagination contains a paginated list of service dependencies. It extends the Pagination struct containing links to additional pages.
type ServiceLink ¶
type ServiceLink struct {
Label *string `json:"label" tfsdk:"link_text"`
URL *string `json:"url" tfsdk:"url"`
}
ServiceLink represents an optional URL link with associated label assigned to an xMatters service.
type ServiceLinksPagination ¶
type ServiceLinksPagination struct {
*Pagination
Data []*ServiceLink `json:"data,omitempty"`
}
ServiceLinksPagination contains a paginated list of service links. It extends the Pagination struct containing links to additional pages.
type ServicePagination ¶
type ServicePagination struct {
*Pagination
Services []*Service `json:"data,omitempty"`
}
ServicePagination contains a paginated list of services. It extends the Pagination struct containing links to additional pages.
type ServiceReference ¶
type ServiceReference struct {
ID *string `json:"id"`
TargetName *string `json:"targetName,omitempty"`
}
ServiceReference represents a shorthand version of a service in xMatters.
type Shift ¶
type Shift struct {
ID *string `json:"id"`
Group *GroupReference `json:"group"`
Name *string `json:"name"`
Start *string `json:"start"`
End *string `json:"end"`
Timezone *string `json:"timezone"`
Recurrence *ShiftRecurrence `json:"recurrence"`
Members []*ShiftMember `json:"members"`
}
type ShiftMember ¶
type ShiftMember struct {
Recipient *RecipientPointer `json:"recipient"`
Shift *ReferenceById `json:"shift"`
Position *int64 `json:"position"`
Delay *int64 `json:"delay"`
EscalationType *string `json:"escalationType"`
InRotation *bool `json:"inRotation"`
}
type ShiftPagination ¶
type ShiftPagination struct {
*Pagination
Shifts []*Shift `json:"data"`
}
type ShiftRecurrence ¶
type ShiftRecurrence struct {
Frequency *string `json:"frequency"`
RepeatEvery *int64 `json:"repeatEvery,omitempty"`
OnDays []*string `json:"onDays,omitempty"`
On *string `json:"on,omitempty"`
Months []*string `json:"months,omitempty"`
DateOfMonth *string `json:"dateOfMonth,omitempty"`
DayOfWeekClassifier *string `json:"dayOfWeekClassifier,omitempty"`
DayOfWeek *string `json:"dayOfWeek,omitempty"`
End *ShiftEnd `json:"end,omitempty"`
}
type Site ¶
type Site struct {
Address1 *string `json:"address1,omitempty"`
Address2 *string `json:"address2,omitempty"`
City *string `json:"city,omitempty"`
Country *string `json:"country,omitempty"`
ID *string `json:"id"`
Language *string `json:"language,omitempty"`
Latitude *float64 `json:"latitude,omitempty"`
Longitude *float64 `json:"longitude,omitempty"`
Name *string `json:"name,omitempty"`
PostalCode *string `json:"postalCode,omitempty"`
State *string `json:"state,omitempty"`
Status *string `json:"status,omitempty"`
Timezone *string `json:"timezone,omitempty"`
}
Site represents a site in xMatters.
type SitePagination ¶
type SitePagination struct {
*Pagination
Sites []*Site `json:"data,omitempty"`
}
SitePagination contains a paginated list of sites. It extends the Pagination struct containing links to additional pages.
type Template ¶
type Template struct {
StringField *string `json:"stringField,omitempty"`
IntField *int64 `json:"intField,omitempty"`
BoolField *bool `json:"boolField,omitempty"`
SetField *TemplatePagination `json:"setField,omitempty"`
ListField *TemplatePagination `json:"listField,omitempty"`
ObjectField *TemplateObject `json:"objectField,omitempty"`
}
Template represents a template in xMatters.
type TemplateObject ¶
type TemplateObject struct {
StringField *string `json:"stringField,omitempty"`
}
type TemplatePagination ¶
type TemplatePagination struct {
*Pagination `json:"pagination"`
Data []*Template `json:"data"`
}
TemplatePagination represents a paginated list of templates in xMatters.
type UserQuotas ¶
type UserQuotas struct {
StakeholderUsersEnabled *bool `json:"stakeholderUsersEnabled"`
StakeholderUsers *QuotaDetails `json:"stakeholderUsers"`
FullUsers *QuotaDetails `json:"fullUsers"`
}
UserQuotas represents the user licence quotas for an xMatters instance.
type XMattersAPI ¶
type XMattersAPI struct {
Username *string
Password *string
Token *string
AuthType *string
BaseURL *string
UserAgent *string
Debug *bool
// contains filtered or unexported fields
}
XMattersAPI represents the configuration options for interacting with the xMatters API.
func NewWithBasicAuth ¶
func NewWithBasicAuth(hostname, username, password *string, opts ...Option) (*XMattersAPI, error)
NewWithBasicAuth creates a new instance of XMattersAPI with the provided URL, credentials, and options.
func NewWithToken ¶
func NewWithToken(hostname, token *string, opts ...Option) (*XMattersAPI, error)
NewWithToken creates a new instance of XMattersAPI with the provided URL, API token, and options.
func (*XMattersAPI) DeleteDevice ¶
func (xmatters *XMattersAPI) DeleteDevice(params string) error
DeleteDevice deletes a device in xMatters. It requires the deviceId parameter to identify the specific device to be deleted. It returns an error if the deletion fails.
func (*XMattersAPI) DeleteGroup ¶
func (xmatters *XMattersAPI) DeleteGroup(groupId string) error
DeleteGroup deletes a group in xMatters. It requires the groupId parameter to identify the specific group to be deleted. It returns an error if the deletion fails.
func (*XMattersAPI) DeleteGroupMembership ¶
func (xmatters *XMattersAPI) DeleteGroupMembership(groupId, memberId string) error
DeleteGroupMembership is a helper function that removes a member from a group in xMatters. It requires the groupId and memberId parameters to identify the specific group and member to be removed. The method returns an error if any issues occur. It is used internally by the PushGroupRoster method to remove members from a group.
func (*XMattersAPI) DeleteGroupRoster ¶
func (xmatters *XMattersAPI) DeleteGroupRoster(groupId string) error
DeleteGroupRoster removes all members from a group in xMatters. It requires the groupId parameter to identify the specific group and returns an error if any issues occur.
func (*XMattersAPI) DeletePerson ¶
func (xmatters *XMattersAPI) DeletePerson(personId *string) error
DeletePerson deletes a person in xMatters. It requires the personId parameter to identify the specific person to be deleted. It returns an error if the deletion fails.
func (*XMattersAPI) DeleteService ¶
func (xmatters *XMattersAPI) DeleteService(serviceId string) error
DeleteService deletes a service in xMatters. It requires the serviceId parameter to identify the specific service to be deleted. It returns an error if the deletion fails.
func (*XMattersAPI) DeleteServiceDependency ¶
func (xmatters *XMattersAPI) DeleteServiceDependency(serviceDepId string) error
DeleteServiceDependency deletes a service dependency in xMatters. It requires the serviceDepId parameter to identify the specific service dependency to be deleted. It returns an error if the deletion fails.
func (*XMattersAPI) DeleteSite ¶
func (xmatters *XMattersAPI) DeleteSite(siteId *string) error
DeleteSite deletes a site in xMatters. It requires the siteId parameter to identify the specific site to be deleted. It returns an error if the deletion fails.
func (*XMattersAPI) DeleteTemplate ¶
func (xmatters *XMattersAPI) DeleteTemplate(templateId *string) error
DeleteTemplate deletes a template in xMatters.
func (*XMattersAPI) GetDevice ¶
func (xmatters *XMattersAPI) GetDevice(deviceId string) (Device, error)
GetDevice retrieves a device in xMatters. It requires the deviceId parameter to identify the specific device, and returns a Device object. A URL parameter is added to the request URI to embed timeframes of the device in the response.
func (*XMattersAPI) GetDeviceList ¶
func (xmatters *XMattersAPI) GetDeviceList(params GetDevicesParams) ([]*Device, error)
GetDeviceList retrieves a list of devices in xMatters. It accepts optional query parameters to filter the results and returns a slice of Device objects.
func (*XMattersAPI) GetDevicePaginationSet ¶
func (xmatters *XMattersAPI) GetDevicePaginationSet(uri string) ([]*Device, error)
GetDevicePaginationSet is a recursive helper function that handles a paginated list of devices. It takes a URI as input and retrieves the paginated set from that URI. It checks for additional pages and recursively fetches them until all pages are retrieved.
func (XMattersAPI) GetGroup ¶
func (xmatters XMattersAPI) GetGroup(groupId string) (Group, error)
GetGroup retrieves a group in xMatters. It requires the groupId parameter to identify the specific group, and returns a Group object. A URL parameter is added to the request URI to embed the supervisors, observers, and services.
func (*XMattersAPI) GetGroupList ¶
func (xmatters *XMattersAPI) GetGroupList(params GetGroupsParams) ([]*Group, error)
GetGroupList retrieves a list of groups in xMatters. It accepts optional query parameters to filter the results and returns a slice of Group objects.
func (*XMattersAPI) GetGroupPaginationSet ¶
func (xmatters *XMattersAPI) GetGroupPaginationSet(uri string) ([]*Group, error)
GetGroupPaginationSet is a recursive helper function that handles a paginated list of groups. It takes a URI as input and retrieves the paginated set from that URI. It checks for additional pages and recursively fetches them until all pages are retrieved.
func (*XMattersAPI) GetGroupRoster ¶
func (xmatters *XMattersAPI) GetGroupRoster(groupId string) (GroupRoster, error)
GetGroupRoster retrieves the member roster of a group in xMatters. It requires the groupId parameter to identify the specific group, and returns a GroupRoster object.
func (*XMattersAPI) GetGroupRosterPaginationSet ¶
func (xmatters *XMattersAPI) GetGroupRosterPaginationSet(uri string) (GroupRoster, error)
GetGroupRosterPaginationSet is a recursive helper function that handles a paginated list of group rosters. It takes a URI as input and retrieves the paginated set from that URI. It checks for additional pages and recursively fetches them until all pages are retrieved.
func (*XMattersAPI) GetPerson ¶
func (xmatters *XMattersAPI) GetPerson(personId string) (Person, error)
GetPerson retrieves a person in xMatters. It requires the personId parameter to identify the specific person, and returns a Person object. A URL parameter is added to the request URI to embed the roles and supervisors of the person in the response.
func (*XMattersAPI) GetPersonList ¶
func (xmatters *XMattersAPI) GetPersonList(params GetPeopleParams) ([]*Person, error)
GetPersonList retrieves a list of people in xMatters. It accepts optional query parameters to filter the results and returns a slice of Person objects.
func (*XMattersAPI) GetPersonPaginationSet ¶
func (xmatters *XMattersAPI) GetPersonPaginationSet(uri string) ([]*Person, error)
GetPersonPaginationSet is a recursive helper function that handles a paginated list of people. It takes a URI as input and retrieves the paginated set from that URI. It checks for additional pages and recursively fetches them until all pages are retrieved.
func (*XMattersAPI) GetService ¶
func (xmatters *XMattersAPI) GetService(serviceId string) (Service, error)
GetService retrieves a service in xMatters. It requires the serviceId parameter to identify the specific service, and returns a Service object. A URL parameter is added to the request URI to embed service links of the service in the response.
func (*XMattersAPI) GetServiceDependency ¶
func (xmatters *XMattersAPI) GetServiceDependency(dependencyId string) (ServiceDependency, error)
GetServiceDependency retrieves a service dependency in xMatters. It requires the dependencyId parameter to identify the specific service dependency, and returns a ServiceDependency object.
func (*XMattersAPI) GetServiceList ¶
func (xmatters *XMattersAPI) GetServiceList(params GetServicesParams) ([]*Service, error)
GetServiceList retrieves a list of services in xMatters. It accepts optional query parameters to filter the results and returns a slice of Service objects.
func (*XMattersAPI) GetServicePaginationSet ¶
func (xmatters *XMattersAPI) GetServicePaginationSet(uri string) ([]*Service, error)
GetServicePaginationSet is a recursive helper function that handles a paginated list of services. It takes a URI as input and retrieves the paginated set from that URI. It checks for additional pages and recursively fetches them until all pages are retrieved.
func (*XMattersAPI) GetSite ¶
func (xmatters *XMattersAPI) GetSite(siteId string) (Site, error)
GetSite retrieves a site in xMatters. It requires the siteId parameter to identify the specific site, and returns a Site object.
func (*XMattersAPI) GetSiteList ¶
func (xmatters *XMattersAPI) GetSiteList(params GetSitesParams) ([]*Site, error)
GetSiteList retrieves a list of sites in xMatters. It accepts optional query parameters to filter the results and returns a slice of Site objects.
func (*XMattersAPI) GetSitePaginationSet ¶
func (xmatters *XMattersAPI) GetSitePaginationSet(uri string) ([]*Site, error)
GetSitePaginationSet is a recursive helper function that handles a paginated list of sites. It takes a URI as input and retrieves the paginated set from that URI. It checks for additional pages and recursively fetches them until all pages are retrieved.
func (*XMattersAPI) GetTemplate ¶
func (xmatters *XMattersAPI) GetTemplate(templateId *string) (Template, error)
GetTemplate retrieves a template in xMatters.
func (*XMattersAPI) GetTemplateList ¶
func (xmatters *XMattersAPI) GetTemplateList(params GetTemplatesParams) ([]*Template, error)
GetTemplateList retrieves a list of templates in xMatters.
func (*XMattersAPI) GetUserQuotas ¶
func (xmatters *XMattersAPI) GetUserQuotas() (UserQuotas, error)
GetUserQuotas retrieves the user license quotas for an xMatters instance.
func (*XMattersAPI) PushDevice ¶
func (xmatters *XMattersAPI) PushDevice(params PushDeviceParams) (Device, error)
PushDevice either creates a new device in xMatters or modifies an existing device. It requires the PushDeviceParams struct containing the device details. It returns the created or modified Device object. If the params.ID is provided it updates the existing device; otherwise, it creates a new one.
func (*XMattersAPI) PushGroup ¶
func (xmatters *XMattersAPI) PushGroup(params PushGroupParams) (Group, error)
PushGroup either creates a new group in xMatters or modifies an existing group. It requires the PushGroupParams struct to specify the group details. It returns the created or modified Group object. If the params.ID is provided it updates the existing group; otherwise, it creates a new one.
func (*XMattersAPI) PushGroupMembership ¶
func (xmatters *XMattersAPI) PushGroupMembership(groupId string, params *GroupMember) (GroupMember, error)
PushGroupMembership is a helper function that adds a single member to a group in xMatters. It requires the groupId parameter to identify the specific group and the params parameter to specify the member to be added. The method returns the updated GroupMember object. It is used internally by the PushGroupRoster method to add members to a group.
func (*XMattersAPI) PushGroupRoster ¶
func (xmatters *XMattersAPI) PushGroupRoster(groupId string, params []*GroupMember) (GroupRoster, error)
PushGroupRoster updates the members of a group in xMatters to match the desired list of members. This method will remove any members from the group that are not in the desired list, and add any members that are not already in the group. The method returns the updated group roster.
func (*XMattersAPI) PushPerson ¶
func (xmatters *XMattersAPI) PushPerson(params PushPersonParams) (Person, error)
PushPerson either creates a new person in xMatters or modifies an existing person. It requires the PushPersonParams struct containing the person details. It returns the created or modified Person object. If the params.ID is provided it updates the existing person; otherwise, it creates a new one.
func (*XMattersAPI) PushService ¶
func (xmatters *XMattersAPI) PushService(params PushServiceParams) (Service, error)
PushService either creates a new service in xMatters or modifies an existing service. It requires the PushServiceParams struct containing the service details. It returns the created or modified Service object. If the params.ID is provided it updates the existing service; otherwise, it creates a new one.
func (*XMattersAPI) PushServiceDependency ¶
func (xmatters *XMattersAPI) PushServiceDependency(params PushServiceDependencyParams) (ServiceDependency, error)
PushServiceDependency either creates a new service dependency in xMatters or modifies an existing service dependency. It requires the PushServiceDependencyParams struct containing the service dependency details. It returns the created or modified ServiceDependency object. If the params.ID is provided it updates the existing service dependency; otherwise, it creates a new one.
func (*XMattersAPI) PushSite ¶
func (xmatters *XMattersAPI) PushSite(params PushSiteParams) (Site, error)
PushSite either creates a new site in xMatters or modifies an existing site. It requires the PushSiteParams struct containing the site details. It returns the created or modified Site object. If the params.ID is provided it updates the existing site; otherwise, it creates a new one.
func (*XMattersAPI) PushTemplate ¶
func (xmatters *XMattersAPI) PushTemplate(params PushTemplateParams) (Template, error)
PushTemplate either creates a new template or modifies an existing template in xMatters.
func (*XMattersAPI) Request ¶
func (xmatters *XMattersAPI) Request(httpMethod, uri, contentType string, body interface{}) ([]byte, error)
Request performs an HTTP request with the specified method, URI, content type, and request body. It returns the response body as a byte slice or an error, if any.
type XMattersError ¶
type XMattersError struct {
Code int `json:"code,omitempty"`
Reason string `json:"reason"`
Message string `json:"message"`
Subcode string `json:"subcode,omitempty"`
}
XMattersError is a custom error type with helpful fields.
func (XMattersError) Error ¶
func (e XMattersError) Error() string
Error implements the error interface for xMattersError.