LaunchKey Service SDK Documentation

Overview

The LaunchKey Service SDK is broken into credential based factories that make functionality based clients. Clients can be directly instantiated. However, the factory builder, and factory factory, and client factories are a much cleaner, and often simpler, way to construct clients.

Factory Factory

Note

Python does not currently use a factory factory.

Funny name aside, the Factory factory’s purpose is to build credential based client factories.

The factory factory contains all of the pieces and parts for creating a client factory. To simplify the process of building the factory factory, we have provided a factory factory builder. The FactoryFactoryBuilder provides a number of methods to customize the FactoryFactory.

Example using a specific HTTP client:

var httpClient = new WebRequestHttpClient(TimeSpan.FromSeconds(30));
var factoryFactory = new FactoryFactoryBuilder()
    .SetHttpClient(httpClient)
    .Build();
HttpClient httpClient = HttpClients.createDefault();
FactoryFactory factoryFactory = new FactoryFactoryBuilder()
    .setHttpClient(httpClient)
    .build();
// Python does not have a FactoryFactory or FactoryFactoryBuilder

Factories

Factories are based on the credentials supplied. The Organization Factory uses Organization credentials, the Directory Factory uses Directory credentials, and the Service Factory uses Service credentials.

Example creating a ServiceFactory:

var servicePrivateKey = File.ReadAllText("service_private_key.pem'");
var serviceId = "9ecc57e0-fb0f-4971-ba12-399b630158b0";
var serviceFactory = new FactoryFactoryBuilder()
    .Build()
    .MakeServiceFactory(serviceId, servicePrivateKey);
File file = new File("service_private_key.pem");
Scanner sc = new Scanner(privateKeyFile);
StringBuilder sb = new StringBuilder();
while (sc.hasNextLine()) {
    sb.append(sc.nextLine()).append("\n");
}
String servicePrivateKey = sb.toString();
String serviceId = "9ecc57e0-fb0f-4971-ba12-399b630158b0";
ServiceFactory serviceFactory = new FactoryFactoryBuilder()
        .build()
        .makeServiceFactory(serviceId, servicePrivateKey);
# Python does not have a FactoryFactory or FactoryFactoryBuilder
with open('service_private_key.pem') as pem:
    service_private_key = pem.read()
service_id = "9ecc57e0-fb0f-4971-ba12-399b630158b0"
service_factory = ServiceFactory(service_id, service_private_key)

Each factory makes clients that access distinct functionality. The availability is based on the hierarchy of the entities themselves. Below is a matrix of available clients for each factory.

Factory/Client Grid Organization Client Directory Client Service Client
Organization Factory Yes Yes Yes
Directory Factory No Yes Yes
Service Factory No No Yes

Example creating a ServiceClient from a ServiceFactory:

var servicePrivateKey = File.ReadAllText("service_private_key.pem'");
var serviceId = "9ecc57e0-fb0f-4971-ba12-399b630158b0";
var serviceFactory = new FactoryFactoryBuilder()
    .Build()
    .MakeServiceFactory(serviceId, servicePrivateKey);
var serviceClient = serviceFactory.MakeServiceClient();
File file = new File("service_private_key.pem");
Scanner sc = new Scanner(privateKeyFile);
StringBuilder sb = new StringBuilder();
while (sc.hasNextLine()) {
    sb.append(sc.nextLine()).append("\n");
}
String servicePrivateKey = sb.toString();
String serviceId = "9ecc57e0-fb0f-4971-ba12-399b630158b0";
ServiceFactory serviceFactory = new FactoryFactoryBuilder()
    .build()
    .makeServiceFactory(serviceId, servicePrivateKey);
ServiceClient serviceClient = serviceFactory.makeServiceClient();
# Python does not have a FactoryFactory or FactoryFactoryBuilder
with open('service_private_key.pem') as pem:
    service_private_key = pem.read()
service_id = "9ecc57e0-fb0f-4971-ba12-399b630158b0"
service_factory = ServiceFactory(service_id, service_private_key)
service_client = service_factory.make_service_client()

For information regarding each factory, see the links below.

Clients

For information regarding each client, see the links below.

User Contributed

LaunchKey links to user contributed code as a resource to its community. LaunchKey does not in any way guarantee or warrant the quality and security of these code bases. User contributed code is supported by the creators. If you do find a link from the site to user contributed code that is malicious or inappropriate in any way, please report that link to LaunchKey immediately and we will investigate the claim. Submit any issue to LaunchKey support at https://launchkey.com./support. ×