Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

altairengineering/swx-sdk-for-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for openapi

IN PROGRESS->This is the guide to use the different endpoints to manage the clusters.

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: 0.0.1
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

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 sw "./openapi"

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(), sw.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(), sw.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 identifield 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(), sw.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://api.dev.altairsc.com

Class Method HTTP request Description
AccountsApi CreateAccount Post /spaces Create an Account
AccountsApi DeleteAccount Delete /spaces/{space} Delete an Account
AccountsApi GetAccount Get /spaces/{space} Get an Account
AccountsApi ListAccounts Get /spaces List Accounts
AccountsApi UpdateAccount Put /spaces/{space} Update an Account
ActionsApi AddAction Post /spaces/{space}/collections/{collection-name}/things/{thing-id}/actions/{action} Request action
ActionsApi DeleteAction Delete /spaces/{space}/collections/{collection-name}/things/{thing-id}/actions/{action}/{action-id} Delete Action
ActionsApi ListActions Get /spaces/{space}/collections/{collection-name}/things/{thing-id}/actions Lists all the action queues for a thing
ActionsApi ListActionsByName Get /spaces/{space}/collections/{collection-name}/things/{thing-id}/actions/{action} List the queue of actions from a thing
ActionsApi ShowAction Get /spaces/{space}/collections/{collection-name}/things/{thing-id}/actions/{action}/{action-id} Show action requested
ActionsApi UpdateAction Put /spaces/{space}/collections/{collection-name}/things/{thing-id}/actions/{action}/{action-id} Update action inside a queue
AppsApi CreateApp Post /spaces/{space}/apps Create an App
AppsApi DeleteApp Delete /spaces/{space}/apps/{app_id} Delete an App
AppsApi GetApp Get /spaces/{space}/apps/{app_id} Get an App
AppsApi ListApps Get /spaces/{space}/apps List Apps
AppsApi PatchApp Patch /spaces/{space}/apps/{app_id} Patch an App
AppsApi UpdateApp Put /spaces/{space}/apps/{app_id} Update an App
BuildConfigsApi BuildConfCreate Post /spaces/{space}/build-configs/ Create Build Configuration
BuildConfigsApi BuildConfDelete Delete /spaces/{space}/build-configs/{build-configID}/ Delete Build Configuration
BuildConfigsApi BuildConfGet Get /spaces/{space}/build-configs/{build-configID}/ Get Build Configuration
BuildConfigsApi BuildConfList Get /spaces/{space}/build-configs/ List Build Configuration
BuildConfigsApi BuildConfUpdate Put /spaces/{space}/build-configs/{build-configID}/ Update Build Configuration
BuildConfigsApi BuildConfUpdateParcialy Patch /spaces/{space}/build-configs/{build-configID}/ Update Build Configuration
BuildConfigsApi BuildGenerateFile Post /spaces/{space}/build-configs/{build-configID}/generate-file Create a temporary endpoint with the Build Configuration file
ClustersApi CreateCluster Post /spaces/{space}/clusters Add a cluster
ClustersApi DeleteCluster Delete /spaces/{space}/clusters/{cluster-id} Delete cluster
ClustersApi ListClusters Get /spaces/{space}/clusters List clusters
ClustersApi ReinstallCluster Put /spaces/{space}/clusters/{cluster-id}/reinstall Regenerate configuration files
ClustersApi ResetClusterClientSecret Post /spaces/{space}/clusters/{cluster-id}/reset-secret Reset Client Secret
ClustersApi ShowCluster Get /spaces/{space}/clusters/{cluster-id} Show cluster
ClustersApi UpdateCluster Put /spaces/{space}/clusters/{cluster-id} Update cluster
CollectionsApi AddCollection Post /spaces/{space}/collections Create collection
CollectionsApi DeleteCollection Delete /spaces/{space}/collections/{collection-name} Delete collection
CollectionsApi ListCollections Get /spaces/{space}/collections List collections
CollectionsApi ShowCollection Get /spaces/{space}/collections/{collection-name} Show collection
CollectionsApi UpdateCollection Put /spaces/{space}/collections/{collection-name} Update collection
DataApi CreateData Post /spaces/{space}/data Create data
DataApi DeleteData Delete /spaces/{space}/data/{data-id} Delete Data
DataApi DeleteDataFromSource Delete /spaces/{space}/data Delete Data
DataApi ListData Get /spaces/{space}/data List Data
DataApi ShowData Get /spaces/{space}/data/{data-id} Show Data
EventsApi AddEvent Post /spaces/{space}/collections/{collection-name}/things/{thing-id}/events/{event} Add event
EventsApi ListEvents Get /spaces/{space}/collections/{collection-name}/things/{thing-id}/events List history of all events
EventsApi ListEventsByName Get /spaces/{space}/collections/{collection-name}/things/{thing-id}/events/{event} List history of one type of event
EventsApi ShowEvent Get /spaces/{space}/collections/{collection-name}/things/{thing-id}/events/{event}/{event-id} Show event
InvitationsApi CreateInvitation Post /spaces/{space}/invitations Create a new Invitation
InvitationsApi DeleteSentInvitation Delete /spaces/{space}/invitations/{invitation_id} Delete an Invitation sent from Account
InvitationsApi GetReceivedInvitation Get /invitations/{invitation_id} Get a received Invitation
InvitationsApi GetSentInvitation Get /spaces/{space}/invitations/{invitation_id} Get an Invitation sent from an Account
InvitationsApi ListReceivedInvitations Get /invitations List received Invitations
InvitationsApi ListSentInvitations Get /spaces/{space}/invitations List Invitations sent from an Account
InvitationsApi PatchReceivedInvitation Patch /invitations/{invitation_id} Accept / Reject a received Invitation
InvitationsApi UpdateSentInvitation Put /spaces/{space}/invitations/{invitation_id} Update an Invitation
LabelApi DeleteLabel Delete /spaces/{space}/labels/{label-id} Delete Label
LabelApi ShowLabel Get /spaces/{space}/labels/{label-id} Show Label
LabelApi UpdateLabel Put /spaces/{space}/labels/{label-id} Update label
LabelRelationsApi CreateLabelRelation Post /spaces/{space}/labels/{label-id}/relations Create label relation
LabelRelationsApi Delete Delete /spaces/{space}/labels/{label-id}/relations Delete Label relation
LabelRelationsApi ShowLabelItems Get /spaces/{space}/labels/{label-id}/relations Show Label Items
LabeledEntitiesApi SpacesSpaceLabeledEntitiesGet Get /spaces/{space}/labeled-entities
LabelsApi CreateLabel Post /spaces/{space}/labels Create label
LabelsApi ListLabel Get /spaces/{space}/labels List Labels
MQTTApi CreateMQTTLabelCredentials Post /spaces/{space}/mqtt/labels Create MQTT credentials for a label
MQTTApi DeleteMQTTLabel Delete /spaces/{space}/mqtt/labels/{label-id} Delete MQTT label
MQTTApi ListMQTTcredentials Get /spaces/{space}/mqtt/credentials List space MQTT credentials
MQTTApi ListThingMQTTcredentials Get /spaces/{space}/mqtt/things/{thing-id} List Thing MQTT credentials
MQTTApi ShowMQTTLabelInfo Get /spaces/{space}/mqtt/labels/{label-id} Show MQTT label details
MQTTApi ShowMQTTcredentials Get /spaces/{space}/mqtt/credentials/{credentials-id} Show MQTT credentials
MQTTApi UpdateMQTTLabel Put /spaces/{space}/mqtt/labels/{label-id} Update MQTT Label
MQTTApi UpdateMQTTcredentials Put /spaces/{space}/mqtt/credentials/{credentials-id} Update MQTT credentials
MQTTApi UpdateMQTTpassword Patch /spaces/{space}/mqtt/credentials-username/{mqtt-username} Update MQTT password
ModelVersionsApi AddVersion Post /spaces/{space}/collections/{collection-name}/models/{model-name}/versions Create version
ModelVersionsApi DeleteVersion Delete /spaces/{space}/collections/{collection-name}/models/{model-name}/versions/{version-name} Delete version
ModelVersionsApi ListVersion Get /spaces/{space}/collections/{collection-name}/models/{model-name}/versions List version
ModelVersionsApi ShowVersion Get /spaces/{space}/collections/{collection-name}/models/{model-name}/versions/{version-name} Show version
ModelVersionsApi UpdateVersion Put /spaces/{space}/collections/{collection-name}/models/{model-name}/versions/{version-name} Update version
ModelsApi AddModel Post /spaces/{space}/collections/{collection-name}/models Create model
ModelsApi DeleteModel Delete /spaces/{space}/collections/{collection-name}/models/{model-name} Delete model
ModelsApi ListModels Get /spaces/{space}/collections/{collection-name}/models List models
ModelsApi ShowModel Get /spaces/{space}/collections/{collection-name}/models/{model-name} Show model
ModelsApi UpdateModel Put /spaces/{space}/collections/{collection-name}/models/{model-name} Update model
OAuth2Api GetOauth2Auth Get /oauth2/auth OAuth 2.0 Authorize Endpoint
OAuth2Api GetOauth2Token Post /oauth2/token OAuth 2.0 Token Endpoint
OAuth2Api PostOauth2Revoke Post /oauth2/revoke Revoke a token (Access or Refresh)
OpenIDApi GetOpenIdSessionsLogout Get /oauth2/sessions/logout Initialize & Complete User Logout
OpenIDApi GetOpenIdUserInfo Get /userinfo Get the Payload of the ID Token.
PropertiesApi ListProperties Get /spaces/{space}/collections/{collection-name}/things/{thing-id}/properties List properties
PropertiesApi ShowProperty Get /spaces/{space}/collections/{collection-name}/things/{thing-id}/properties/{property} Show property
PropertiesApi UpdateProperty Put /spaces/{space}/collections/{collection-name}/things/{thing-id}/properties/{property} Update property
ResourcesApi ResourceDelete Delete /spaces/{space}/resources/{resourceID}/ Delete Resources
ResourcesApi ResourcesCreate Post /spaces/{space}/resources/ Create Resources
ResourcesApi ResourcesGet Get /spaces/{space}/resources/{resourceID}/ Get Resources
ResourcesApi ResourcesList Get /spaces/{space}/resources/ List Resources
ResourcesApi ServiceDeleteParams Delete /spaces/{space}/resources/{resourceID}/params/{paramsID} Delete params
ResourcesApi ServiceSetParams Put /spaces/{space}/resources/{resourceID}/params Set custom params
ResourcesApi ServiceUpdate Put /spaces/{space}/resources/{resourceID}/ Update Resources
ResourcesApi ServiceUpdateParams Put /spaces/{space}/resources/{resourceID}/params/{paramsID} Update custom params
ThingsApi AddThing Post /spaces/{space}/collections/{collection-name}/things Add a thing description
ThingsApi DeleteThing Delete /spaces/{space}/collections/{collection-name}/things/{thing-id} Delete thing
ThingsApi ListThings Get /spaces/{space}/collections/{collection-name}/things List thing descriptions
ThingsApi ResetThingClientSecret Post /spaces/{space}/collections/{collection-name}/things/{thing-id}/reset-secret Reset Client Secret
ThingsApi ShowThing Get /spaces/{space}/collections/{collection-name}/things/{thing-id} Show thing
ThingsApi UpdateThing Put /spaces/{space}/collections/{collection-name}/things/{thing-id} Update thing description
ThingsStatusApi ListItems Get /spaces/{space}/collections/{collection-name}/things-status List items
ThingsStatusApi ShowItem Get /spaces/{space}/collections/{collection-name}/things-status/{thing-id} Show item
UsersApi DeleteUserFromAccount Delete /spaces/{space}/users/{user_id} Delete a User from an Account
UsersApi GetUserFromAccount Get /spaces/{space}/users/{user_id} Get a User from an Account
UsersApi ListUsersFromAccount Get /spaces/{space}/users List Users from an Account

Documentation For Models

Documentation For Authorization

OAuth2Security

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes:
  • offline: Offline scope
  • openid: OpenId scope

Example

auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)

OAuth2Security

Example

auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)

bearerAuth

  • Type: HTTP Bearer token authentication

Example

auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARERTOKENSTRING")
r, err := client.Service.Operation(auth, args)

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

About

Golang SDK for the Smartworks IOT platform

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages