SDK
SDK is a software development kit that enhances the usability of an API by providing a Middleware for the API Client to be used with the Scramjet Platform. SDK allows a user the access to the platform's resources by using an access token and assists in the creation of a HostClient, a SequenceClient and an InstanceClient. Scramjet Cloud Platform (SCP) requires authorization through Access Token which is added to the Bearer. Access Token can be easily obtained through Generate Token button found at the user's Web Panel Settings.
1. Create a MiddlewareClient:
The Scramjet Cloud Platform requests a level of authorization in the form of access Tokens which can be used in conjunction with MiddlewareClient in order to be granted access. More information can be found on Scramjet's Github repository.
2. Create a HostClient:
Firstly a user must retrieve an ID attribute of each Space <Space-id> in a list of Spaces bound to the user in order to create a Hub which is also the HostClient. Then a user is able to create a HostClient where the list of available hosts is provided by the Space Manager. Additional information on the Methods used by HostClient can be found on Scramjet's Github repository.
HostClient Methods
_36listSequences _36// Returns a list of all of the Sequences on the Host_36listInstances_36// Returns a list of all of the Instances on the Host_36listEntities_36// Returns the list of all entities on the Host_36getAuditStream_36// Returns Host audit stream_36getLogStream_36// Returns the log stream of the Host_36sendSequence_36// Uploads the Sequence to the Host_36getSequence_36// Returns the details of a Sequence_36deleteSequence_36// Deletes a Sequence of a given Sequence-id_36getInstanceInfo_36// Returns the details of an Instance_36getLoadCheck_36// Returns the load-check of the Host_36getVersion_36// Returns the current version of the Host_36getStatus_36// Returns the status of a Host_36getConfig_36// Returns the public configuration of a Host_36sendNamedData_36// Sends data to a Topic name_36getNamedData_36// Returns the stream from a given Topic_36getTopics_36// Returns the list of all Topic names available on this Hub_36getInstanceClient_36// Creates InstanceClient based on the current HostClient and the Instance-id_36getSequenceClient_36// Returns information on the Sequence Client
3. Create a SequenceClient:
In order for a user to create a new SequenceClient an attribute ID of a Sequence <Sequence-id> must be selected from the HostClient. listSequences() will display all the Sequences found on a Hub. The Start method will create a new SequenceClient under the designated HostClient. Additional information on the Methods used by SequenceClient can be found on Scramjet's Github repository.
SequenceClient Methods
_10start_10// Starts a Sequence with a particular Sequence-id_10listInstances_10// Returns a list of all Instances created from Sequence_10getInstance_10// Returns Instance Client for given Instance-id_10getInfo_10// Returns details of a Sequence_10overwrite_10// Overwrites the existing Sequence
4. Create an InstanceClient:
For a user to be able to create a new InstanceClient first a Sequence must be started and an <Instance-id> will be obtained by the HostClient. listInstances() method will display all running Sequences. Additional information on the Methods used by InstanceClient can be found on Scramjet's Github repository.
InstanceClient Methods
_24stop_24// Sends stop command to an Instance_24kill_24// Sends kill command to an Instance_24sendEvent_24// Sends an event to an Instance_24getNextEvent_24// Waits and returns next event sent by an Instance_24getEvent_24// Returns last data from an Event given in eventName. Waits for an Event if it was never fired_24getEventStream_24// Fetches Event data as a stream_24getHealth_24// Returns an Instance's health_24getInfo _24// Returns information on an Instance_24sendStream_24// Sends a stream to an Instance input/stdin and String/Readable_24sendInput_24// Pipes given stream to an Instance input/stdin with a specific type_24sendStdin_24// Pipes a stream to an Instance stdin _24getStream_24// Returns readable stream from an Instance. Stream can be one of type InstanceOutputStream
NOTE: For this code sample please install the following dependencies
For JavaScript methods npm install @scramjet/client-utils, @scramjet/middleware-api-client, fs, crypto, stream, promise
For Python methods pip install Scramjet-api-client, asyncio, json
1. Create a MiddlewareClient:
The Scramjet Cloud Platform requests a level of authorization in the form of access Tokens which can be used in conjunction with MiddlewareClient in order to be granted access. More information can be found on Scramjet's Github repository.
2. Create a HostClient:
Firstly a user must retrieve an ID attribute of each Space <Space-id> in a list of Spaces bound to the user in order to create a Hub which is also the HostClient. Then a user is able to create a HostClient where the list of available hosts is provided by the Space Manager. Additional information on the Methods used by HostClient can be found on Scramjet's Github repository.
HostClient Methods
_36listSequences _36// Returns a list of all of the Sequences on the Host_36listInstances_36// Returns a list of all of the Instances on the Host_36listEntities_36// Returns the list of all entities on the Host_36getAuditStream_36// Returns Host audit stream_36getLogStream_36// Returns the log stream of the Host_36sendSequence_36// Uploads the Sequence to the Host_36getSequence_36// Returns the details of a Sequence_36deleteSequence_36// Deletes a Sequence of a given Sequence-id_36getInstanceInfo_36// Returns the details of an Instance_36getLoadCheck_36// Returns the load-check of the Host_36getVersion_36// Returns the current version of the Host_36getStatus_36// Returns the status of a Host_36getConfig_36// Returns the public configuration of a Host_36sendNamedData_36// Sends data to a Topic name_36getNamedData_36// Returns the stream from a given Topic_36getTopics_36// Returns the list of all Topic names available on this Hub_36getInstanceClient_36// Creates InstanceClient based on the current HostClient and the Instance-id_36getSequenceClient_36// Returns information on the Sequence Client
3. Create a SequenceClient:
In order for a user to create a new SequenceClient an attribute ID of a Sequence <Sequence-id> must be selected from the HostClient. listSequences() will display all the Sequences found on a Hub. The Start method will create a new SequenceClient under the designated HostClient. Additional information on the Methods used by SequenceClient can be found on Scramjet's Github repository.
SequenceClient Methods
_10start_10// Starts a Sequence with a particular Sequence-id_10listInstances_10// Returns a list of all Instances created from Sequence_10getInstance_10// Returns Instance Client for given Instance-id_10getInfo_10// Returns details of a Sequence_10overwrite_10// Overwrites the existing Sequence
4. Create an InstanceClient:
For a user to be able to create a new InstanceClient first a Sequence must be started and an <Instance-id> will be obtained by the HostClient. listInstances() method will display all running Sequences. Additional information on the Methods used by InstanceClient can be found on Scramjet's Github repository.
InstanceClient Methods
_24stop_24// Sends stop command to an Instance_24kill_24// Sends kill command to an Instance_24sendEvent_24// Sends an event to an Instance_24getNextEvent_24// Waits and returns next event sent by an Instance_24getEvent_24// Returns last data from an Event given in eventName. Waits for an Event if it was never fired_24getEventStream_24// Fetches Event data as a stream_24getHealth_24// Returns an Instance's health_24getInfo _24// Returns information on an Instance_24sendStream_24// Sends a stream to an Instance input/stdin and String/Readable_24sendInput_24// Pipes given stream to an Instance input/stdin with a specific type_24sendStdin_24// Pipes a stream to an Instance stdin _24getStream_24// Returns readable stream from an Instance. Stream can be one of type InstanceOutputStream
NOTE: For this code sample please install the following dependencies
For JavaScript methods npm install @scramjet/client-utils, @scramjet/middleware-api-client, fs, crypto, stream, promise
For Python methods pip install Scramjet-api-client, asyncio, json
Didn't find information needed?
Join our Scramjet Community on Discord, where you can get help from our engineers directly.