Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Resource Protocol Schema

Raw JSON schema

Open JSON schema file

Examples

CreateResourceRequest

{ "type": "file", "inputProperties": { "path": "pubkey.txt", "content": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQD" }, "isStateful": false }

CreateResourceResponse

{ "outputProperties": { "id": "vm-12w94ty8", "interfaces": { "eth0": { "ipv4": "198.51.100.11" } } } }

NixOps4 Resource Protocol Schema

Raw JSON schema

Title: NixOps4 Resource Protocol Schema

Typecombining
RequiredNo
Additional propertiesAny type allowed

Description: This schema describes the protocol between NixOps4 and a resource provider. See doc/developing-resources.md for more information.

One of(Option)
Request
Response

1. Property Request

Typecombining
RequiredNo
Additional propertiesAny type allowed
Defined in#/definitions/Request

1.1. Property CreateResourceRequest

Title: CreateResourceRequest

Typeobject
RequiredNo
Additional propertiesAny type allowed
PropertyTypePatternTitle/Description
+ createResourceRequestobjectNo-
1.1.1. Property createResourceRequest
Typeobject
RequiredYes
Additional propertiesNot allowed
Defined in#/definitions/CreateResourceRequest
PropertyTypePatternTitle/Description
+ typestringNoProvider-defined resource type
+ inputPropertiesobjectNoInput properties
+ isStatefulbooleanNoStateful resource
1.1.1.1. Property type

Title: Provider-defined resource type

Typestring
RequiredYes
Defined in#/definitions/resourceType

Description: The type of the resource to create. The resource provider uses this to distinguish between different types of resources that it manages. Furthermore, the type will be shown to the user. The resource type is chosen by the deployment expression, but must be one of the types that the resource provider supports. The resource provider must not proceed if the type is not supported.

1.1.1.2. Property inputProperties

Title: Input properties

Typeobject
RequiredYes
Additional propertiesAny type allowed
Defined in#/definitions/inputProperties

Description: Arbitrary fields that make up the input properties. The set of valid fields is determined by the resource provider implementation. If any unrecognized fields are present, the resource provider must not proceed and return an error.

PropertyTypePatternTitle/Description
-objectNo-
1.1.1.3. Property isStateful

Title: Stateful resource

Typeboolean
RequiredYes

Description: Whether the resource is declared to be stateful. If false, the response will not be persisted. If persistence is required, an error must be raised by the resource provider.

1.2. Property UpdateResourceRequest

Title: UpdateResourceRequest

Typeobject
RequiredNo
Additional propertiesAny type allowed
PropertyTypePatternTitle/Description
+ updateResourceRequestobjectNo-
1.2.1. Property updateResourceRequest
Typeobject
RequiredYes
Additional propertiesNot allowed
Defined in#/definitions/UpdateResourceRequest
PropertyTypePatternTitle/Description
+ resourceobjectNo-
+ inputPropertiesobjectNoInput properties
1.2.1.1. Property resource
Typeobject
RequiredYes
Additional propertiesNot allowed
Defined in#/definitions/ExtantResource
PropertyTypePatternTitle/Description
+ typestringNoProvider-defined resource type
+ inputPropertiesobjectNoInput properties
- outputPropertiesobjectNoOutput properties

####### 1.2.1.1.1. Property type

Title: Provider-defined resource type

Typestring
RequiredYes
Same definition astype

Description: The type of the resource to create. The resource provider uses this to distinguish between different types of resources that it manages. Furthermore, the type will be shown to the user. The resource type is chosen by the deployment expression, but must be one of the types that the resource provider supports. The resource provider must not proceed if the type is not supported.

####### 1.2.1.1.2. Property inputProperties

Title: Input properties

Typeobject
RequiredYes
Additional propertiesAny type allowed
Same definition asinputProperties

Description: Arbitrary fields that make up the input properties. The set of valid fields is determined by the resource provider implementation. If any unrecognized fields are present, the resource provider must not proceed and return an error.

####### 1.2.1.1.3. Property outputProperties

Title: Output properties

Typeobject
RequiredNo
Additional propertiesAny type allowed
Defined in#/definitions/outputProperties

Description: Arbitrary fields that make up the output properties. The set of fields is determined by the resource provider implementation. Unknown fields will be ignored by the Nix expressions.

PropertyTypePatternTitle/Description
-objectNo-
1.2.1.2. Property inputProperties

Title: Input properties

Typeobject
RequiredYes
Additional propertiesAny type allowed
Same definition asinputProperties

Description: Arbitrary fields that make up the input properties. The set of valid fields is determined by the resource provider implementation. If any unrecognized fields are present, the resource provider must not proceed and return an error.

1.3. Property StateResourceEvent

Title: StateResourceEvent

Typeobject
RequiredNo
Additional propertiesAny type allowed

Description:

Only implemented by state provider resources

PropertyTypePatternTitle/Description
+ stateResourceEventobjectNo-
1.3.1. Property stateResourceEvent
Typeobject
RequiredYes
Additional propertiesNot allowed
Defined in#/definitions/StateResourceEvent
PropertyTypePatternTitle/Description
+ resourceobjectNo-
+ eventstringNoThe operation that produced this change.
+ nixopsVersionstringNoThe version of NixOps that produced this event.
+ patcharrayNoJSON Patch
1.3.1.1. Property resource
Typeobject
RequiredYes
Additional propertiesNot allowed
Same definition asresource
1.3.1.2. Property event
Typestring
RequiredYes

Description: The operation that produced this change.

1.3.1.3. Property nixopsVersion
Typestring
RequiredYes

Description: The version of NixOps that produced this event.

1.3.1.4. Property patch

Title: JSON Patch

Typearray
RequiredYes
Defined in#/definitions/Patch

Description: JSON Patch operations to apply to the state.

Array restrictions
Min itemsN/A
Max itemsN/A
Items unicityFalse
Additional itemsFalse
Tuple validationSee below
Each item of this array must beDescription
patch items-

####### 1.3.1.4.1. patch items

Typecombining
RequiredNo
Additional propertiesAny type allowed
One of(Option)
item 0
item 1
item 2

####### 1.3.1.4.1.1. Property item 0

Typeobject
RequiredNo
Additional propertiesNot allowed
PropertyTypePatternTitle/Description
+ pathstringNoA JSON Pointer path.
+ openum (of string)NoThe operation to perform.
+ valueobjectNoThe value to add, replace or test.

####### 1.3.1.4.1.1.1. Property path

Typestring
RequiredYes
Defined in#/definitions/path

Description: A JSON Pointer path.

Restrictions
Must match regular expression^#?(|(/([^/~]|~[01])*)*)$ Test

####### 1.3.1.4.1.1.2. Property op

Typeenum (of string)
RequiredYes

Description: The operation to perform.

Must be one of:

  • "add"
  • "replace"
  • "test"

####### 1.3.1.4.1.1.3. Property value

Typeobject
RequiredYes
Additional propertiesAny type allowed

Description: The value to add, replace or test.

####### 1.3.1.4.1.2. Property item 1

Typeobject
RequiredNo
Additional propertiesNot allowed
PropertyTypePatternTitle/Description
+ pathstringNoA JSON Pointer path.
+ openum (of string)NoThe operation to perform.

####### 1.3.1.4.1.2.1. Property path

Typestring
RequiredYes
Same definition aspath

Description: A JSON Pointer path.

####### 1.3.1.4.1.2.2. Property op

Typeenum (of string)
RequiredYes

Description: The operation to perform.

Must be one of:

  • "remove"

####### 1.3.1.4.1.3. Property item 2

Typeobject
RequiredNo
Additional propertiesNot allowed
PropertyTypePatternTitle/Description
+ pathstringNoA JSON Pointer path.
+ openum (of string)NoThe operation to perform.
+ fromstringNoA JSON Pointer path pointing to the location to move/copy from.

####### 1.3.1.4.1.3.1. Property path

Typestring
RequiredYes
Same definition aspath

Description: A JSON Pointer path.

####### 1.3.1.4.1.3.2. Property op

Typeenum (of string)
RequiredYes

Description: The operation to perform.

Must be one of:

  • "move"
  • "copy"

####### 1.3.1.4.1.3.3. Property from

Typestring
RequiredYes
Defined in#/definitions/path

Description: A JSON Pointer path pointing to the location to move/copy from.

Restrictions
Must match regular expression^#?(|(/([^/~]|~[01])*)*)$ Test

1.4. Property StateResourceReadRequest

Title: StateResourceReadRequest

Typeobject
RequiredNo
Additional propertiesAny type allowed

Description:

Only implemented by state provider resources

PropertyTypePatternTitle/Description
+ stateResourceReadRequestobjectNo-
1.4.1. Property stateResourceReadRequest
Typeobject
RequiredYes
Additional propertiesNot allowed
Defined in#/definitions/StateResourceReadRequest
PropertyTypePatternTitle/Description
+ resourceobjectNo-
1.4.1.1. Property resource
Typeobject
RequiredYes
Additional propertiesNot allowed
Same definition asresource

2. Property Response

Typecombining
RequiredNo
Additional propertiesAny type allowed
Defined in#/definitions/Response

2.1. Property CreateResourceResponse

Title: CreateResourceResponse

Typeobject
RequiredNo
Additional propertiesAny type allowed
PropertyTypePatternTitle/Description
+ createResourceResponseobjectNo-
2.1.1. Property createResourceResponse
Typeobject
RequiredYes
Additional propertiesNot allowed
Defined in#/definitions/CreateResourceResponse
PropertyTypePatternTitle/Description
+ outputPropertiesobjectNoOutput properties
2.1.1.1. Property outputProperties

Title: Output properties

Typeobject
RequiredYes
Additional propertiesAny type allowed
Same definition asoutputProperties

Description: The properties of the created resource. The resource provider may return additional properties that are not defined in the resource type schema. It is not recommended to return verbatim inputProperties here, because that invites a dependency on the provider for information that is already known, deteriorating the user experience; concurrency, completeness of plan, unnecessary strictness, etc.

2.2. Property UpdateResourceResponse

Title: UpdateResourceResponse

Typeobject
RequiredNo
Additional propertiesAny type allowed
PropertyTypePatternTitle/Description
+ updateResourceResponseobjectNo-
2.2.1. Property updateResourceResponse
Typeobject
RequiredYes
Additional propertiesNot allowed
Defined in#/definitions/UpdateResourceResponse
PropertyTypePatternTitle/Description
+ outputPropertiesobjectNoOutput properties
2.2.1.1. Property outputProperties

Title: Output properties

Typeobject
RequiredYes
Additional propertiesAny type allowed
Same definition asoutputProperties

Description: Arbitrary fields that make up the output properties. The set of fields is determined by the resource provider implementation. Unknown fields will be ignored by the Nix expressions.

2.3. Property StateResourceEventResponse

Title: StateResourceEventResponse

Typeobject
RequiredNo
Additional propertiesAny type allowed

Description:

Only implemented by state provider resources

PropertyTypePatternTitle/Description
+ stateResourceEventResponseobjectNo-
2.3.1. Property stateResourceEventResponse
Typeobject
RequiredYes
Additional propertiesAny type allowed
Defined in#/definitions/StateResourceEventResponse

2.4. Property StateResourceReadResponse

Title: StateResourceReadResponse

Typeobject
RequiredNo
Additional propertiesAny type allowed

Description:

Only implemented by state provider resources

PropertyTypePatternTitle/Description
+ stateResourceReadResponseobjectNo-
2.4.1. Property stateResourceReadResponse
Typeobject
RequiredYes
Additional propertiesNot allowed
Defined in#/definitions/StateResourceReadResponse
PropertyTypePatternTitle/Description
+ stateobjectNoState
2.4.1.1. Property state

Title: State

Typeobject
RequiredYes
Additional propertiesAny type allowed

Description: The state of all the managed resources. This method is only implemented by resources that function as a state storage.

PropertyTypePatternTitle/Description
-objectNo-