Skip to content

Latest commit

 

History

History
935 lines (722 loc) · 59.1 KB

README.md

File metadata and controls

935 lines (722 loc) · 59.1 KB

Services

(Services)

Overview

Operations related to Services

Available Operations

CreateDependency

Creates a service dependency relationship between two services

Example Usage

package main

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

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

    ctx := context.Background()
    res, err := s.Services.CreateDependency(ctx, components.PostV1ServiceDependencies{
        ServiceID: "<id>",
        ConnectedServiceID: "<id>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.ServiceDependencyEntity != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.CreateServiceDependencyResponse, 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 */*

GetDependency

Retrieves a single service dependency by ID

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.Services.GetDependency(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.ServiceDependencyEntity != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.GetServiceDependencyResponse, 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 */*

DeleteDependency

Deletes a single service dependency

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.Services.DeleteDependency(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.ServiceDependencyEntity != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.DeleteServiceDependencyResponse, 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 */*

Update

Update the notes of the service dependency

Example Usage

package main

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

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

    ctx := context.Background()
    res, err := s.Services.Update(ctx, "<id>", components.PatchV1ServiceDependenciesServiceDependencyID{})
    if err != nil {
        log.Fatal(err)
    }
    if res.ServiceDependencyEntity != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.UpdateServiceDependencyResponse, 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 */*

List

List all of the services that have been added to the organization.

Example Usage

package main

import(
	"firehydrant"
	"context"
	"firehydrant/models/operations"
	"log"
)

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

    ctx := context.Background()
    res, err := s.Services.List(ctx, operations.ListServicesRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.ServiceEntityPaginated != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.ListServicesResponse, 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

Creates a service for the organization, you may also create or attach functionalities to the service on create.

Example Usage

package main

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

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

    ctx := context.Background()
    res, err := s.Services.Create(ctx, components.PostV1Services{
        Name: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.ServiceEntity != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.CreateServiceResponse, 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 */*

CreateLinks

Creates a service with the appropriate integration for each external service ID passed

Example Usage

package main

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

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

    ctx := context.Background()
    res, err := s.Services.CreateLinks(ctx, components.PostV1ServicesServiceLinks{
        ExternalServiceIds: "<value>",
        ConnectionID: "<id>",
        Integration: components.IntegrationVictorops,
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.ServiceLinkEntities != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.CreateServiceLinksResponse, 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 */*

Get

Retrieves a single service by ID

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.Services.Get(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.ServiceEntity != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.GetServiceResponse, 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 */*

Delete

Deletes the service from FireHydrant.

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.Services.Delete(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.ServiceEntity != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.DeleteServiceResponse, 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 */*

Patch

Update a services attributes, you may also add or remove functionalities from the service as well. Note: You may not remove or add individual label key/value pairs. You must include the entire object to override label values.

Example Usage

package main

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

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

    ctx := context.Background()
    res, err := s.Services.Patch(ctx, "<id>", components.PatchV1ServicesServiceID{})
    if err != nil {
        log.Fatal(err)
    }
    if res.ServiceEntity != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.UpdateServiceResponse, 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 */*

GetAvailableDownstreamDependencies

Retrieves all services that are available to be downstream dependencies

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.Services.GetAvailableDownstreamDependencies(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.ServiceEntityLite != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.ListServiceAvailableDownstreamDependenciesResponse, 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 */*

ListAvailableUpstreamDependencies

Retrieves all services that are available to be upstream dependencies

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.Services.ListAvailableUpstreamDependencies(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.ServiceEntityLite != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.ListServiceAvailableUpstreamDependenciesResponse, 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 */*

CreateChecklistResponse

Creates a response for a checklist item

Example Usage

package main

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

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

    ctx := context.Background()
    res, err := s.Services.CreateChecklistResponse(ctx, "<id>", "<id>", components.PostV1ServicesServiceIDChecklistResponseChecklistID{
        CheckID: "<id>",
        Status: true,
    })
    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.
serviceID string ✔️ N/A
checklistID string ✔️ N/A
postV1ServicesServiceIDChecklistResponseChecklistID components.PostV1ServicesServiceIDChecklistResponseChecklistID ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.CreateServiceChecklistResponseResponse, 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 */*

ListDependencies

Retrieves a service's dependencies

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.Services.ListDependencies(ctx, "<id>", nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.ServiceWithAllDependenciesEntity != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
serviceID string ✔️ N/A
flatten *bool If true, returns all dependencies in one array. If false, splits dependencies into different arrays for child and parent dependencies
opts []operations.Option The options for this request.

Response

*operations.GetServiceDependenciesResponse, 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 */*

DeleteLink

Deletes a service link from FireHydrant.

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.Services.DeleteLink(ctx, "<id>", "<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.
serviceID string ✔️ N/A
remoteID string ✔️ The external service ID which can be found in the JSON
from GET services/:service_id endpoint under
functionalities > external_resources > remote_id
opts []operations.Option The options for this request.

Response

*operations.DeleteServiceLinkResponse, 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 */*

ListForUser

Retrieves a list of services owned by the teams a user is on

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.Services.ListForUser(ctx, "<id>", nil, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.TeamEntityPaginateds != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.ListUserServicesResponse, 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 */*