package
3.0.4+incompatible
Repository: https://github.com/stackvista/stackstate-cli.git
Documentation: pkg.go.dev

# README

Go API client for stackstate_api

This API documentation page describes the StackState server API. The StackState UI and CLI use the StackState server API to configure and query StackState. You can use the API for similar purposes.

Each request sent to the StackState server API must be authenticated using one of the available authentication methods.

Note that the StackState receiver API, used to send topology, telemetry and traces to StackState, is not described on this page and requires a different authentication method.

For more information on StackState, refer to the StackState documentation.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 5.2.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://stackstate.com

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import stackstate_api "gitlab.com/stackvista/stackstate-cli2"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), stackstate_api.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), stackstate_api.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), stackstate_api.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), stackstate_api.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://localhost

ClassMethodHTTP requestDescription
AgentLeasesApiAgentCheckLeasePost /agents/{agentId}/checkLeaseCheck the lease of an agent.
AgentRegistrationsApiAllAgentRegistrationsGet /agentsOverview of registered agents
ApiTokenApiGetCurrentUserApiTokensGet /user/profile/tokensGet current user's API tokens
AuthorizeIngestionApiKeyApiAuthorizeIngestionApiKeyPost /security/ingestion/authorizeCheck authorization for an Ingestion Api Key
ComponentApiGetComponentHealthHistoryGet /components/{componentIdOrUrn}/healthHistoryGet a component health history
DummyApiDummyGet /dummy/dummyDummy path to fix omission in openapi generation when a type is not included.
EventApiGetEventGet /events/{eventId}Get single event
EventApiGetEventSourcesGet /eventSourcesGet event sources
EventApiGetEventTagsGet /eventTagsGet event tags
EventApiGetEventTypesGet /eventTypesGet event types
EventApiGetEventsPost /eventsGet events
EventApiGetEventsHistogramPost /eventsHistogramGet events histogram
ExportApiExportSettingsPost /exportExport settings
HealthSynchronizationApiDeleteHealthSynchronizationStreamDelete /synchronization/health/streams/{healthStreamUrn}Delete health sync stream
HealthSynchronizationApiGetHealthSynchronizationStreamStatusGet /synchronization/health/streams/{healthStreamUrn}/statusGet health sync stream status
HealthSynchronizationApiGetHealthSynchronizationStreamTopologyMatchesGet /synchronization/health/streams/{healthStreamUrn}/topologyMatchesList health sync stream check-states
HealthSynchronizationApiGetHealthSynchronizationStreamsOverviewGet /synchronization/health/streamsList health sync streams
HealthSynchronizationApiGetHealthSynchronizationSubStreamOverviewGet /synchronization/health/streams/{healthStreamUrn}/substreamsList health sync sub-streams
HealthSynchronizationApiGetHealthSynchronizationSubStreamStatusGet /synchronization/health/streams/{healthStreamUrn}/substreams/{healthSyncSubStreamId}/statusGet health sync sub-stream status
HealthSynchronizationApiGetHealthSynchronizationSubStreamTopologyMatchesGet /synchronization/health/streams/{healthStreamUrn}/substreams/{healthSyncSubStreamId}/topologyMatchesList health sync sub-stream check-states
HealthSynchronizationApiPostHealthSynchronizationStreamClearErrorsPost /synchronization/health/streams/{healthStreamUrn}/clearErrorsClear health sync stream errors
ImportApiImportSettingsPost /importImport settings
IngestionApiKeyApiDeleteIngestionApiKeyDelete /security/ingestion/api_keys/{ingestionApiKeyId}Delete Ingestion Api Key
IngestionApiKeyApiGenerateIngestionApiKeyPost /security/ingestion/api_keysGenerate a new Ingestion Api Key
IngestionApiKeyApiGetIngestionApiKeysGet /security/ingestion/api_keysList Ingestion Api Keys
KubernetesLogsApiGetKubernetesLogsGet /k8s/logsGet Kubernetes logs
KubernetesLogsApiGetKubernetesLogsAutocompleteGet /k8s/logs/autocompleteGet Kubernetes logs autocomplete values
KubernetesLogsApiGetKubernetesLogsHistogramGet /k8s/logs/histogramGet Kubernetes logs histogram
LayoutApiGetAllLayoutsGet /layoutsList layout hints
MetricApiGetExemplarsQueryGet /metrics/query_exemplarsExperimental: Exemplars for a specific time range
MetricApiGetInstantQueryGet /metrics/queryInstant query at a single point in time
MetricApiGetLabelValuesGet /metrics/label/{label}/valuesList of label values for a provided label name
MetricApiGetLabelsGet /metrics/labelsList of label names
MetricApiGetMetadataGet /metrics/metadataMetadata about metrics currently scraped from targets
MetricApiGetRangeQueryGet /metrics/query_rangeQuery over a range of time
MetricApiGetSeriesGet /metrics/seriesList of time series that match a certain label set
MetricApiPostExemplarsQueryPost /metrics/query_exemplarsExperimental: Exemplars for a specific time range
MetricApiPostInstantQueryPost /metrics/queryInstant query at a single point in time
MetricApiPostLabelValuesPost /metrics/label/{label}/valuesList of label values for a provided label name
MetricApiPostLabelsPost /metrics/labelsList of label names
MetricApiPostMetadataPost /metrics/metadataMetadata about metrics currently scraped from targets
MetricApiPostRangeQueryPost /metrics/query_rangeQuery over a range of time
MetricApiPostSeriesPost /metrics/seriesList of time series that match a certain label set
MonitorApiDeleteMonitorDelete /monitors/{monitorIdOrUrn}Delete a monitor
MonitorApiGetAllMonitorsGet /monitorsList monitors
MonitorApiGetMonitorGet /monitors/{monitorIdOrUrn}Get a monitor
MonitorApiGetMonitorCheckStatesGet /monitors/{monitorIdOrUrn}/checkStatesGet the check states for a monitor
MonitorApiGetMonitorWithStatusGet /monitors/{monitorIdOrUrn}/statusGet a monitor with stream information
MonitorApiGetMonitorsOverviewGet /monitors/overviewList monitors overview
MonitorApiLookupIdentifierPost /monitors/identifierLookupMultiple component identifier lookup
MonitorApiPatchMonitorPatch /monitors/{monitorIdOrUrn}Update some monitor properties
MonitorApiPreviewMonitorPost /monitors/{monitorIdOrUrn}/previewPreview a monitor
MonitorApiPreviewMonitorCheckStatesPost /monitors/{monitorIdOrUrn}/preview/checkStatesPreview a monitor
MonitorApiPublishHealthStatesPost /monitors/{monitorIdOrUrn}/publishPost monitor health states
MonitorApiRunMonitorPost /monitors/{monitorIdOrUrn}/runRun a monitor
MonitorApiTestMonitorFunctionPost /monitors/{monitorFunctionIdOrUrn}/testTest a monitor
MonitorApiTestMonitorFunctionCheckStatesPost /monitors/{monitorFunctionIdOrUrn}/test/checkStatesTest a monitor
MonitorCheckStatusApiGetMonitorCheckStatusGet /monitor/checkStatus/{id}Get a monitor check status
MonitorCheckStatusApiGetMonitorCheckStatusHealthHistoryGet /monitor/checkStatus/{id}/healthHistoryGet a monitor check health history
MonitorCheckStatusApiGetMonitorCheckStatusRelatedFailuresGet /monitor/checkStatus/{id}/relatedFailuresGet a monitor check related failures
NodeApiClonePost /node/{nodeType}/{nodeIdOrUrn}/cloneClone a node with a new name
NodeApiDeleteDelete /node/{nodeType}/{nodeId}Node deletion API
NodeApiLockGet /node/{nodeType}/{nodeId}/islockedRetrieve if a node is locked
NodeApiNodeListTypesGet /nodeNode API
NodeApiTypeListGet /node/{nodeType}Node type API
NodeApiUnlockPost /node/{nodeType}/{nodeId}/unlockNode unlock API
NotificationChannelsApiCreateEmailNotificationChannelPost /notifications/channels/emailCreate a Email Notification channel
NotificationChannelsApiCreateOpsgenieNotificationChannelPost /notifications/channels/opsgenieCreate a Opsgenie Notification channel
NotificationChannelsApiCreateTeamsNotificationChannelPost /notifications/channels/teamsCreate a Teams Notification channel
NotificationChannelsApiCreateWebhookNotificationChannelPost /notifications/channels/webhookCreate a Webhook Notification channel
NotificationChannelsApiDeleteEmailNotificationChannelDelete /notifications/channels/email/{channelId}Delete the Email Notification channel by id
NotificationChannelsApiDeleteOpsgenieNotificationChannelDelete /notifications/channels/opsgenie/{channelId}Delete the Opsgenie Notification channel by id
NotificationChannelsApiDeleteSlackNotificationChannelDelete /notifications/channels/slack/{channelId}Delete the Slack Notification channel by id
NotificationChannelsApiDeleteTeamsNotificationChannelDelete /notifications/channels/teams/{channelId}Delete the Teams Notification channel by id
NotificationChannelsApiDeleteWebhookNotificationChannelDelete /notifications/channels/webhook/{channelId}Delete the Webhook Notification channel by id
NotificationChannelsApiGetEmailNotificationChannelGet /notifications/channels/email/{channelId}Get the Email Notification channel by id
NotificationChannelsApiGetEmailNotificationStatusGet /notifications/channels/email/statusEmail Notification channel status
NotificationChannelsApiGetOpsgenieNotificationChannelGet /notifications/channels/opsgenie/{channelId}Get the Opsgenie Notification channel by id
NotificationChannelsApiGetSlackNotificationChannelGet /notifications/channels/slack/{channelId}Get the Slack Notification channel by id
NotificationChannelsApiGetTeamsNotificationChannelGet /notifications/channels/teams/{channelId}Get the Teams Notification channel by id
NotificationChannelsApiGetWebhookNotificationChannelGet /notifications/channels/webhook/{channelId}Get the Webhook Notification channel by id
NotificationChannelsApiJoinSlackChannelPost /notifications/channels/slack/{channelId}/joinSlackChannelJoin the specified Slack channel to send notifications
NotificationChannelsApiListOpsgenieRespondersGet /notifications/channels/opsgenie/respondersList Opsgenie responders
NotificationChannelsApiListSlackChannelsGet /notifications/channels/slack/{channelId}/listSlackChannelsList all public Slack channels
NotificationChannelsApiSlackOAuthCallbackGet /notifications/channels/slack/oauth-callbackThe OAuth callback for Slack
NotificationChannelsApiSlackOauthRedirectGet /notifications/channels/slack/oauth-redirectStarts Slack OAuth2 flow
NotificationChannelsApiTestEmailChannelPost /notifications/channels/email/{channelId}/testTest the Email notification channel
NotificationChannelsApiTestOpsgenieChannelPost /notifications/channels/opsgenie/{channelId}/testTest the Opsgenie notification channel
NotificationChannelsApiTestSlackChannelPost /notifications/channels/slack/{channelId}/testTest the Notification channel
NotificationChannelsApiTestTeamsChannelPost /notifications/channels/teams/{channelId}/testTest the Teams notification channel
NotificationChannelsApiTestWebhookChannelPost /notifications/channels/webhook/{channelId}/testTest the Webhook notification channel
NotificationChannelsApiUpdateEmailNotificationChannelPut /notifications/channels/email/{channelId}Update the Email Notification channel by id
NotificationChannelsApiUpdateOpsgenieNotificationChannelPut /notifications/channels/opsgenie/{channelId}Update the Opsgenie Notification channel by id
NotificationChannelsApiUpdateTeamsNotificationChannelPut /notifications/channels/teams/{channelId}Update the Teams Notification channel by id
NotificationChannelsApiUpdateWebhookNotificationChannelPut /notifications/channels/webhook/{channelId}Update the Webhook Notification channel by id
NotificationConfigurationsApiCreateNotificationConfigurationPost /notifications/configurationsCreate a new notification configuration
NotificationConfigurationsApiDeleteNotificationConfigurationDelete /notifications/configurations/{notificationConfigurationIdOrUrn}Delete the notification configuration
NotificationConfigurationsApiGetNotificationConfigurationGet /notifications/configurations/{notificationConfigurationIdOrUrn}Get the notification configuration
NotificationConfigurationsApiGetNotificationConfigurationChannelsGet /notifications/configurations/{notificationConfigurationIdOrUrn}/channelsGet the channels for the notification configuration
NotificationConfigurationsApiGetNotificationConfigurationsGet /notifications/configurationsGet all notification configurations
NotificationConfigurationsApiUpdateNotificationConfigurationPut /notifications/configurations/{notificationConfigurationIdOrUrn}Update the notification configuration
PermissionsApiDescribePermissionsGet /security/permissions/{subject}Describe permissions
PermissionsApiGetPermissionsGet /security/permissions/listList permissions
PermissionsApiGrantPermissionsPost /security/permissions/{subject}Grant permissions
PermissionsApiRevokePermissionsDelete /security/permissions/{subject}Revoke permissions
ProblemApiGetProblemCausingEventsGet /problems/{problemId}/causing-eventsList possible events which led to the problem
ScriptingApiScriptExecutePost /script/executeExecute script
ServerApiServerInfoGet /server/infoGet server info
ServiceTokenApiCreateNewServiceTokenPost /security/tokensCreate new service token
ServiceTokenApiDeleteServiceTokenDelete /security/tokens/{serviceTokenId}Delete service token
ServiceTokenApiGetServiceTokensGet /security/tokensGet service tokens
StackpackApiConfirmManualStepsPost /stackpack/{stackPackName}/confirm-manual-steps/{stackPackInstanceId}Confirm manual steps
StackpackApiProvisionDetailsPost /stackpack/{stackPackName}/provisionProvision API
StackpackApiProvisionUninstallPost /stackpack/{stackPackName}/deprovision/{stackPackInstanceId}Provision API
StackpackApiStackPackListGet /stackpackStackPack API
StackpackApiStackPackUploadPost /stackpackStackPack API
StackpackApiUpgradeStackPackPost /stackpack/{stackPackName}/upgradeUpgrade API
SubjectApiCreateSubjectPut /security/subjects/{subject}Create a subject
SubjectApiDeleteSubjectDelete /security/subjects/{subject}Delete a subject
SubjectApiGetSubjectGet /security/subjects/{subject}Get subject
SubjectApiListSubjectsGet /security/subjectsList subjects
SubscriptionApiGetSubscriptionGet /subscriptionGet subscription info
SubscriptionApiPostSubscriptionPost /subscriptionSubmit a new license to update the subscription
SystemNotificationsApiAllSystemNotificationsGet /system/notificationsOverview of system notifications
TopicApiDescribeGet /topic/{topic}Describe a topic
TopicApiListGet /topicList topics
TopologySynchronizationApiGetTopologySynchronizationStreamByIdGet /synchronization/topology/streams/syncOverview of a specific Topology Stream, queried by node id or sync identifier
TopologySynchronizationApiGetTopologySynchronizationStreamStatusByIdGet /synchronization/topology/streams/statusMetrics of a specific Topology Stream, queried by node id
TopologySynchronizationApiGetTopologySynchronizationStreamsGet /synchronization/topology/streamsOverview of the topology synchronization streams
TopologySynchronizationApiPostTopologySynchronizationStreamClearErrorsPost /synchronization/topology/streams/clearErrorsClear all the errors related to a specific sync
TracesApiGetSpanGet /traces/{traceId}/spans/{spanId}Get a span
TracesApiGetTraceGet /traces/{traceId}Fetch a trace
TracesApiQueryDurationPost /traces/spans/duration/histogramQuery duration distribution
TracesApiQuerySpansPost /traces/spansQuery for spans
TracesApiSpanComponentsPost /traces/componentsFetch components based on resource attributes
TracesApiSuggestionsAttributeNameGet /traces/spans/fields/attributesSuggestions for attribute names
TracesApiSuggestionsAttributeValueGet /traces/spans/fields/attributes/{attributeName}/valuesSuggestions for attribute values
TracesApiSuggestionsFieldValuesGet /traces/spans/fields/{field}/valuesSuggestions for span fields
UserProfileApiGetCurrentUserProfileGet /user/profileGet current user profile
UserProfileApiSaveCurrentUserProfilePut /user/profileSave current user profile
UserSessionApiGetUserSessionAssumedRoleGet /user/session/assumedRoleGet the assumed a role for the current session
UserSessionApiGetUserSessionAvailableRolesGet /user/session/availableRolesGet a list of available roles for this session
UserSessionApiSaveUserSessionAssumedRolePut /user/session/assumedRoleSet the assumed role for the current session

Documentation For Models

Documentation For Authorization

ApiToken

  • Type: API key
  • API key parameter name: X-API-Token
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: X-API-Token and passed in as the auth context for each request.

ServiceBearer

  • Type: API key
  • API key parameter name: X-API-ServiceBearer
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: X-API-ServiceBearer and passed in as the auth context for each request.

ServiceToken

  • Type: API key
  • API key parameter name: X-API-Key
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: X-API-Key and passed in as the auth context for each request.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]