client

package
v0.0.0-...-5eedccf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package client - blueprints contains functions for the blueprint API Copyright (C) 2020 by Red Hat, Inc.

Package client contains functions for communicating with the API server Copyright (C) 2020 by Red Hat, Inc.

Package client - compose contains functions for the compose API Copyright (C) 2020 by Red Hat, Inc.

Package client - modules contains functions for the modules API Copyright (C) 2020 by Red Hat, Inc.

Package client - projects contains functions for the projects API Copyright (C) 2020 by Red Hat, Inc.

Package client - source contains functions for the source API Copyright (C) 2020 by Red Hat, Inc.

nolint: deadcode,unused // These functions are used by the *_test.go code

Package client - weldr contains functions to return API structures Copyright (C) 2020 by Red Hat, Inc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewComposeResponseV0

func NewComposeResponseV0(body []byte) (*weldr.ComposeResponseV0, error)

NewComposeResponseV0 converts the response body to a status response

func Request

func Request(socket *http.Client, method, path, body string, headers map[string]string) (*http.Response, error)

Request handles sending the request, handling errors, returning the response socket is the path to a Unix Domain socket path is the full URL path, including query strings body is the data to send with POST headers is a map of header:value to add to the request

If it is successful a http.Response will be returned. If there is an error, the response will be nil and error will be returned.

Types

type APIErrorMsg

type APIErrorMsg struct {
	ID  string `json:"id"`
	Msg string `json:"msg"`
}

APIErrorMsg is an individual API error with an ID and a message string

func (*APIErrorMsg) String

func (r *APIErrorMsg) String() string

String returns the error id and message as a string

type APIResponse

type APIResponse struct {
	Status bool          `json:"status"`
	Errors []APIErrorMsg `json:"errors,omitempty"`
}

APIResponse is returned by some requests to indicate success or failure. It is always returned when the status code is 400, indicating some kind of error with the request. If Status is true the Errors list will not be included or will be empty. When Status is false it will include at least one APIErrorMsg with details about the error.

func CancelComposeV0

func CancelComposeV0(socket *http.Client, uuid string) (weldr.CancelComposeStatusV0, *APIResponse, error)

CancelComposeV0 cancels one composes based on the uuid

func DeleteBlueprintV0

func DeleteBlueprintV0(socket *http.Client, bpName string) (*APIResponse, error)

DeleteBlueprintV0 deletes the named blueprint and returns an APIResponse

func DeleteComposeV0

func DeleteComposeV0(socket *http.Client, uuids string) (weldr.DeleteComposeResponseV0, *APIResponse, error)

DeleteComposeV0 deletes one or more composes based on their uuid

func DeleteRaw

func DeleteRaw(socket *http.Client, path string) ([]byte, *APIResponse, error)

DeleteRaw sends a DELETE request Errors from the API are returned as an APIResponse, client errors are returned as error

func DeleteSourceV0

func DeleteSourceV0(socket *http.Client, sourceName string) (*APIResponse, error)

DeleteSourceV0 deletes the named source and returns an APIResponse

func DeleteSourceV1

func DeleteSourceV1(socket *http.Client, sourceName string) (*APIResponse, error)

DeleteSourceV1 deletes the named source and returns an APIResponse

func DeleteWorkspaceV0

func DeleteWorkspaceV0(socket *http.Client, bpName string) (*APIResponse, error)

DeleteWorkspaceV0 deletes the named blueprint's workspace and returns an APIResponse

func DepsolveBlueprintV0

func DepsolveBlueprintV0(socket *http.Client, blueprint string) (weldr.BlueprintsDepsolveV0, *APIResponse, error)

DepsolveBlueprintV0 depsolves the listed blueprint

func DepsolveProjectsV0

func DepsolveProjectsV0(socket *http.Client, projNames string) ([]rpmmd.PackageSpec, *APIResponse, error)

DepsolveProjectsV0 returns the dependencies of the names projects

func FreezeBlueprintV0

func FreezeBlueprintV0(socket *http.Client, blueprint string) (weldr.BlueprintsFreezeV0, *APIResponse, error)

FreezeBlueprintV0 depsolves the listed blueprint and returns the blueprint with frozen package versions

func GetBlueprintChangeV1

func GetBlueprintChangeV1(socket *http.Client, name, commit string) (blueprint.Blueprint, *APIResponse, error)

GetBlueprintChangeV1 returns a specific blueprint change

func GetBlueprintInfoTOMLV0

func GetBlueprintInfoTOMLV0(socket *http.Client, bpName string) (string, *APIResponse, error)

GetBlueprintInfoTOMLV0 returns the requested blueprint as a TOML string

func GetBlueprintsChangesV0

func GetBlueprintsChangesV0(socket *http.Client, bpNames []string) (weldr.BlueprintsChangesV0, *APIResponse, error)

