Skip to content

Latest commit

 

History

History
472 lines (339 loc) · 14 KB

orgs-alarms.md

File metadata and controls

472 lines (339 loc) · 14 KB

Orgs Alarms

orgsAlarms := client.OrgsAlarms()

Class Name

OrgsAlarms

Methods

Ack Org Alarm

Ack Org Alarm

AckOrgAlarm(
    ctx context.Context,
    orgId uuid.UUID,
    alarmId uuid.UUID,
    body *models.NoteString) (
    http.Response,
    error)

Parameters

Parameter Type Tags Description
orgId uuid.UUID Template, Required -
alarmId uuid.UUID Template, Required -
body *models.NoteString Body, Optional Request Body

Response Type

``

Example Usage

ctx := context.Background()

orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

alarmId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

body := models.NoteString{
    Note:                 models.ToPointer("maintenance window"),
}

resp, err := orgsAlarms.AckOrgAlarm(ctx, orgId, alarmId, &body)
if err != nil {
    log.Fatalln(err)
} else {
    fmt.Println(resp.StatusCode)
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Ack Org All Alarms

Ack all Org Alarms

N.B.: Batch size for multiple alarm ack and unack has to be less or or equal to 1000.

AckOrgAllAlarms(
    ctx context.Context,
    orgId uuid.UUID,
    body *models.NoteString) (
    http.Response,
    error)

Parameters

Parameter Type Tags Description
orgId uuid.UUID Template, Required -
body *models.NoteString Body, Optional -

Response Type

``

Example Usage

ctx := context.Background()

orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

body := models.NoteString{
    Note:                 models.ToPointer("string"),
}

resp, err := orgsAlarms.AckOrgAllAlarms(ctx, orgId, &body)
if err != nil {
    log.Fatalln(err)
} else {
    fmt.Println(resp.StatusCode)
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Ack Org Multiple Alarms

Ack multiple Org Alarms

AckOrgMultipleAlarms(
    ctx context.Context,
    orgId uuid.UUID,
    body *models.Alarms) (
    http.Response,
    error)

Parameters

Parameter Type Tags Description
orgId uuid.UUID Template, Required -
body *models.Alarms Body, Optional Request Body

Response Type

``

Example Usage

ctx := context.Background()

orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

body := models.Alarms{
    AlarmIds:             []uuid.UUID{
        uuid.MustParse("ccb8c94d-ca56-4075-932f-1f2ab444ff2c"),
        uuid.MustParse("98ff4a3d-ec9b-4138-a42e-54fc3335179d"),
    },
    Note:                 models.ToPointer("maintenance window"),
}

resp, err := orgsAlarms.AckOrgMultipleAlarms(ctx, orgId, &body)
if err != nil {
    log.Fatalln(err)
} else {
    fmt.Println(resp.StatusCode)
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Count Org Alarms

Count Org Alarms

CountOrgAlarms(
    ctx context.Context,
    orgId uuid.UUID,
    distinct *string,
    start *int,
    end *int,
    duration *string,
    limit *int,
    page *int) (
    models.ApiResponse[models.RepsonseCount],
    error)

Parameters

Parameter Type Tags Description
orgId uuid.UUID Template, Required -
distinct *string Query, Optional -
start *int Query, Optional start datetime, can be epoch or relative time like -1d, -1w; -1d if not specified
end *int Query, Optional end datetime, can be epoch or relative time like -1d, -2h; now if not specified
duration *string Query, Optional duration like 7d, 2w
Default: "1d"
limit *int Query, Optional Default: 100
Constraints: >= 0
page *int Query, Optional Default: 1
Constraints: >= 1

Response Type

models.RepsonseCount

Example Usage

ctx := context.Background()

orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")







duration := "10m"

limit := 100

page := 1

apiResponse, err := orgsAlarms.CountOrgAlarms(ctx, orgId, nil, nil, nil, &duration, &limit, &page)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Example Response (as JSON)

{
  "distinct": "string",
  "end": 0,
  "limit": 0,
  "results": [
    {
      "count": 0,
      "property": "string"
    }
  ],
  "start": 0,
  "total": 0
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Search Org Alarms

Search Org Alarms

SearchOrgAlarms(
    ctx context.Context,
    orgId uuid.UUID,
    siteId *uuid.UUID,
    mType *string,
    start *int,
    end *int,
    duration *string,
    limit *int) (
    models.ApiResponse[models.AlarmSearchResult],
    error)

Parameters

Parameter Type Tags Description
orgId uuid.UUID Template, Required -
siteId *uuid.UUID Query, Optional site ID
mType *string Query, Optional alarm type
start *int Query, Optional start datetime, can be epoch or relative time like -1d, -1w; -1d if not specified
end *int Query, Optional end datetime, can be epoch or relative time like -1d, -2h; now if not specified
duration *string Query, Optional duration like 7d, 2w
Default: "1d"
limit *int Query, Optional Default: 100
Constraints: >= 0

Response Type

models.AlarmSearchResult

Example Usage

ctx := context.Background()

orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")









duration := "10m"

limit := 100

apiResponse, err := orgsAlarms.SearchOrgAlarms(ctx, orgId, nil, nil, nil, nil, &duration, &limit)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Unack Org All Arlarms

Unack all Org Alarms

N.B.: Batch size for multiple alarm ack and unack has to be less or or equal to 1000.

UnackOrgAllArlarms(
    ctx context.Context,
    orgId uuid.UUID,
    body *models.NoteString) (
    http.Response,
    error)

Parameters

Parameter Type Tags Description
orgId uuid.UUID Template, Required -
body *models.NoteString Body, Optional Request Body

Response Type

``

Example Usage

ctx := context.Background()

orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

body := models.NoteString{
    Note:                 models.ToPointer("maintenance window"),
}

resp, err := orgsAlarms.UnackOrgAllArlarms(ctx, orgId, &body)
if err != nil {
    log.Fatalln(err)
} else {
    fmt.Println(resp.StatusCode)
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Unack Org Multiple Alarms

Unack multiple Org Alarms

UnackOrgMultipleAlarms(
    ctx context.Context,
    orgId uuid.UUID,
    body *models.Alarms) (
    http.Response,
    error)

Parameters

Parameter Type Tags Description
orgId uuid.UUID Template, Required -
body *models.Alarms Body, Optional Request Body

Response Type

``

Example Usage

ctx := context.Background()

orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

body := models.Alarms{
    AlarmIds:             []uuid.UUID{
        uuid.MustParse("ccb8c94d-ca56-4075-932f-1f2ab444ff2c"),
        uuid.MustParse("98ff4a3d-ec9b-4138-a42e-54fc3335179d"),
    },
    Note:                 models.ToPointer("maintenance window"),
}

resp, err := orgsAlarms.UnackOrgMultipleAlarms(ctx, orgId, &body)
if err != nil {
    log.Fatalln(err)
} else {
    fmt.Println(resp.StatusCode)
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException