sources

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SourceTypesEndpoint The endpoint for retrieving source types.
	SourceTypesEndpoint string = "source_types"

	// OpenShiftSourceType The value to query to find the source type ID.
	OpenShiftSourceType string = "openshift"

	// ApplicationTypesEndpoint The endpoint for retrieving application types.
	ApplicationTypesEndpoint string = "application_types"

	// CostManagementAppType The value to query to find the application ID
	CostManagementAppType string = "/insights/platform/cost-management"

	// SourcesEndpoint The endpoint for retrieving and creating sources.
	SourcesEndpoint string = "sources"

	// NameFilterQueryParam The keyword for filtering by name via query parameter.
	NameFilterQueryParam string = "filter[name]"

	// SourceTypeIDFilterQueryParam The keyword for filtering by source_type_id via query parameter.
	SourceTypeIDFilterQueryParam string = "filter[source_type_id]"

	// SourceRefFilterQueryParam The keyword for filtering by source_ref via query parameter.
	SourceRefFilterQueryParam string = "filter[source_ref]"

	// ApplicationsEndpoint The endpoint for associating a source with an application.
	ApplicationsEndpoint string = "applications"
)

Variables

This section is empty.

Functions

func GetApplicationTypeID

func GetApplicationTypeID(sSpec *SourceSpec, client crhchttp.HTTPClient) (string, error)

GetApplicationTypeID Request the application type ID for Cost Management

func GetSourceTypeID

func GetSourceTypeID(sSpec *SourceSpec, client crhchttp.HTTPClient) (string, error)

GetSourceTypeID Request the source type ID for OpenShift

func GetSources added in v0.9.3

func GetSources(sSpec *SourceSpec, client crhchttp.HTTPClient) ([]byte, error)

GetSources does a basic get request to the sources endpoint

func PostApplication

func PostApplication(sSpec *SourceSpec, client crhchttp.HTTPClient, source *SourceItem, appTypeID string) error

PostApplication Associate a source with an application

func SourceGetOrCreate

func SourceGetOrCreate(sSpec *SourceSpec, client crhchttp.HTTPClient) (bool, metav1.Time, error)

SourceGetOrCreate Check if source exists, if not create the source if specified

Types

type ApplicationTypeDataItem

type ApplicationTypeDataItem struct {
	ID   string
	Name string
}

ApplicationTypeDataItem A data structure for the application type item

type ApplicationTypeResponse

type ApplicationTypeResponse struct {
	Meta GenericMeta
	Data []ApplicationTypeDataItem
}

ApplicationTypeResponse A data structure for the paginated application type response

type GenericMeta

type GenericMeta struct {
	Count int
}

GenericMeta A data structure for the meta data in a paginated response

type SourceItem

type SourceItem struct {
	ID           string
	Name         string
	SourceTypeID string `json:"source_type_id"`
	SourceRef    string `json:"source_ref"`
}

SourceItem A data structure for the source type item

func CheckSourceExists

func CheckSourceExists(sSpec *SourceSpec, client crhchttp.HTTPClient, sourceTypeID, name, sourceRef string) (*SourceItem, error)

CheckSourceExists Determine if the source exists with given parameters

func PostSource

func PostSource(sSpec *SourceSpec, client crhchttp.HTTPClient, sourceTypeID string) (*SourceItem, error)

PostSource Creates a source with the provided name and cluster ID

func SourceCreate

func SourceCreate(sSpec *SourceSpec, client crhchttp.HTTPClient, sourceTypeID string) (*SourceItem, error)

SourceCreate Creates a source with the provided name and cluster ID

type SourceResponse

type SourceResponse struct {
	Meta GenericMeta
	Data []SourceItem
}

SourceResponse A data structure for the paginated source response

type SourceSpec

type SourceSpec struct {
	APIURL string
	Auth   *crhchttp.AuthConfig
	Spec   kokumetricscfgv1beta1.CloudDotRedHatSourceStatus
	Log    logr.Logger
}

type SourceTypeDataItem

type SourceTypeDataItem struct {
	ID   string
	Name string
}

SourceTypeDataItem A data structure for the source type item

type SourceTypeResponse

type SourceTypeResponse struct {
	Meta GenericMeta
	Data []SourceTypeDataItem
}

SourceTypeResponse A data structure for the paginated source type response

Jump to

Keyboard shortcuts

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