client

package
v0.0.0-...-4f679da Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Children

type Children struct {
	Children    *Children  `json:"children"`
	Definition  Definition `json:"definition"`
	Description string     `json:"description"`
	Groups      []string   `json:"groups"`
	Name        string     `json:"name"`
	Tag         string     `json:"tag"`
	Type        string     `json:"type"`
}

type Client

type Client struct {
	ApiKey     string
	HTTPClient *http.Client
}

Cortex API Client

func NewClient

func NewClient(apikey string) *Client

NewClient() returns a new HTTP Client for Cortex it requires a valid API Key (Bearer token).

func (*Client) Send

func (c *Client) Send(ctx *context.Context, req *Request) (*Response, error)

Send HTTP Request Method given a context and a request pointers, sends the http request and returns a response object

type Definition

type Definition struct {
	Definition any `json:"definition"`
}

type Email

type Email struct {
	Description string `json:"description"`
	Email       string `json:"email"`
	Inheritance string `json:"inheritance"`
}

type ErrorResponse

type ErrorResponse struct {
	Details           string `json:"details"`
	GatewayHTTPStatus int32  `json:"gatewayHttpStatus"`
	HTTPStatus        int32  `json:"httpStatus"`
	Message           string `json:"message"`
	RequestID         string `json:"requestId"`
	Type              string `json:"type"`
}

type Git

type Git struct {
	Alias         string `json:"alias"`
	Basepath      string `json:"basepath"`
	Provider      string `json:"provider"`
	Repository    string `json:"repository"`
	RepositoryURL string `json:"repositoryUrl"`
}

type Group

type Group struct {
	Description string `json:"description"`
	GroupName   string `json:"groupName"`
	Inheritance string `json:"inheritance"`
	Provider    string `json:"provider"`
}

type Hierarchy

type Hierarchy struct {
	Children []Children `json:"children"`
	Parents  []Parents  `json:"parents"`
}

type Individual

type Individual struct {
	Description string `json:"description"`
	Email       string `json:"email"`
}
type Link struct {
	Name string `json:"name"`
	Type string `json:"type"`
	Url  string `json:"url"`
}

type Metadata

type Metadata struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type OwnersV2

type OwnersV2 struct {
	Individuals []Individual `json:"individuals"`
	Teams       []Team       `json:"teams"`
}

type Ownership

type Ownership struct {
	Emails []Email `json:"emails"`
	Groups []Group `json:"groups"`
}

type Parameters

type Parameters struct {
	Tag string `json:"tag,omitempty"`
}

HTTP Request parameters So far I've only added the entity tag (x-cortex-tag) that identifies the entity.

type Parents

type Parents struct {
	Definition  Definition `json:"definition"`
	Description string     `json:"description"`
	Groups      []string   `json:"groups"`
	Name        string     `json:"name"`
	Parents     *Parents   `json:"parents"`
	Tag         string     `json:"tag"`
	Type        string     `json:"type"`
}

type Request

type Request struct {
	Payload *http.Request
}

Request struct

func NewRequest

func NewRequest(ctx *context.Context, method, baseurl, path string, headers ...map[string]string) (*Request, error)

Returns new Request instance The parameters accepted by the function are: 1. A pointer to a context. 2. The HTTP method (case insensitive). 3. The Base URL for the API call. 4. The path inside the above Base URL (resource route). 5. (Optionally) custom headers for the request.

type Response

type Response struct {
	Success         bool            `json:"ok"`
	ErrorResponse   ErrorResponse   `json:"error,omitempty"`
	SuccessResponse SuccessResponse `json:"success,omitempty"`
}

type SlackChannel

type SlackChannel struct {
	Description          string `json:"description"`
	Name                 string `json:"name"`
	NotificationsEnabled bool   `json:"notificationsEnabled"`
}

type SuccessResponse

type SuccessResponse struct {
	Definition    Definition     `json:"definition"`
	Description   string         `json:"description"`
	Git           Git            `json:"git"`
	Groups        []string       `json:"groups"`
	Hierarchy     Hierarchy      `json:"hierarchy"`
	IsArchived    bool           `json:"isArchived"`
	LastUpdated   string         `json:"lastUpdated"` //TODO: use time.Time, RFC3339 ?
	Links         []Link         `json:"links"`
	Metadata      []Metadata     `json:"metadata"`
	Name          string         `json:"name"`
	OwnersV2      OwnersV2       `json:"ownersV2"`
	Ownership     Ownership      `json:"ownership"`
	SlackChannels []SlackChannel `json:"slackChannels"`
	Tag           string         `json:"tag"`
	Type          string         `json:"type"`
}

type Team

type Team struct {
	Description string `json:"description"`
	IsArchived  bool   `json:"isArchived"`
	Name        string `json:"name"`
	Tag         string `json:"tag"`
}

Jump to

Keyboard shortcuts

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