Skip to content

mach-composer/mcc-sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for mccsdk

Introduction

MACH composer Cloud is a platform and API to facilitate and coordinate work across teams that build composable architectures using MACH technology.

All operations available in MACH composer cloud are available through this API. For more information about using it in your MACH architecture, have a look at the documentation website.

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.1.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://docs.machcomposer.io/

Installation

Install the following dependencies:

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

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

import mccsdk "github.com/GIT_USER_ID/GIT_REPO_ID"

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 mccsdk.ContextServerIndex of type int.

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

Templated Server URL

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

ctx := context.WithValue(context.Background(), mccsdk.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 mccsdk.ContextOperationServerIndices and mccsdk.ContextOperationServerVariables context maps.

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

Documentation for API Endpoints

All URIs are relative to https://api.mach.cloud

Class Method HTTP request Description
APIClientsApi ApiClientCreate Post /organizations/{organization}/projects/{project}/api-clients Create new API Client
APIClientsApi ApiClientDelete Delete /organizations/{organization}/projects/{project}/api-clients/{id} Delete API Client
APIClientsApi ApiClientGet Get /organizations/{organization}/projects/{project}/api-clients/{id} Get API Client details
APIClientsApi ApiClientPatch Patch /organizations/{organization}/projects/{project}/api-clients/{id} Update API Client
APIClientsApi ApiClientQuery Get /organizations/{organization}/projects/{project}/api-clients List all API Clients
APIClientsApi ApiClientUpdate Put /organizations/{organization}/projects/{project}/api-clients/{id} Update API Client
ComponentsApi ComponentCommitQuery Get /organizations/{organization}/projects/{project}/components/{component}/commits List all commits of a component between two versions ordered by creation date. If `to` is not provided, it will list all commits from `from` to the latest version.
ComponentsApi ComponentCreate Post /organizations/{organization}/projects/{project}/components Create component
ComponentsApi ComponentDelete Delete /organizations/{organization}/projects/{project}/components/{component} Delete a component
ComponentsApi ComponentGet Get /organizations/{organization}/projects/{project}/components/{component} Get component details
ComponentsApi ComponentLatestVersion Get /organizations/{organization}/projects/{project}/components/{component}/latest Get last component version
ComponentsApi ComponentPatch Patch /organizations/{organization}/projects/{project}/components/{component} Patch an existing component
ComponentsApi ComponentQuery Get /organizations/{organization}/projects/{project}/components List all components
ComponentsApi ComponentUpdate Put /organizations/{organization}/projects/{project}/components/{component} Update a component
ComponentsApi ComponentVersionCreate Post /organizations/{organization}/projects/{project}/components/{component}/versions Create component version
ComponentsApi ComponentVersionDelete Delete /organizations/{organization}/projects/{project}/components/{component}/versions/{version} Delete component version
ComponentsApi ComponentVersionDeleteCommit Delete /organizations/{organization}/projects/{project}/components/{component}/versions/{version}/commits/{commit} Delete commit
ComponentsApi ComponentVersionGet Get /organizations/{organization}/projects/{project}/components/{component}/versions/{version} Get component version
ComponentsApi ComponentVersionGetCommit Get /organizations/{organization}/projects/{project}/components/{component}/versions/{version}/commits/{commit} Get commit details
ComponentsApi ComponentVersionPatch Patch /organizations/{organization}/projects/{project}/components/{component}/versions/{version} Patch component version
ComponentsApi ComponentVersionPatchCommit Patch /organizations/{organization}/projects/{project}/components/{component}/versions/{version}/commits/{commit} Patch commit
ComponentsApi ComponentVersionPushCommits Post /organizations/{organization}/projects/{project}/components/{component}/versions/{version}/commits Push commits for this component version
ComponentsApi ComponentVersionQuery Get /organizations/{organization}/projects/{project}/components/{component}/versions List all versions of a component
ComponentsApi ComponentVersionQueryCommits Get /organizations/{organization}/projects/{project}/components/{component}/versions/{version}/commits Get commits for this component version
ComponentsApi ComponentVersionUpdate Put /organizations/{organization}/projects/{project}/components/{component}/versions/{version} Update component version
ComponentsApi ComponentVersionUpdateCommit Put /organizations/{organization}/projects/{project}/components/{component}/versions/{version}/commits/{commit} Update commit
MyAccountApi MyAccountInformation Get /account/me Get user information
MyAccountApi UserCreate Post /account/me Create new user
MyAccountApi UserDelete Delete /account/me/{id} Delete user
MyAccountApi UserGet Get /account/me/{id} Get user information
MyAccountApi UserPatch Patch /account/me/{id} Update user information
MyAccountApi UserUpdate Put /account/me/{id} Update user information
OrganizationManagementApi OrganizationCreate Post /organizations Create new organization
OrganizationManagementApi OrganizationDelete Delete /organizations/{organization} Delete an organization
OrganizationManagementApi OrganizationGet Get /organizations/{organization} Get organization details
OrganizationManagementApi OrganizationPatch Patch /organizations/{organization} Update an organization
OrganizationManagementApi OrganizationQuery Get /organizations List all organizations
OrganizationManagementApi OrganizationUpdate Put /organizations/{organization} Update an organization
OrganizationManagementApi OrganizationUserInvite Post /organizations/{organization}/users/invite Invite a user to the organization
OrganizationManagementApi OrganizationUserInviteDelete Delete /organizations/{organization}/users/invite/{id} Cancel an invite
OrganizationManagementApi OrganizationUserInvitePatch Patch /organizations/{organization}/users/invite/{id} Accept or reject an invite
OrganizationManagementApi OrganizationUserInviteUpdate Put /organizations/{organization}/users/invite/{id} Accept or reject an invite
OrganizationManagementApi OrganizationUserInviteView Get /organizations/{organization}/users/invite/{id} View invite information
OrganizationManagementApi OrganizationUserQuery Get /organizations/{organization}/users/invite List all users in an organization
OrganizationManagementApi ProjectCreate Post /organizations/{organization}/projects Create new project in an organization
OrganizationManagementApi ProjectDelete Delete /organizations/{organization}/projects/{project} Delete a project
OrganizationManagementApi ProjectGet Get /organizations/{organization}/projects/{project} Get project details
OrganizationManagementApi ProjectPatch Patch /organizations/{organization}/projects/{project} Update a project
OrganizationManagementApi ProjectQuery Get /organizations/{organization}/projects List all projects in an organization
OrganizationManagementApi ProjectUpdate Put /organizations/{organization}/projects/{project} Update a project

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

cookieAuth

  • Type: API key
  • API key parameter name: sessionid
  • Location:

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

Example

auth := context.WithValue(
		context.Background(),
		mccsdk.ContextAPIKeys,
		map[string]mccsdk.APIKey{
			"sessionid": {Key: "API_KEY_STRING"},
		},
	)
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

[email protected]