Create a context definition

post/contexts
Internal-Use Only

Creates a context definition. The new context is assigned a unique ID. The contextName namespace is managed by you, and the contextName must be unique. You can update contexts by performing a PUT on the corresponding URL.

Request Samples

1

Response Samples

1{
2 "description": "My Application Context",
3 "links": [
4 {
5 "method": "GET",
6 "rel": "self",
7 "href": "/compute/contexts/309b3f0b-cda8-4c2b-9089-82a07a4fff12",
8 "uri": "/compute/contexts/309b3f0b-cda8-4c2b-9089-82a07a4fff12",
9 "type": "application/vnd.sas.compute.context"
10 },
11 {
12 "method": "GET",
13 "rel": "alternate",
14 "href": "/compute/contexts/309b3f0b-cda8-4c2b-9089-82a07a4fff12",
15 "uri": "/compute/contexts/309b3f0b-cda8-4c2b-9089-82a07a4fff12",
16 "type": "application/vnd.sas.compute.context.summary"
17 },
18 {
19 "method": "PUT",
20 "rel": "update",
21 "href": "/compute/contexts/309b3f0b-cda8-4c2b-9089-82a07a4fff12",
22 "uri": "/compute/contexts/309b3f0b-cda8-4c2b-9089-82a07a4fff12",
23 "type": "application/vnd.sas.compute.context",
24 "responseType": "application/vnd.sas.compute.context"
25 },
26 {
27 "method": "PUT",
28 "rel": "updateWithRules",
29 "href": "/compute/contexts/309b3f0b-cda8-4c2b-9089-82a07a4fff12",
30 "uri": "/compute/contexts/309b3f0b-cda8-4c2b-9089-82a07a4fff12",
31 "type": "application/vnd.sas.compute.context.request",
32 "responseType": "application/vnd.sas.compute.context"
33 },
34 {
35 "method": "DELETE",
36 "rel": "delete",
37 "href": "/compute/contexts/309b3f0b-cda8-4c2b-9089-82a07a4fff12",
38 "uri": "/compute/contexts/309b3f0b-cda8-4c2b-9089-82a07a4fff12"
39 },
40 {
41 "method": "POST",
42 "rel": "createSession",
43 "href": "/compute/contexts/309b3f0b-cda8-4c2b-9089-82a07a4fff12/sessions",
44 "uri": "/compute/contexts/309b3f0b-cda8-4c2b-9089-82a07a4fff12/sessions",
45 "type": "application/vnd.sas.compute.session.request",
46 "responseType": "application/vnd.sas.compute.session"
47 },
48 {
49 "method": "GET",
50 "rel": "rules",
51 "href": "/authorization/rules?filter=eq(objectUri,'/compute/contexts/309b3f0b-cda8-4c2b-9089-82a07a4fff12/sessions')",
52 "uri": "/authorization/rules?filter=eq(objectUri,'/compute/contexts/309b3f0b-cda8-4c2b-9089-82a07a4fff12/sessions')",
53 "type": "application/vnd.sas.collection",
54 "responseType": "application/vnd.sas.authorization.rule"
55 }
56 ],
57 "launchType": "service",
58 "launchContext": {
59 "contextName": "compsrv"
60 },
61 "attributes": {
62 "sessionInactiveTimeout": 60
63 },
64 "mediaTypeMap": {
65 "csv": "application/vnd.ms-excel"
66 },
67 "createdBy": "myUserID",
68 "modifiedBy": "myUserID",
69 "modifiedTimeStamp": "2018-05-04T18:02:27.780000Z",
70 "creationTimeStamp": "2018-05-04T18:02:27.749000Z",
71 "id": "309b3f0b-cda8-4c2b-9089-82a07a4fff12",
72 "version": 4,
73 "name": "MyApp",
74 "queueName": "MyAppQueue",
75 "resources": [
76 {
77 "name": "file1",
78 "uri": "/files/files/ea0d3ee1-894f-4936-bc2b-f611a878a0dd",
79 "type": "application/vnd.sas.file",
80 "scope": "SESSION",
81 "options": {
82 "LRECL": 1024
83 }
84 }
85 ]
86}

Request Body

Specifies a context request.

Enables the creation of a new Compute context.

Example:
{"name":"MyApp","version":4,"description":"My Application Context","attributes":{"sessionInactiveTimeout":60},"launchContext":{"contextName":"compsrv"},"launchType":"service","authorizedUsers":["myUser"],"mediaTypeMap":{"csv":"application/vnd.ms-excel"},"resources":[{"name":"file1","uri":"/files/files/ea0d3ee1-894f-4936-bc2b-f611a878a0dd","type":"application/vnd.sas.file","scope":"SESSION","options":{"LRECL":1024}}],"queueName":"MyAppQueue"}
NameTypeRequiredDescription
name
string
true

Specifies the context name. The value of the name is limited to 100 characters. The value must be unique.

description
string
false

Specifies a localized description. The value of description is limited to 1000 characters.

launchContext
Launch Context
true

Provides information about the Launch context that is used by the Compute service.

launchType
string
true

Specifies the type of launcher to use when launching SAS Compute Servers. The only value currently supported is service, which refers to the Launcher service.

attributes
object
false

Specifies the attributes that control the behavior of sessions, based on this context. See the example for details.

environment
SAS Environment
false

Provides the SAS options and initialization code that is used by the Compute service and its sessions.

authorizedUsers
array [string]
false

Specifies the list of users who are allowed to request sessions using the specified context.

authorizedGroups
array [string]
false

Specifies the list of groups whose memes are allowed to request sessions using the specified context.

authorizeAllAuthenticatedUsers
boolean
false

Specifies whether all authenticated users are allowed to request sessions using the specified context. If true, then authorizedUsers and authorizedGroups are ignored.

facilitateGuest
boolean
false

Specifies whether the guest user is allowed to request sessions using the specified context.

mediaTypeMap
object
false

Specifies optional information that overrides mappings of file extensions to media types in sessions that are launched for this context. The session attempts to use file extensions to determine the media type of files that are returned. Standard IANA type mappings are used. To override the default behavior of the server, specify a mapping from a file extension to a media type name. That media type is then used for that file extension.

resources
array [External Resource]
false

Specifies the resources that have been requested to be added to this context.

queueName
string
false

Specifies the name of the workload queue where Compute servers configured from this context should run. If workload queues are not supported, this specification will be ignored. The value of the queue name is limited to 250 characters.

Responses

StatusMeaningDescription
201CreatedA context definition was created.HeadersSchema
400Bad RequestThe request was invalid. The contextName is already in use, or the request body is invalid.Schema