cockpit

package
v1.0.0-beta.20 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package cockpit provides methods and message types of the cockpit v1beta1 API.

Index

Constants

View Source
const (
	CockpitStatusUnknownStatus = CockpitStatus("unknown_status")
	CockpitStatusCreating      = CockpitStatus("creating")
	CockpitStatusReady         = CockpitStatus("ready")
	CockpitStatusDeleting      = CockpitStatus("deleting")
	CockpitStatusUpdating      = CockpitStatus("updating")
	CockpitStatusError         = CockpitStatus("error")
)
View Source
const (
	GrafanaUserRoleUnknownRole = GrafanaUserRole("unknown_role")
	GrafanaUserRoleEditor      = GrafanaUserRole("editor")
	GrafanaUserRoleViewer      = GrafanaUserRole("viewer")
)
View Source
const (
	ListGrafanaUsersRequestOrderByLoginAsc  = ListGrafanaUsersRequestOrderBy("login_asc")
	ListGrafanaUsersRequestOrderByLoginDesc = ListGrafanaUsersRequestOrderBy("login_desc")
)
View Source
const (
	ListPlansRequestOrderByNameAsc  = ListPlansRequestOrderBy("name_asc")
	ListPlansRequestOrderByNameDesc = ListPlansRequestOrderBy("name_desc")
)
View Source
const (
	ListTokensRequestOrderByCreatedAtAsc  = ListTokensRequestOrderBy("created_at_asc")
	ListTokensRequestOrderByCreatedAtDesc = ListTokensRequestOrderBy("created_at_desc")
	ListTokensRequestOrderByNameAsc       = ListTokensRequestOrderBy("name_asc")
	ListTokensRequestOrderByNameDesc      = ListTokensRequestOrderBy("name_desc")
)
View Source
const (
	PlanNameUnknownName = PlanName("unknown_name")
	PlanNameFree        = PlanName("free")
	PlanNamePremium     = PlanName("premium")
	PlanNameCustom      = PlanName("custom")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API: cockpit API. Cockpit's API allows you to activate your Cockpit on your Projects. Scaleway's Cockpit stores metrics and logs and provides a dedicated Grafana for dashboarding to visualize them.

func NewAPI

func NewAPI(client *scw.Client) *API

NewAPI returns a API object from a Scaleway client.

func (*API) ActivateCockpit

func (s *API) ActivateCockpit(req *ActivateCockpitRequest, opts ...scw.RequestOption) (*Cockpit, error)

ActivateCockpit: activate a Cockpit. Activate the Cockpit of the specified Project ID.

func (*API) CreateContactPoint

func (s *API) CreateContactPoint(req *CreateContactPointRequest, opts ...scw.RequestOption) (*ContactPoint, error)

CreateContactPoint: create a contact point. Create a contact point to receive alerts for the default receiver.

func (*API) CreateGrafanaUser

func (s *API) CreateGrafanaUser(req *CreateGrafanaUserRequest, opts ...scw.RequestOption) (*GrafanaUser, error)

CreateGrafanaUser: create a Grafana user. Create a Grafana user for your Cockpit's Grafana instance. Make sure you save the automatically-generated password and the Grafana user ID.

func (*API) CreateToken

func (s *API) CreateToken(req *CreateTokenRequest, opts ...scw.RequestOption) (*Token, error)

CreateToken: create a token. Create a token associated with the specified Project ID.

func (*API) DeactivateCockpit

func (s *API) DeactivateCockpit(req *DeactivateCockpitRequest, opts ...scw.RequestOption) (*Cockpit, error)

DeactivateCockpit: deactivate a Cockpit. Deactivate the Cockpit of the specified Project ID.

func (*API) DeleteContactPoint

func (s *API) DeleteContactPoint(req *DeleteContactPointRequest, opts ...scw.RequestOption) error

DeleteContactPoint: delete an alert contact point. Delete a contact point for the default receiver.

func (*API) DeleteGrafanaUser

func (s *API) DeleteGrafanaUser(req *DeleteGrafanaUserRequest, opts ...scw.RequestOption) error

DeleteGrafanaUser: delete a Grafana user. Delete a Grafana user from a Grafana instance, specified by the Cockpit's Project ID and the Grafana user ID.

func (*API) DeleteToken

func (s *API) DeleteToken(req *DeleteTokenRequest, opts ...scw.RequestOption) error

DeleteToken: delete a token. Delete the token associated with the specified token ID.

func (*API) DisableManagedAlerts

func (s *API) DisableManagedAlerts(req *DisableManagedAlertsRequest, opts ...scw.RequestOption) error

DisableManagedAlerts: disable managed alerts. Disable the sending of managed alerts for the specified Project's Cockpit.

func (*API) EnableManagedAlerts

func (s *API) EnableManagedAlerts(req *EnableManagedAlertsRequest, opts ...scw.RequestOption) error

EnableManagedAlerts: enable managed alerts. Enable the sending of managed alerts for the specified Project's Cockpit.

func (*API) GetCockpit

func (s *API) GetCockpit(req *GetCockpitRequest, opts ...scw.RequestOption) (*Cockpit, error)

GetCockpit: get a Cockpit. Retrieve the Cockpit of the specified Project ID.

func (*API) GetCockpitMetrics

func (s *API) GetCockpitMetrics(req *GetCockpitMetricsRequest, opts ...scw.RequestOption) (*CockpitMetrics, error)

GetCockpitMetrics: get Cockpit metrics. Get metrics from your Cockpit with the specified Project ID.

func (*API) GetToken

func (s *API) GetToken(req *GetTokenRequest, opts ...scw.RequestOption) (*Token, error)

GetToken: get a token. Retrieve the token associated with the specified token ID.

func (*API) ListContactPoints

func (s *API) ListContactPoints(req *ListContactPointsRequest, opts ...scw.RequestOption) (*ListContactPointsResponse, error)

ListContactPoints: list contact points. Get a list of contact points for the Cockpit associated with the specified Project ID.

func (*API) ListGrafanaUsers

func (s *API) ListGrafanaUsers(req *ListGrafanaUsersRequest, opts ...scw.RequestOption) (*ListGrafanaUsersResponse, error)

ListGrafanaUsers: list Grafana users. Get a list of Grafana users who are able to connect to the Cockpit's Grafana instance.

func (*API) ListPlans

func (s *API) ListPlans(req *ListPlansRequest, opts ...scw.RequestOption) (*ListPlansResponse, error)

ListPlans: list pricing plans. Get a list of all pricing plans available.

func (*API) ListTokens

func (s *API) ListTokens(req *ListTokensRequest, opts ...scw.RequestOption) (*ListTokensResponse, error)

ListTokens: list tokens. Get a list of tokens associated with the specified Project ID.

func (*API) ResetCockpitGrafana

func (s *API) ResetCockpitGrafana(req *ResetCockpitGrafanaRequest, opts ...scw.RequestOption) (*Cockpit, error)

ResetCockpitGrafana: reset a Grafana. Reset your Cockpit's Grafana associated with the specified Project ID.

func (*API) ResetGrafanaUserPassword

func (s *API) ResetGrafanaUserPassword(req *ResetGrafanaUserPasswordRequest, opts ...scw.RequestOption) (*GrafanaUser, error)

ResetGrafanaUserPassword: reset a Grafana user's password. Reset a Grafana user's password specified by the Cockpit's Project ID and the Grafana user ID.

func (*API) SelectPlan

func (s *API) SelectPlan(req *SelectPlanRequest, opts ...scw.RequestOption) (*SelectPlanResponse, error)

SelectPlan: select pricing plan. Select your chosen pricing plan for your Cockpit, specifying the Cockpit's Project ID and the pricing plan's ID in the request.

func (*API) TriggerTestAlert

func (s *API) TriggerTestAlert(req *TriggerTestAlertRequest, opts ...scw.RequestOption) error

TriggerTestAlert: trigger a test alert. Trigger a test alert to all of the Cockpit's receivers.

func (*API) WaitForCockpit

func (s *API) WaitForCockpit(
	req *WaitForCockpitRequest,
	opts ...scw.RequestOption,
) (*Cockpit, error)

type ActivateCockpitRequest

type ActivateCockpitRequest struct {
	// ProjectID: ID of the Project the Cockpit belongs to.
	ProjectID string `json:"project_id"`
}

type Cockpit

type Cockpit struct {
	// ProjectID: ID of the Project the Cockpit belongs to.
	ProjectID string `json:"project_id"`
	// CreatedAt: date and time of the Cockpit's creation.
	CreatedAt *time.Time `json:"created_at"`
	// UpdatedAt: date and time of the Cockpit's last update.
	UpdatedAt *time.Time `json:"updated_at"`
	// Endpoints: endpoints of the Cockpit.
	Endpoints *CockpitEndpoints `json:"endpoints"`
	// Status: status of the Cockpit.
	// Default value: unknown_status
	Status CockpitStatus `json:"status"`
	// ManagedAlertsEnabled: specifies whether managed alerts are enabled or disabled.
	ManagedAlertsEnabled bool `json:"managed_alerts_enabled"`
	// Plan: pricing plan information.
	Plan *Plan `json:"plan"`
}

Cockpit: cockpit.

type CockpitEndpoints

type CockpitEndpoints struct {
	// MetricsURL: URL for metrics.
	MetricsURL string `json:"metrics_url"`
	// LogsURL: URL for logs.
	LogsURL string `json:"logs_url"`
	// AlertmanagerURL: URL for the alert manager.
	AlertmanagerURL string `json:"alertmanager_url"`
	// GrafanaURL: URL for the Grafana dashboard.
	GrafanaURL string `json:"grafana_url"`
}

CockpitEndpoints: cockpit. endpoints.

type CockpitMetrics

type CockpitMetrics struct {
	// Timeseries: time series array.
	Timeseries []*scw.TimeSeries `json:"timeseries"`
}

CockpitMetrics: metrics for a given Cockpit. Cockpit metrics.

type CockpitStatus

type CockpitStatus string

func (CockpitStatus) MarshalJSON

func (enum CockpitStatus) MarshalJSON() ([]byte, error)

func (CockpitStatus) String

func (enum CockpitStatus) String() string

func (*CockpitStatus) UnmarshalJSON

func (enum *CockpitStatus) UnmarshalJSON(data []byte) error

type ContactPoint

type ContactPoint struct {
	// Email: contact point configuration.
	// Precisely one of Email must be set.
	Email *ContactPointEmail `json:"email,omitempty"`
}

ContactPoint: contact point.

type ContactPointEmail

type ContactPointEmail struct {
	To string `json:"to"`
}

type CreateContactPointRequest

type CreateContactPointRequest struct {
	// ProjectID: ID of the Project in which to create the contact point.
	ProjectID string `json:"project_id"`
	// ContactPoint: contact point to create.
	ContactPoint *ContactPoint `json:"contact_point"`
}

type CreateGrafanaUserRequest

type CreateGrafanaUserRequest struct {
	// ProjectID: ID of the Project.
	ProjectID string `json:"project_id"`
	// Login: username of the Grafana user.
	Login string `json:"login"`
	// Role: role assigned to the Grafana user.
	// Default value: unknown_role
	Role GrafanaUserRole `json:"role"`
}

type CreateTokenRequest

type CreateTokenRequest struct {
	// ProjectID: ID of the Project.
	ProjectID string `json:"project_id"`
	// Name: name of the token.
	Name string `json:"name"`
	// Scopes: token's permissions.
	Scopes *TokenScopes `json:"scopes"`
}

type DeactivateCockpitRequest

type DeactivateCockpitRequest struct {
	// ProjectID: ID of the Project the Cockpit belongs to.
	ProjectID string `json:"project_id"`
}

type DeleteContactPointRequest

type DeleteContactPointRequest struct {
	// ProjectID: ID of the Project.
	ProjectID string `json:"project_id"`
	// ContactPoint: contact point to delete.
	ContactPoint *ContactPoint `json:"contact_point"`
}

type DeleteGrafanaUserRequest

type DeleteGrafanaUserRequest struct {
	// GrafanaUserID: ID of the Grafana user.
	GrafanaUserID uint32 `json:"-"`
	// ProjectID: ID of the Project.
	ProjectID string `json:"project_id"`
}

type DeleteTokenRequest

type DeleteTokenRequest struct {
	// TokenID: ID of the token.
	TokenID string `json:"-"`
}

type DisableManagedAlertsRequest

type DisableManagedAlertsRequest struct {
	// ProjectID: ID of the Project.
	ProjectID string `json:"project_id"`
}

type EnableManagedAlertsRequest

type EnableManagedAlertsRequest struct {
	// ProjectID: ID of the Project.
	ProjectID string `json:"project_id"`
}

type GetCockpitMetricsRequest

type GetCockpitMetricsRequest struct {
	// ProjectID: ID of the Project the Cockpit belongs to.
	ProjectID string `json:"-"`
	// StartDate: desired time range's start date for the metrics.
	StartDate *time.Time `json:"-"`
	// EndDate: desired time range's end date for the metrics.
	EndDate *time.Time `json:"-"`
	// MetricName: name of the metric requested.
	MetricName *string `json:"-"`
}

type GetCockpitRequest

type GetCockpitRequest struct {
	// ProjectID: ID of the Project the Cockpit belongs to.
	ProjectID string `json:"-"`
}

type GetTokenRequest

type GetTokenRequest struct {
	// TokenID: ID of the token.
	TokenID string `json:"-"`
}

type GrafanaUser

type GrafanaUser struct {
	// ID: ID of the Grafana user.
	ID uint32 `json:"id"`
	// Login: username of the Grafana user.
	Login string `json:"login"`
	// Role: role assigned to the Grafana user.
	// Default value: unknown_role
	Role GrafanaUserRole `json:"role"`
	// Password: the Grafana user's password.
	Password *string `json:"password"`
}

GrafanaUser: grafana user.

type GrafanaUserRole

type GrafanaUserRole string

func (GrafanaUserRole) MarshalJSON

func (enum GrafanaUserRole) MarshalJSON() ([]byte, error)

func (GrafanaUserRole) String

func (enum GrafanaUserRole) String() string

func (*GrafanaUserRole) UnmarshalJSON

func (enum *GrafanaUserRole) UnmarshalJSON(data []byte) error

type ListContactPointsRequest

type ListContactPointsRequest struct {
	// Page: page number.
	Page *int32 `json:"-"`
	// PageSize: page size.
	PageSize *uint32 `json:"-"`
	// ProjectID: ID of the Project from which to list the contact points.
	ProjectID string `json:"-"`
}

type ListContactPointsResponse

type ListContactPointsResponse struct {
	// TotalCount: count of all contact points created.
	TotalCount uint32 `json:"total_count"`
	// ContactPoints: array of contact points.
	ContactPoints []*ContactPoint `json:"contact_points"`
	// HasAdditionalReceivers: specifies whether the contact point has other receivers than the default receiver.
	HasAdditionalReceivers bool `json:"has_additional_receivers"`
	// HasAdditionalContactPoints: specifies whether there are unmanaged contact points.
	HasAdditionalContactPoints bool `json:"has_additional_contact_points"`
}

ListContactPointsResponse: response returned when listing contact points. List contact points response.

func (*ListContactPointsResponse) UnsafeAppend

func (r *ListContactPointsResponse) UnsafeAppend(res interface{}) (uint32, error)

UnsafeAppend should not be used Internal usage only

func (*ListContactPointsResponse) UnsafeGetTotalCount

func (r *ListContactPointsResponse) UnsafeGetTotalCount() uint32

UnsafeGetTotalCount should not be used Internal usage only

type ListGrafanaUsersRequest

type ListGrafanaUsersRequest struct {
	// Page: page number.
	Page *int32 `json:"-"`
	// PageSize: page size.
	PageSize *uint32 `json:"-"`
	// OrderBy: default value: login_asc
	OrderBy ListGrafanaUsersRequestOrderBy `json:"-"`
	// ProjectID: ID of the Project.
	ProjectID string `json:"-"`
}

type ListGrafanaUsersRequestOrderBy

type ListGrafanaUsersRequestOrderBy string

func (ListGrafanaUsersRequestOrderBy) MarshalJSON

func (enum ListGrafanaUsersRequestOrderBy) MarshalJSON() ([]byte, error)

func (ListGrafanaUsersRequestOrderBy) String

func (enum ListGrafanaUsersRequestOrderBy) String() string

func (*ListGrafanaUsersRequestOrderBy) UnmarshalJSON

func (enum *ListGrafanaUsersRequestOrderBy) UnmarshalJSON(data []byte) error

type ListGrafanaUsersResponse

type ListGrafanaUsersResponse struct {
	// TotalCount: count of all Grafana users.
	TotalCount uint32 `json:"total_count"`
	// GrafanaUsers: information on all Grafana users.
	GrafanaUsers []*GrafanaUser `json:"grafana_users"`
}

ListGrafanaUsersResponse: response returned when listing Grafana users. List grafana users response.

func (*ListGrafanaUsersResponse) UnsafeAppend

func (r *ListGrafanaUsersResponse) UnsafeAppend(res interface{}) (uint32, error)

UnsafeAppend should not be used Internal usage only

func (*ListGrafanaUsersResponse) UnsafeGetTotalCount

func (r *ListGrafanaUsersResponse) UnsafeGetTotalCount() uint32

UnsafeGetTotalCount should not be used Internal usage only

type ListPlansRequest

type ListPlansRequest struct {
	// Page: page number.
	Page *int32 `json:"-"`
	// PageSize: page size.
	PageSize *uint32 `json:"-"`
	// OrderBy: default value: name_asc
	OrderBy ListPlansRequestOrderBy `json:"-"`
}

type ListPlansRequestOrderBy

type ListPlansRequestOrderBy string

func (ListPlansRequestOrderBy) MarshalJSON

func (enum ListPlansRequestOrderBy) MarshalJSON() ([]byte, error)

func (ListPlansRequestOrderBy) String

func (enum ListPlansRequestOrderBy) String() string

func (*ListPlansRequestOrderBy) UnmarshalJSON

func (enum *ListPlansRequestOrderBy) UnmarshalJSON(data []byte) error

type ListPlansResponse

type ListPlansResponse struct {
	// TotalCount: count of all pricing plans.
	TotalCount uint64 `json:"total_count"`
	// Plans: information on plans.
	Plans []*Plan `json:"plans"`
}

ListPlansResponse: response returned when listing all pricing plans. List plans response.

func (*ListPlansResponse) UnsafeAppend

func (r *ListPlansResponse) UnsafeAppend(res interface{}) (uint64, error)

UnsafeAppend should not be used Internal usage only

func (*ListPlansResponse) UnsafeGetTotalCount

func (r *ListPlansResponse) UnsafeGetTotalCount() uint64

UnsafeGetTotalCount should not be used Internal usage only

type ListTokensRequest

type ListTokensRequest struct {
	// Page: page number.
	Page *int32 `json:"-"`
	// PageSize: page size.
	PageSize *uint32 `json:"-"`
	// OrderBy: default value: created_at_asc
	OrderBy ListTokensRequestOrderBy `json:"-"`
	// ProjectID: ID of the Project.
	ProjectID string `json:"-"`
}

type ListTokensRequestOrderBy

type ListTokensRequestOrderBy string

func (ListTokensRequestOrderBy) MarshalJSON

func (enum ListTokensRequestOrderBy) MarshalJSON() ([]byte, error)

func (ListTokensRequestOrderBy) String

func (enum ListTokensRequestOrderBy) String() string

func (*ListTokensRequestOrderBy) UnmarshalJSON

func (enum *ListTokensRequestOrderBy) UnmarshalJSON(data []byte) error

type ListTokensResponse

type ListTokensResponse struct {
	// TotalCount: count of all tokens created.
	TotalCount uint32 `json:"total_count"`
	// Tokens: list of all tokens created.
	Tokens []*Token `json:"tokens"`
}

ListTokensResponse: list tokens response.

func (*ListTokensResponse) UnsafeAppend

func (r *ListTokensResponse) UnsafeAppend(res interface{}) (uint32, error)

UnsafeAppend should not be used Internal usage only

func (*ListTokensResponse) UnsafeGetTotalCount

func (r *ListTokensResponse) UnsafeGetTotalCount() uint32

UnsafeGetTotalCount should not be used Internal usage only

type Plan

type Plan struct {
	// ID: ID of a given pricing plan.
	ID string `json:"id"`
	// Name: name of a given pricing plan.
	// Default value: unknown_name
	Name PlanName `json:"name"`
	// RetentionMetricsInterval: retention for metrics.
	RetentionMetricsInterval *scw.Duration `json:"retention_metrics_interval"`
	// RetentionLogsInterval: retention for logs.
	RetentionLogsInterval *scw.Duration `json:"retention_logs_interval"`
	// SampleIngestionPrice: ingestion price for 1 million samples in cents.
	SampleIngestionPrice uint32 `json:"sample_ingestion_price"`
	// LogsIngestionPrice: ingestion price for 1 GB of logs in cents.
	LogsIngestionPrice uint32 `json:"logs_ingestion_price"`
	// RetentionPrice: retention price in euros per month.
	RetentionPrice uint32 `json:"retention_price"`
}

Plan: pricing plan. Plan.

type PlanName

type PlanName string

func (PlanName) MarshalJSON

func (enum PlanName) MarshalJSON() ([]byte, error)

func (PlanName) String

func (enum PlanName) String() string

func (*PlanName) UnmarshalJSON

func (enum *PlanName) UnmarshalJSON(data []byte) error

type ResetCockpitGrafanaRequest

type ResetCockpitGrafanaRequest struct {
	// ProjectID: ID of the Project the Cockpit belongs to.
	ProjectID string `json:"project_id"`
}

type ResetGrafanaUserPasswordRequest

type ResetGrafanaUserPasswordRequest struct {
	// GrafanaUserID: ID of the Grafana user.
	GrafanaUserID uint32 `json:"-"`
	// ProjectID: ID of the Project.
	ProjectID string `json:"project_id"`
}

type SelectPlanRequest

type SelectPlanRequest struct {
	// ProjectID: ID of the Project.
	ProjectID string `json:"project_id"`
	// PlanID: ID of the pricing plan.
	PlanID string `json:"plan_id"`
}

type SelectPlanResponse

type SelectPlanResponse struct {
}

SelectPlanResponse: response returned when selecting a pricing plan. Select plan response.

type Token

type Token struct {
	// ID: ID of the token.
	ID string `json:"id"`
	// ProjectID: ID of the Project.
	ProjectID string `json:"project_id"`
	// Name: name of the token.
	Name string `json:"name"`
	// CreatedAt: date and time of the token's creation.
	CreatedAt *time.Time `json:"created_at"`
	// UpdatedAt: date and time of the token's last update.
	UpdatedAt *time.Time `json:"updated_at"`
	// Scopes: token's permissions.
	Scopes *TokenScopes `json:"scopes"`
	// SecretKey: token's secret key.
	SecretKey *string `json:"secret_key"`
}

Token: token.

type TokenScopes

type TokenScopes struct {
	// QueryMetrics: permission to fetch metrics.
	QueryMetrics bool `json:"query_metrics"`
	// WriteMetrics: permission to write metrics.
	WriteMetrics bool `json:"write_metrics"`
	// SetupMetricsRules: permission to setup metrics rules.
	SetupMetricsRules bool `json:"setup_metrics_rules"`
	// QueryLogs: permission to fetch logs.
	QueryLogs bool `json:"query_logs"`
	// WriteLogs: permission to write logs.
	WriteLogs bool `json:"write_logs"`
	// SetupLogsRules: permission to setup logs rules.
	SetupLogsRules bool `json:"setup_logs_rules"`
	// SetupAlerts: permission to setup alerts.
	SetupAlerts bool `json:"setup_alerts"`
}

TokenScopes: token scopes.

type TriggerTestAlertRequest

type TriggerTestAlertRequest struct {
	ProjectID string `json:"project_id"`
}

type WaitForCockpitRequest

type WaitForCockpitRequest struct {
	ProjectID     string
	Timeout       *time.Duration
	RetryInterval *time.Duration
}

WaitForCockpitRequest is used by WaitForCockpit method.

Jump to

Keyboard shortcuts

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