GetBlueprintsChangesV0 returns the changes to the listed blueprints

func GetBlueprintsInfoJSONV0

func GetBlueprintsInfoJSONV0(socket *http.Client, bpName string) (weldr.BlueprintsInfoV0, *APIResponse, error)

GetBlueprintsInfoJSONV0 returns the requested blueprints and their changed state

func GetComposeInfoV0

func GetComposeInfoV0(socket *http.Client, uuid string) (weldr.ComposeInfoResponseV0, *APIResponse, error)

GetComposeInfoV0 returns detailed information about the selected compose

func GetComposeQueueV0

func GetComposeQueueV0(socket *http.Client) (weldr.ComposeQueueResponseV0, *APIResponse, error)

GetComposeQueueV0 returns the list of composes in the queue

func GetComposeStatusV0

func GetComposeStatusV0(socket *http.Client, uuids, blueprint, status, composeType string) ([]weldr.ComposeEntryV0, *APIResponse, error)

GetComposeStatusV0 returns a list of composes matching the optional filter parameters

func GetComposesTypesV0

func GetComposesTypesV0(socket *http.Client) ([]weldr.ComposeTypeV0, *APIResponse, error)

GetComposeTypesV0 returns a list of the failed composes

func GetFailedComposesV0

func GetFailedComposesV0(socket *http.Client) ([]weldr.ComposeEntryV0, *APIResponse, error)

GetFailedComposesV0 returns a list of the failed composes

func GetFinishedComposesV0

func GetFinishedComposesV0(socket *http.Client) ([]weldr.ComposeEntryV0, *APIResponse, error)

GetFinishedComposesV0 returns a list of the finished composes

func GetJSONAll

func GetJSONAll(socket *http.Client, path string) ([]byte, *APIResponse, error)

GetJSONAll returns all JSON results from a GET request using offset/limit This function makes 2 requests, the first with limit=0 to get the total number of results, and then with limit=TOTAL to fetch all of the results. The path passed to GetJSONAll should not include the limit or offset query parameters Errors from the API are returned as an APIResponse, client errors are returned as error

func GetModulesInfoV0

func GetModulesInfoV0(socket *http.Client, modulesNames string) ([]rpmmd.PackageInfo, *APIResponse, error)

GetModulesInfoV0 returns detailed module info on the named modules

func GetProjectsInfoV0

func GetProjectsInfoV0(socket *http.Client, projNames string) ([]rpmmd.PackageInfo, *APIResponse, error)

GetProjectsInfoV0 returns detailed project info on the named projects

func GetRaw

func GetRaw(socket *http.Client, method, path string) ([]byte, *APIResponse, error)

GetRaw returns raw data from a GET request Errors from the API are returned as an APIResponse, client errors are returned as error

func GetRawBody

func GetRawBody(socket *http.Client, method, path string) (io.ReadCloser, *APIResponse, error)

GetRawBody returns the resp.Body io.ReadCloser to the caller NOTE: The caller is responsible for closing the Body when finished

func GetSourceInfoV0

func GetSourceInfoV0(socket *http.Client, sourceNames string) (map[string]weldr.SourceConfigV0, *APIResponse, error)

GetSourceInfoV0 returns detailed information on the named sources

func GetSourceInfoV1

func GetSourceInfoV1(socket *http.Client, sourceNames string) (map[string]weldr.SourceConfigV1, *APIResponse, error)

GetSourceInfoV1 returns detailed information on the named sources

func GetStatusV0

func GetStatusV0(socket *http.Client) (reply weldr.StatusV0, resp *APIResponse, err error)

GetStatusV0 makes a GET request to /api/status and returns the v0 response as a StatusResponseV0

func ListAllModulesV0

func ListAllModulesV0(socket *http.Client) ([]weldr.ModuleName, *APIResponse, error)

ListAllModulesV0 returns a list of all the available module names

func ListAllProjectsV0

func ListAllProjectsV0(socket *http.Client) ([]rpmmd.PackageInfo, *APIResponse, error)

ListAllProjectsV0 returns a list of all the available project names

func ListBlueprintsV0

func ListBlueprintsV0(socket *http.Client) ([]string, *APIResponse, error)

ListBlueprintsV0 returns a list of blueprint names

func ListModulesV0

func ListModulesV0(socket *http.Client, moduleNames string) ([]weldr.ModuleName, *APIResponse, error)

ListModulesV0 returns a list of all the available modules names

func ListSomeModulesV0

func ListSomeModulesV0(socket *http.Client, offset, limit int) ([]weldr.ModuleName, *APIResponse, error)

ListSomeModulesV0 returns a list of all the available modules names

func ListSomeProjectsV0

func ListSomeProjectsV0(socket *http.Client, offset, limit int) ([]rpmmd.PackageInfo, *APIResponse, error)

ListSomeProjectsV0 returns a list of all the available project names

func ListSourcesV0

func ListSourcesV0(socket *http.Client) ([]string, *APIResponse, error)

ListSourcesV0 returns a list of source names

func ListSourcesV1

func ListSourcesV1(socket *http.Client) ([]string, *APIResponse, error)

ListSourcesV1 returns a list of source ids

func NewAPIResponse

func NewAPIResponse(body []byte) (*APIResponse, error)

NewAPIResponse converts the response body to a status response

func PostComposeV0

func PostComposeV0(socket *http.Client, compose string) (*APIResponse, error)

PostComposeV0 sends a JSON compose string to the API and returns an APIResponse

func PostJSON

func PostJSON(socket *http.Client, path, body string) ([]byte, *APIResponse, error)

PostJSON sends a POST with JSON data and the Content-Type header set to "application/json" Errors from the API are returned as an APIResponse, client errors are returned as error

func PostJSONBlueprintV0

func PostJSONBlueprintV0(socket *http.Client, blueprint string) (*APIResponse, error)

PostJSONBlueprintV0 sends a JSON blueprint string to the API and returns an APIResponse

func PostJSONSourceV0

func PostJSONSourceV0(socket *http.Client, source string) (*APIResponse, error)

PostJSONSourceV0 sends a JSON source string to the API and returns an APIResponse

func PostJSONSourceV1

func PostJSONSourceV1(socket *http.Client, source string) (*APIResponse, error)

PostJSONSourceV1 sends a JSON source string to the API and returns an APIResponse

func PostJSONWorkspaceV0

func PostJSONWorkspaceV0(socket *http.Client, blueprint string) (*APIResponse, error)

PostJSONWorkspaceV0 sends a JSON blueprint string to the API and returns an APIResponse

func PostRaw

func PostRaw(socket *http.Client, path, body string, headers map[string]string) ([]byte, *APIResponse, error)

PostRaw sends a POST with raw data and returns the raw response body Errors from the API are returned as an APIResponse, client errors are returned as error

func PostTOML

func PostTOML(socket *http.Client, path, body string) ([]byte, *APIResponse, error)

PostTOML sends a POST with TOML data and the Content-Type header set to "text/x-toml" Errors from the API are returned as an APIResponse, client errors are returned as error

func PostTOMLBlueprintV0

func PostTOMLBlueprintV0(socket *http.Client, blueprint string) (*APIResponse, error)

PostTOMLBlueprintV0 sends a TOML blueprint string to the API and returns an APIResponse

func PostTOMLSourceV0

func PostTOMLSourceV0(socket *http.Client, source string) (*APIResponse, error)

PostTOMLSourceV0 sends a TOML source string to the API and returns an APIResponse

func PostTOMLSourceV1

func PostTOMLSourceV1(socket *http.Client, source string) (*APIResponse, error)

PostTOMLSourceV1 sends a TOML source string to the API and returns an APIResponse

func PostTOMLWorkspaceV0

func PostTOMLWorkspaceV0(socket *http.Client, blueprint string) (*APIResponse, error)

PostTOMLWorkspaceV0 sends a TOML blueprint string to the API and returns an APIResponse

func TagBlueprintV0

func TagBlueprintV0(socket *http.Client, blueprint string) (*APIResponse, error)

TagBlueprintV0 tags the current blueprint commit as a new revision

func UndoBlueprintChangeV0

func UndoBlueprintChangeV0(socket *http.Client, blueprint, commit string) (*APIResponse, error)

UndoBlueprintChangeV0 reverts a blueprint to a previous commit

func WriteComposeImageV0

func WriteComposeImageV0(socket *http.Client, w io.Writer, uuid string) (*APIResponse, error)

WriteComposeImageV0 requests the image for a compose and writes it to an io.Writer

func WriteComposeLogV0

func WriteComposeLogV0(socket *http.Client, w io.Writer, uuid string) (*APIResponse, error)

WriteComposeLogV0 requests the log for a compose and writes it to an io.Writer

func WriteComposeLogsV0

func WriteComposeLogsV0(socket *http.Client, w io.Writer, uuid string) (*APIResponse, error)

WriteComposeLogsV0 requests the logs for a compose and writes it to an io.Writer

func WriteComposeMetadataV0

func WriteComposeMetadataV0(socket *http.Client, w io.Writer, uuid string) (*APIResponse, error)

WriteComposeMetadataV0 requests the metadata for a compose and writes it to an io.Writer

func WriteComposeResultsV0

func WriteComposeResultsV0(socket *http.Client, w io.Writer, uuid string) (*APIResponse, error)

WriteComposeResultsV0 requests the results for a compose and writes it to an io.Writer

func (*APIResponse) AllErrors

func (r *APIResponse) AllErrors() (all []string)

AllErrors returns a list of error description strings

func (*APIResponse) String

func (r *APIResponse) String() string

String returns the description of the first error, if there is one

type TestState

type TestState struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL