Ionburst .NET SDK

The Ionburst SDK for .NET/.NET Core is available now on NuGeT.

Repository

The source code for the Ionburst .NET/.NET Core SDK is available here.

NuGeT

Ionburst.SDK

.NET Configuration

Further configuration for the Ionburst SDK can be specified in the appsettings.json file.

"Ionburst": {
"Profile": "example_profile",
"IonburstUri": "https://api.example.ionburst.io/",
"TraceCredentialsFile": "OFF"
}
  • Profile specifies the configuration to use from the Ionburst credentials file.
  • IonburstUri specifies the Ionburst API endpoint to use.
  • TraceCredentialsFile is a debug setting that can be used to trace how the SDK picks up credentials. This should not be set to ON in production.

Usage

Creating a Client

An Ionburst client can be created by passing an Ionburst API URI directly. Doing so will override any configured value:

IIonburstClient client = IonburstClientFactory.CreateIonburstClient("https://api.example.ionburst.io/");

If the value is defined in configuration then the client creation does not require parameters:

IIonburstClient client = IonburstClientFactory.CreateIonburstClient();

Classifications

A list of available Ionburst classifications can be retrieved like so:

GetPolicyClassificationRequest classRequest = new GetPolicyClassificationRequest();
GetPolicyClassificationResult classResult = await client.GetClassificationsAsync(classRequest);
if (classResult.StatusCode == 200)
{
Console.WriteLine($"[{string.Join(",", classResult.ClassificationList)}]");
}

Upload Data

PutObjectRequest putRequest = new PutObjectRequest
{
Particle = "TestObject",
PolicyClassification = "Restricted",
DataStream = input
};
Task<PutObjectResult> putTask = client.PutAsync(putRequest);
PutObjectResult putResult = putTask.Result;

Download Data

GetObjectRequest getRequest = new GetObjectRequest
{
Particle = "TestObject"
};
Task<GetObjectResult> getTask = client.GetAsync(getRequest);
GetObjectResult getResult = getTask.Result;

Delete Data

DeleteObjectRequest deleteRequest = new DeleteObjectRequest
{
Particle = "TestObject"
};
Task<DeleteObjectResult> deleteTask = client.DeleteAsync(deleteRequest);
DeleteObjectResult deleteResult = deleteTask.Result;

Upload Data (Deferred)

PutObjectRequest putRequest = new PutObjectRequest
{
Particle = objectId,
PolicyClassification = "Restricted",
DataStream = input,
PhasedMode = true
};
DeferredActionResult deferredPut = client.StartDeferredActionAsync(putRequest).Result;

Download Data (Deferred)

GetObjectRequest getRequest = new GetObjectRequest
{
Particle = objectId,
PhasedMode = true
};
DeferredActionResult deferredGet = client.StartDeferredActionAsync(getRequest).Result;

Check Deferred Request

DeferredCheckResult deferredPutResult = client.CheckDeferredActionAsync(putRequest).Result;

Fetch Data (Deferred)

getResult = client.GetAsync(getRequest).Result;