Skip to content

Latest commit

 

History

History
679 lines (625 loc) · 49.8 KB

File metadata and controls

679 lines (625 loc) · 49.8 KB

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

Class Method HTTP request Description
AgentLeasesApi AgentCheckLease Post /agents/{agentId}/checkLease Check the lease of an agent.
AgentRegistrationsApi AllAgentRegistrations Get /agents Overview of registered agents
ApiTokenApi GetCurrentUserApiTokens Get /user/profile/tokens Get current user's API tokens
ComponentApi GetComponentHealthHistory Get /components/{componentIdOrUrn}/healthHistory Get a component health history
DashboardsApi CloneDashboard Post /dashboards/{dashboardIdOrUrn}/clone Clone a dashboard
DashboardsApi CreateDashboard Post /dashboards Create a new dashboard
DashboardsApi DeleteDashboard Delete /dashboards/{dashboardIdOrUrn} Delete a dashboard
DashboardsApi GetDashboard Get /dashboards/{dashboardIdOrUrn} Get a single dashboard
DashboardsApi GetDashboards Get /dashboards Get a list of dashboards
DashboardsApi PatchDashboard Patch /dashboards/{dashboardIdOrUrn} Patch a dashboard
DummyApi Dummy Get /dummy/dummy Dummy path to fix omission in openapi generation when a type is not included.
EventApi GetEvent Get /events/{eventId} Get single event
EventApi GetEventSources Get /eventSources Get event sources
EventApi GetEventTags Get /eventTags Get event tags
EventApi GetEventTypes Get /eventTypes Get event types
EventApi GetEvents Post /events Get events
EventApi GetEventsHistogram Post /eventsHistogram Get events histogram
ExportApi ExportSettings Post /export Export settings
HealthSynchronizationApi DeleteHealthSynchronizationStream Delete /synchronization/health/streams/{healthStreamUrn} Delete health sync stream
HealthSynchronizationApi GetHealthSynchronizationStreamStatus Get /synchronization/health/streams/{healthStreamUrn}/status Get health sync stream status
HealthSynchronizationApi GetHealthSynchronizationStreamTopologyMatches Get /synchronization/health/streams/{healthStreamUrn}/topologyMatches List health sync stream check-states
HealthSynchronizationApi GetHealthSynchronizationStreamsOverview Get /synchronization/health/streams List health sync streams
HealthSynchronizationApi GetHealthSynchronizationSubStreamOverview Get /synchronization/health/streams/{healthStreamUrn}/substreams List health sync sub-streams
HealthSynchronizationApi GetHealthSynchronizationSubStreamStatus Get /synchronization/health/streams/{healthStreamUrn}/substreams/{healthSyncSubStreamId}/status Get health sync sub-stream status
HealthSynchronizationApi GetHealthSynchronizationSubStreamTopologyMatches Get /synchronization/health/streams/{healthStreamUrn}/substreams/{healthSyncSubStreamId}/topologyMatches List health sync sub-stream check-states
HealthSynchronizationApi PostHealthSynchronizationStreamClearErrors Post /synchronization/health/streams/{healthStreamUrn}/clearErrors Clear health sync stream errors
ImportApi ImportSettings Post /import Import settings
KubernetesLogsApi GetKubernetesLogs Get /k8s/logs Get Kubernetes logs
KubernetesLogsApi GetKubernetesLogsAutocomplete Get /k8s/logs/autocomplete Get Kubernetes logs autocomplete values
KubernetesLogsApi GetKubernetesLogsHistogram Get /k8s/logs/histogram Get Kubernetes logs histogram
LayoutApi GetAllLayouts Get /layouts List layout hints
MetricApi GetExemplarsQuery Get /metrics/query_exemplars Experimental: Exemplars for a specific time range
MetricApi GetInstantQuery Get /metrics/query Instant query at a single point in time
MetricApi GetLabelValues Get /metrics/label/{label}/values List of label values for a provided label name
MetricApi GetLabels Get /metrics/labels List of label names
MetricApi GetMetadata Get /metrics/metadata Metadata about metrics currently scraped from targets
MetricApi GetRangeQuery Get /metrics/query_range Query over a range of time
MetricApi GetSeries Get /metrics/series List of time series that match a certain label set
MetricApi PostExemplarsQuery Post /metrics/query_exemplars Experimental: Exemplars for a specific time range
MetricApi PostInstantQuery Post /metrics/query Instant query at a single point in time
MetricApi PostLabelValues Post /metrics/label/{label}/values List of label values for a provided label name
MetricApi PostLabels Post /metrics/labels List of label names
MetricApi PostMetadata Post /metrics/metadata Metadata about metrics currently scraped from targets
MetricApi PostRangeQuery Post /metrics/query_range Query over a range of time
MetricApi PostSeries Post /metrics/series List of time series that match a certain label set
MonitorApi DeleteMonitor Delete /monitors/{monitorIdOrUrn} Delete a monitor
MonitorApi GetAllMonitors Get /monitors List monitors
MonitorApi GetMonitor Get /monitors/{monitorIdOrUrn} Get a monitor
MonitorApi GetMonitorCheckStates Get /monitors/{monitorIdOrUrn}/checkStates Get the check states for a monitor
MonitorApi GetMonitorWithStatus Get /monitors/{monitorIdOrUrn}/status Get a monitor with stream information
MonitorApi GetMonitorsOverview Get /monitors/overview List monitors overview
MonitorApi LookupIdentifier Post /monitors/identifierLookup Multiple component identifier lookup
MonitorApi PatchMonitor Patch /monitors/{monitorIdOrUrn} Update some monitor properties
MonitorApi PreviewMonitor Post /monitors/{monitorIdOrUrn}/preview Preview a monitor
MonitorApi PreviewMonitorCheckStates Post /monitors/{monitorIdOrUrn}/preview/checkStates Preview a monitor
MonitorApi PublishHealthStates Post /monitors/{monitorIdOrUrn}/publish Post monitor health states
MonitorApi RunMonitor Post /monitors/{monitorIdOrUrn}/run Run a monitor
MonitorApi TestMonitorFunction Post /monitors/{monitorFunctionIdOrUrn}/test Test a monitor
MonitorApi TestMonitorFunctionCheckStates Post /monitors/{monitorFunctionIdOrUrn}/test/checkStates Test a monitor
MonitorCheckStatusApi GetMonitorCheckStatus Get /monitor/checkStatus/{id} Get a monitor check status
MonitorCheckStatusApi GetMonitorCheckStatusHealthHistory Get /monitor/checkStatus/{id}/healthHistory Get a monitor check health history
MonitorCheckStatusApi GetMonitorCheckStatusRelatedFailures Get /monitor/checkStatus/{id}/relatedFailures Get a monitor check related failures
NodeApi Clone Post /node/{nodeType}/{nodeIdOrUrn}/clone Clone a node with a new name
NodeApi Delete Delete /node/{nodeType}/{nodeId} Node deletion API
NodeApi Lock Get /node/{nodeType}/{nodeId}/islocked Retrieve if a node is locked
NodeApi NodeListTypes Get /node Node API
NodeApi TypeList Get /node/{nodeType} Node type API
NodeApi Unlock Post /node/{nodeType}/{nodeId}/unlock Node unlock API
NotificationChannelsApi CreateEmailNotificationChannel Post /notifications/channels/email Create a Email Notification channel
NotificationChannelsApi CreateOpsgenieNotificationChannel Post /notifications/channels/opsgenie Create a Opsgenie Notification channel
NotificationChannelsApi CreateTeamsNotificationChannel Post /notifications/channels/teams Create a Teams Notification channel
NotificationChannelsApi CreateWebhookNotificationChannel Post /notifications/channels/webhook Create a Webhook Notification channel
NotificationChannelsApi DeleteEmailNotificationChannel Delete /notifications/channels/email/{channelId} Delete the Email Notification channel by id
NotificationChannelsApi DeleteOpsgenieNotificationChannel Delete /notifications/channels/opsgenie/{channelId} Delete the Opsgenie Notification channel by id
NotificationChannelsApi DeleteSlackNotificationChannel Delete /notifications/channels/slack/{channelId} Delete the Slack Notification channel by id
NotificationChannelsApi DeleteTeamsNotificationChannel Delete /notifications/channels/teams/{channelId} Delete the Teams Notification channel by id
NotificationChannelsApi DeleteWebhookNotificationChannel Delete /notifications/channels/webhook/{channelId} Delete the Webhook Notification channel by id
NotificationChannelsApi GetEmailNotificationChannel Get /notifications/channels/email/{channelId} Get the Email Notification channel by id
NotificationChannelsApi GetEmailNotificationStatus Get /notifications/channels/email/status Email Notification channel status
NotificationChannelsApi GetOpsgenieNotificationChannel Get /notifications/channels/opsgenie/{channelId} Get the Opsgenie Notification channel by id
NotificationChannelsApi GetSlackNotificationChannel Get /notifications/channels/slack/{channelId} Get the Slack Notification channel by id
NotificationChannelsApi GetTeamsNotificationChannel Get /notifications/channels/teams/{channelId} Get the Teams Notification channel by id
NotificationChannelsApi GetWebhookNotificationChannel Get /notifications/channels/webhook/{channelId} Get the Webhook Notification channel by id
NotificationChannelsApi JoinSlackChannel Post /notifications/channels/slack/{channelId}/joinSlackChannel Join the specified Slack channel to send notifications
NotificationChannelsApi ListOpsgenieResponders Get /notifications/channels/opsgenie/responders List Opsgenie responders
NotificationChannelsApi ListSlackChannels Get /notifications/channels/slack/{channelId}/listSlackChannels List all public Slack channels
NotificationChannelsApi SlackOAuthCallback Get /notifications/channels/slack/oauth-callback The OAuth callback for Slack
NotificationChannelsApi SlackOauthRedirect Get /notifications/channels/slack/oauth-redirect Starts Slack OAuth2 flow
NotificationChannelsApi TestEmailChannel Post /notifications/channels/email/{channelId}/test Test the Email notification channel
NotificationChannelsApi TestOpsgenieChannel Post /notifications/channels/opsgenie/{channelId}/test Test the Opsgenie notification channel
NotificationChannelsApi TestSlackChannel Post /notifications/channels/slack/{channelId}/test Test the Notification channel
NotificationChannelsApi TestTeamsChannel Post /notifications/channels/teams/{channelId}/test Test the Teams notification channel
NotificationChannelsApi TestWebhookChannel Post /notifications/channels/webhook/{channelId}/test Test the Webhook notification channel
NotificationChannelsApi UpdateEmailNotificationChannel Put /notifications/channels/email/{channelId} Update the Email Notification channel by id
NotificationChannelsApi UpdateOpsgenieNotificationChannel Put /notifications/channels/opsgenie/{channelId} Update the Opsgenie Notification channel by id
NotificationChannelsApi UpdateTeamsNotificationChannel Put /notifications/channels/teams/{channelId} Update the Teams Notification channel by id
NotificationChannelsApi UpdateWebhookNotificationChannel Put /notifications/channels/webhook/{channelId} Update the Webhook Notification channel by id
NotificationConfigurationsApi CreateNotificationConfiguration Post /notifications/configurations Create a new notification configuration
NotificationConfigurationsApi DeleteNotificationConfiguration Delete /notifications/configurations/{notificationConfigurationIdOrUrn} Delete the notification configuration
NotificationConfigurationsApi GetNotificationConfiguration Get /notifications/configurations/{notificationConfigurationIdOrUrn} Get the notification configuration
NotificationConfigurationsApi GetNotificationConfigurationChannels Get /notifications/configurations/{notificationConfigurationIdOrUrn}/channels Get the channels for the notification configuration
NotificationConfigurationsApi GetNotificationConfigurations Get /notifications/configurations Get all notification configurations
NotificationConfigurationsApi UpdateNotificationConfiguration Put /notifications/configurations/{notificationConfigurationIdOrUrn} Update the notification configuration
PermissionsApi DescribePermissions Get /security/permissions/{subject} Describe permissions
PermissionsApi GetPermissions Get /security/permissions/list List permissions
PermissionsApi GrantPermissions Post /security/permissions/{subject} Grant permissions
PermissionsApi RevokePermissions Delete /security/permissions/{subject} Revoke permissions
ProblemApi GetProblemCausingEvents Get /problems/{problemId}/causing-events List possible events which led to the problem
ScriptingApi ScriptExecute Post /script/execute Execute script
ServerApi ServerInfo Get /server/info Get server info
ServiceTokenApi CreateNewServiceToken Post /security/tokens Create new service token
ServiceTokenApi DeleteServiceToken Delete /security/tokens/{serviceTokenId} Delete service token
ServiceTokenApi GetServiceTokens Get /security/tokens Get service tokens
StackpackApi ConfirmManualSteps Post /stackpack/{stackPackName}/confirm-manual-steps/{stackPackInstanceId} Confirm manual steps
StackpackApi ProvisionDetails Post /stackpack/{stackPackName}/provision Provision API
StackpackApi ProvisionUninstall Post /stackpack/{stackPackName}/deprovision/{stackPackInstanceId} Provision API
StackpackApi StackPackList Get /stackpack StackPack API
StackpackApi StackPackUpload Post /stackpack StackPack API
StackpackApi UpgradeStackPack Post /stackpack/{stackPackName}/upgrade Upgrade API
SubjectApi CreateSubject Put /security/subjects/{subject} Create a subject
SubjectApi DeleteSubject Delete /security/subjects/{subject} Delete a subject
SubjectApi GetSubject Get /security/subjects/{subject} Get subject
SubjectApi ListSubjects Get /security/subjects List subjects
SubscriptionApi GetSubscription Get /subscription Get subscription info
SubscriptionApi PostSubscription Post /subscription Submit a new license to update the subscription
SystemNotificationsApi AllSystemNotifications Get /system/notifications Overview of system notifications
TimelineApi GetTimelineSummary Post /timeline/summary Timeline summary
TopicApi Describe Get /topic/{topic} Describe a topic
TopicApi List Get /topic List topics
TopologySynchronizationApi GetTopologySynchronizationStreamById Get /synchronization/topology/streams/sync Overview of a specific Topology Stream, queried by node id or sync identifier
TopologySynchronizationApi GetTopologySynchronizationStreams Get /synchronization/topology/streams Overview of the topology synchronization streams
TopologySynchronizationApi PostTopologySynchronizationStreamClearErrors Post /synchronization/topology/streams/clearErrors Clear all the errors related to a specific sync
TracesApi GetSpan Get /traces/{traceId}/spans/{spanId} Get a span
TracesApi GetTrace Get /traces/{traceId} Fetch a trace
TracesApi QueryDuration Post /traces/duration/histogram Query duration distribution
TracesApi QueryTraces Post /traces/query Query for traces
TracesApi SpanComponents Post /traces/components Fetch components based on resource attributes
TracesApi SuggestionsAttributeName Get /traces/spans/fields/attributes Suggestions for attribute names
TracesApi SuggestionsAttributeValue Get /traces/spans/fields/attributes/{attributeName}/values Suggestions for attribute values
TracesApi SuggestionsFieldValues Get /traces/spans/fields/{field}/values Suggestions for span fields
UserAuthorizationApi GetUserAuthorizationFor Get /user/authorization/for Is the current user authorized for the provided permission and resource
UserProfileApi GetCurrentUserProfile Get /user/profile Get current user profile
UserProfileApi SaveCurrentUserProfile Put /user/profile Save current user profile
UserSessionApi GetUserSessionAssumedRole Get /user/session/assumedRole Get the assumed a role for the current session
UserSessionApi GetUserSessionAvailableRoles Get /user/session/availableRoles Get a list of available roles for this session
UserSessionApi SaveUserSessionAssumedRole Put /user/session/assumedRole Set 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

info@stackstate.com