Skip to content

Latest commit

 

History

History
184 lines (142 loc) · 9.95 KB

File metadata and controls

184 lines (142 loc) · 9.95 KB

Maintenances

(Maintenances)

Overview

Available Operations

  • List - List scheduled maintenance events
  • Create - Create a scheduled maintenance event
  • Delete - Delete a scheduled maintenance event

List

Lists all scheduled maintenance events

Example Usage

package main

import(
	"firehydrant"
	"context"
	"log"
)

func main() {
    s := firehydrant.New(
        firehydrant.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Maintenances.List(ctx, nil, nil, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.ScheduledMaintenanceEntity != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
query *string Filter scheduled_maintenances with a query on their name
page *int N/A
perPage *int N/A
opts []operations.Option The options for this request.

Response

*operations.ListScheduledMaintenancesResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.BadRequest 400, 413, 414, 415, 422, 431, 510 application/json
sdkerrors.Unauthorized 401, 403, 407, 511 application/json
sdkerrors.NotFound 404, 501, 505 application/json
sdkerrors.Timeout 408, 504 application/json
sdkerrors.RateLimited 429 application/json
sdkerrors.InternalServerError 500, 502, 503, 506, 507, 508 application/json
sdkerrors.SDKError 4XX, 5XX */*

Create

Create a new scheduled maintenance event

Example Usage

package main

import(
	"firehydrant"
	"context"
	"firehydrant/types"
	"firehydrant/models/components"
	"log"
)

func main() {
    s := firehydrant.New(
        firehydrant.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Maintenances.Create(ctx, components.PostV1ScheduledMaintenances{
        Name: "<value>",
        StartsAt: types.MustTimeFromString("2023-04-18T00:41:46.120Z"),
        EndsAt: types.MustTimeFromString("2024-01-18T06:46:27.056Z"),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.ScheduledMaintenanceEntity != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request components.PostV1ScheduledMaintenances ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.CreateScheduledMaintenanceResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.ErrorEntity 400 application/json
sdkerrors.Unauthorized 401, 403, 407, 511 application/json
sdkerrors.NotFound 404, 501, 505 application/json
sdkerrors.Timeout 408, 504 application/json
sdkerrors.BadRequest 413, 414, 415, 422, 431, 510 application/json
sdkerrors.RateLimited 429 application/json
sdkerrors.InternalServerError 500, 502, 503, 506, 507, 508 application/json
sdkerrors.SDKError 4XX, 5XX */*

Delete

Delete a scheduled maintenance event, preventing it from taking place.

Example Usage

package main

import(
	"firehydrant"
	"context"
	"log"
)

func main() {
    s := firehydrant.New(
        firehydrant.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Maintenances.Delete(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
scheduledMaintenanceID string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.DeleteScheduledMaintenanceResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.BadRequest 400, 413, 414, 415, 422, 431, 510 application/json
sdkerrors.Unauthorized 401, 403, 407, 511 application/json
sdkerrors.NotFound 404, 501, 505 application/json
sdkerrors.Timeout 408, 504 application/json
sdkerrors.RateLimited 429 application/json
sdkerrors.InternalServerError 500, 502, 503, 506, 507, 508 application/json
sdkerrors.SDKError 4XX, 5XX */*