Skip to content

Commit

Permalink
Merge pull request #22 from TheJumpCloud/ts-updates-2018-10-13
Browse files Browse the repository at this point in the history
API v1 and v2 updates 2018-10-13
  • Loading branch information
tsmithjc committed Oct 25, 2018
2 parents 7ed9099 + 719bcee commit 3201460
Show file tree
Hide file tree
Showing 23 changed files with 107 additions and 146 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,26 @@ To access our old API v1 Go client, please refer to
[JCAPI](https://github.com/TheJumpCloud/jcapi). However this code repository
is not up to date with current API functionality.

### Authentication and Authorization

All endpoints support authentication via API key: see the
[Authentication & Authorization](https://docs.jumpcloud.com/2.0/authentication-and-authorization/authentication-and-authorization-overview)
section in our API documentation.

Some systems endpoints (in both API v1 and v2) also support
[System Context Authorization](https://docs.jumpcloud.com/2.0/authentication-and-authorization/system-context)
which allows an individual system to manage its information and resource
associations.

### Usage Examples

```golang
For more detailed instructions, refer to each API version's respective README
file ([README for API v1](v1/README.md) and [README for API v2](v2/README.md))
and the generated documentation under each folder.

#### API v2 Example

```go
package main

import (
Expand Down Expand Up @@ -50,9 +67,9 @@ func main() {

```

System Context Authorization example:
#### System Context Authorization Example

```golang
```go
package main

import (
Expand Down
2 changes: 1 addition & 1 deletion config_v1.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"packageName": "v1",
"packageVersion": "1.33.0"
"packageVersion": "1.34.0"
}
2 changes: 1 addition & 1 deletion config_v2.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"packageName": "v2",
"packageVersion": "1.33.0"
"packageVersion": "1.34.0"
}
3 changes: 1 addition & 2 deletions v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client.

- API version: 1.0
- Package version: 1.33.0
- Package version: 1.34.0
- Build package: io.swagger.codegen.languages.GoClientCodegen

## Installation
Expand Down Expand Up @@ -101,7 +101,6 @@ Class | Method | HTTP request | Description
- [SystemputAgentBoundMessages](docs/SystemputAgentBoundMessages.md)
- [Systemslist](docs/Systemslist.md)
- [Systemuser](docs/Systemuser.md)
- [SystemuserAttributes](docs/SystemuserAttributes.md)
- [Systemuserbinding](docs/Systemuserbinding.md)
- [Systemuserbindingsput](docs/Systemuserbindingsput.md)
- [Systemuserput](docs/Systemuserput.md)
Expand Down
80 changes: 39 additions & 41 deletions v1/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2697,7 +2697,8 @@ definitions:
attributes:
type: "array"
items:
$ref: "#/definitions/systemuser_attributes"
type: "object"
properties: {}
created:
type: "string"
samba_service_user:
Expand Down Expand Up @@ -2951,7 +2952,7 @@ definitions:
description: "The Command OS"
commandRunners:
type: "array"
description: "an array of IDs of the Command Runner Users that can execute\
description: "An array of IDs of the Command Runner Users that can execute\
\ this command."
items:
type: "string"
Expand Down Expand Up @@ -3122,7 +3123,7 @@ definitions:
properties: {}
badLoginAttempts:
type: "integer"
minimum: 1
minimum: 0
password_never_expires:
type: "boolean"
middlename:
Expand Down Expand Up @@ -3173,7 +3174,7 @@ definitions:
type: "type"
extendedAddress: "extendedAddress"
region: "region"
badLoginAttempts: 1
badLoginAttempts: 0
account_locked: true
totp_enabled: true
unix_guid: 0
Expand Down Expand Up @@ -3436,7 +3437,7 @@ definitions:
type: "type"
extendedAddress: "extendedAddress"
region: "region"
badLoginAttempts: 1
badLoginAttempts: 0
account_locked: true
totp_enabled: true
unix_guid: 0
Expand Down Expand Up @@ -3516,7 +3517,7 @@ definitions:
type: "type"
extendedAddress: "extendedAddress"
region: "region"
badLoginAttempts: 1
badLoginAttempts: 0
account_locked: true
totp_enabled: true
unix_guid: 0
Expand Down Expand Up @@ -4599,10 +4600,6 @@ definitions:
networkSourceIp: "0.0.0.0"
tagsNames:
- "tag1"
systemuser_attributes:
properties:
?
: type: "string"
systemuserputpost_addresses:
properties:
type:
Expand Down Expand Up @@ -4730,7 +4727,7 @@ definitions:
\ an empty string, it will run immediately.\n"
trigger:
type: "string"
description: "trigger to execute command."
description: "Trigger to execute command."
scheduleRepeatType:
type: "string"
description: "When the command will repeat."
Expand Down Expand Up @@ -5037,7 +5034,7 @@ definitions:
properties:
_id:
type: "string"
description: "the ID of the organization."
description: "The ID of the organization."
displayName:
type: "string"
description: "The name of the organization."
Expand Down Expand Up @@ -5434,23 +5431,23 @@ x-stoplight:
\ Depending on your type of integration you may be required to use both V1\
\ and V2 APIs.\n\nPlease refer to our [API V2](https://docs.jumpcloud.com/2.0)\
\ docs to understand the functionality available in that API set.\n\n### API\
\ SDKS\n\nYou can find language specific SDKs that can help you kickstart\
\ SDKs\n\nYou can find language specific SDKs that can help you kickstart\
\ your Integration with JumpCloud in the following GitHub repositories:\n\n\
* [Python](https://github.com/TheJumpCloud/jcapi-python)\n* [Go](https://github.com/TheJumpCloud/jcapi-go)\n\
* [Ruby](https://github.com/TheJumpCloud/jcapi-ruby)\n* [Java](https://github.com/TheJumpCloud/jcapi-java)"
public: true
authentication-and-authorization-overview:
id: "authentication-and-authorization-overview"
name: "API Key"
content: "#### Access your API Key\n\nTo locate your API Key:\n1. Log into the\
content: "#### Access Your API Key\n\nTo locate your API Key:\n1. Log into the\
\ [JumpCloud Admin Console](https://console.jumpcloud.com/)\n2. Go to the\
\ username drop down located in the top-right of the Console.\n3. Retrieve\
\ your API key from API Settings.\n\n#### API Key Considerations\n\nThis API\
\ key is associated to the currently logged in administrator. Other admins\
\ will have different API keys.\n\nPlease keep this API key secret, as it\
\ grants full access to any data accessible via your JumpCloud console account.\n\
\nYou can also reset your API key in the same location in the JumpCloud Admin\
\ Console.\n\n##### Recycling or Reseting your API Key\n\nIn order to revoke\
\ Console.\n\n##### Recycling or Resetting Your API Key\n\nIn order to revoke\
\ access with the current API key, simply reset your API key. This will render\
\ all calls using the previous API key inaccessible.\n\nFor API V1 the API\
\ key will be passed in as a header with the header name \"x-api-key\".\n\n\
Expand All @@ -5468,7 +5465,7 @@ x-stoplight:
\ a system can manage its information and resource associations, allowing\
\ modern auto provisioning environments to scale as needed.\n\n**Note: The\
\ following documentation applies to Linux Operating Systems only.**\n\n###\
\ Supported endpoints\n\nJumpCloud System Context Authorization can be used\
\ Supported Endpoints\n\nJumpCloud System Context Authorization can be used\
\ in conjunction with Systems endpoints found in the V1 API and certain System\
\ Group endpoints found in the v2 API.\n\n- A system may fetch, alter, and\
\ delete metadata about itself, including manipulating a system's Group and\
Expand All @@ -5485,7 +5482,7 @@ x-stoplight:
- A system may alter its System Group associations\n - `/api/v2/systemgroups/{systemgroup_id}/members`\
\ | [`POST`](https://docs.jumpcloud.com/2.0/system-groups/update-a-system-group)\n\
\ - _NOTE_ If a system attempts to alter the system group membership of\
\ a different system the request will be rejected\n\n\n### Response codes\n\
\ a different system the request will be rejected\n\n\n### Response Codes\n\
\nIf endpoints other than those described above are called using the System\
\ Context API the server will return a `401` response.\n\n### Authentication\n\
\nTo allow for secure access to our APIs, you must authenticate each API request.\n\
Expand All @@ -5494,13 +5491,14 @@ x-stoplight:
\ are similar to the signatures used by the Amazon Web Services REST API.\n\
To help with the request-signing process, we have provided an [example bash\
\ script](https://github.com/TheJumpCloud/SystemContextAPI/blob/master/examples/shell/SigningExample.sh).\
\ You must be root, or have permissions to access the contents of the `/opt/jc`\
\ directory to generate a signature.\n\n\nHere is a breakdown of the example\
\ script, with explanations.\n\nThe first thing the script does is extract\
\ the systemKey from the JSON formatted `/opt/jc/jcagent.conf` file.\n\n```\n\
#!/bin/bash\n\nconf=\"`cat /opt/jc/jcagent.conf`\"\nregex=\"systemKey\\\"\
:\\\"(\\w+)\\\"\"\n\nif [[ $conf =~ $regex ]] ; then\n systemKey=\"${BASH_REMATCH[1]}\"\
\nfi\n```\n\nThen the script retrieves the current date in the correct format.\n\
\ This example API request simply requests the entire system record. You must\
\ be root, or have permissions to access the contents of the `/opt/jc` directory\
\ to generate a signature.\n\n\nHere is a breakdown of the example script,\
\ with explanations.\n\nThe first thing the script does is extract the systemKey\
\ from the JSON formatted `/opt/jc/jcagent.conf` file.\n\n```\n#!/bin/bash\n\
\nconf=\"`cat /opt/jc/jcagent.conf`\"\nregex=\"systemKey\\\":\\\"(\\w+)\\\"\
\"\n\nif [[ $conf =~ $regex ]] ; then\n systemKey=\"${BASH_REMATCH[1]}\"\n\
fi\n```\n\nThen the script retrieves the current date in the correct format.\n\
\n```\nnow=`date -u \"+%a, %d %h %Y %H:%M:%S GMT\"`;\n```\n\nNext we build\
\ a signing string to demonstrate the expected signature format. The signed\
\ string must consist of the [request-line](https://tools.ietf.org/html/rfc2616#page-35)\
Expand All @@ -5514,13 +5512,13 @@ x-stoplight:
\ in:\n\n```\nsignature=`printf \"$signstr\" | openssl dgst -sha256 -sign\
\ /opt/jc/client.key | openssl enc -e -a | tr -d '\\n'` ;\n```\n\nFinally,\
\ we make sure the API call sending the signature has the same Authorization\
\ header and Date header values that were used in the signing string.\nThis\
\ example API request simply requests the entire system record.\n\n```\ncurl\
\ -iq \\\n -H \"Accept: application/json\" \\\n -H \"Content-Type: application/json\"\
\ \\\n -H \"Date: ${now}\" \\\n -H \"Authorization: Signature keyId=\\\"\
system/${systemKey}\\\",headers=\\\"request-line date\\\",algorithm=\\\"rsa-sha256\\\
\",signature=\\\"${signature}\\\"\" \\\n --url https://console.jumpcloud.com/api/systems/${systemKey}\n\
```\n\n#### Input data\n\nAll PUT and POST methods should use the HTTP Content-Type\
\ and Date header values, HTTP method, and URL that were used in the signing\
\ string.\n\n```\ncurl -iq \\\n -H \"Accept: application/json\" \\\n -H\
\ \"Content-Type: application/json\" \\\n -H \"Date: ${now}\" \\\n -H \"\
Authorization: Signature keyId=\\\"system/${systemKey}\\\",headers=\\\"request-line\
\ date\\\",algorithm=\\\"rsa-sha256\\\",signature=\\\"${signature}\\\"\" \\\
\n --url https://console.jumpcloud.com/api/systems/${systemKey}\n```\n\n\
#### Input Data\n\nAll PUT and POST methods should use the HTTP Content-Type\
\ header with a value of 'application/json'. PUT methods are used for updating\
\ a record. POST methods are used to create a record.\n\nThe following example\
\ demonstrates how to update the `displayName` of the system.\n\n```\nsignstr=\"\
Expand All @@ -5532,16 +5530,16 @@ x-stoplight:
\ \"Authorization: Signature keyId=\\\"system/${systemKey}\\\",headers=\\\"\
request-line date\\\",algorithm=\\\"rsa-sha256\\\",signature=\\\"${signature}\\\
\"\" \\\n --url https://console.jumpcloud.com/api/systems/${systemKey}\n\
```\n\n\n#### Output data\n\nAll results will be formatted as JSON.\n\nHere\
```\n\n\n#### Output Data\n\nAll results will be formatted as JSON.\n\nHere\
\ is an abbreviated example of response output:\n\n```\n{\n \"__v\": 0,\n\
\ \"_id\": \"525ee96f52e144993e000015\",\n \"agentServer\": \"lappy386\"\
,\n \"agentVersion\": \"0.9.42\",\n \"arch\": \"x86_64\",\n \"connectionKey\"\
: \"127.0.0.1_51812\",\n \"displayName\": \"ubuntu-1204\",\n \"firstContact\"\
: \"2013-10-16T19:30:55.611Z\",\n \"hostname\": \"ubuntu-1204\"\n ...\n\
```\n\n\n### Additional examples\n\n#### Signing authentication example\n\n\
```\n\n\n### Additional Examples\n\n#### Signing Authentication Example\n\n\
This example demonstrates how to make an authenticated request to fetch the\
\ JumpCloud record for this system.\n\n[SigningExample.sh](https://github.com/TheJumpCloud/SystemContextAPI/blob/master/examples/shell/SigningExample.sh)\n\
\n\n#### Shutdown hook\n\nThis example demonstrates how to make authenticated\
\n\n#### Shutdown Hook\n\nThis example demonstrates how to make authenticated\
\ request on system shutdown.\nUsing an init.d script registered at run level\
\ 0, you can call the System Context API as the system is shutting down.\n\
\n[Instance-shutdown-initd](https://github.com/TheJumpCloud/SystemContextAPI/blob/master/examples/instance-shutdown-initd)\
Expand All @@ -5551,26 +5549,26 @@ x-stoplight:
\n1. Copy the modified [instance-shutdown-initd](https://github.com/TheJumpCloud/SystemContextAPI/blob/master/examples/instance-shutdown-initd)\
\ to `/etc/init.d/instance-shutdown`\n2. On Ubuntu systems, run `update-rc.d\
\ instance-shutdown defaults`. On RedHat/CentOS systems, run `chkconfig --add\
\ instance-shutdown`\n\n\n### Third party\n\n#### Chef cookbooks\n\n[https://github.com/nshenry03/jumpcloud](https://github.com/nshenry03/jumpcloud)\n\
\ instance-shutdown`\n\n\n### Third Party\n\n#### Chef Cookbooks\n\n[https://github.com/nshenry03/jumpcloud](https://github.com/nshenry03/jumpcloud)\n\
\n[https://github.com/cjs226/jumpcloud](https://github.com/cjs226/jumpcloud)"
public: true
multi-tenant-organization-api-headers:
id: "multi-tenant-organization-api-headers"
name: "Multi Tenant Organization API Headers"
content: "Multi-Tenant Organization API Headers are available for JumpCloud\
\ Admins to use when making API requests from Organizations that have multiple\
\ managed organizations. \n\nThe `x-org-id` is a required header for all multi-tenant\
\ managed organizations.\n\nThe `x-org-id` is a required header for all multi-tenant\
\ admins when making API requests to Jumpcloud as this header will define\
\ what organization you would like to make the request for. \n\nPlease note\
\ what organization you would like to make the request for.\n\nPlease note\
\ that Single Tenant Admins do not need to provide this header when making\
\ an API request.\n \n #### Header Value\n \n `x-org-id`\n\n#### API Response\
\ codes\n\n- `400` Malformed ID.\n- `400` x-org-id and Organization path ID\
\ an API request.\n\n#### Header Value\n\n`x-org-id`\n\n#### API Response\
\ Codes\n\n- `400` Malformed ID.\n- `400` x-org-id and Organization path ID\
\ do not match.\n- `401` ID not included for multi-tenant admin\n- `403` ID\
\ included on unsupported route.\n- `404` Organization ID Not Found.\n\n####\
\ Sample Request\n```\ncurl -X GET https://console.jumpcloud.com/api/v2/directories\
\ \\\n -H 'accept: application/json' \\\n -H 'content-type: application/json'\
\ \\\n -H 'x-api-key: {API_KEY}' \\\n -H 'x-org-id: {ORG_ID}'\n\n```\n\n\
#### To obtain an individual Organization ID via the UI\n\nAs a prerequisite\
#### To Obtain an Individual Organization ID via the UI\n\nAs a prerequisite\
\ your Primary Organization will need to be setup for Multi-Tenancy which\
\ will give you access to the Multi-Tenant Organization Admin Portal.\n\n\
1. Log into JumpCloud [Admin Console](https://console.jumpcloud.com). If you\
Expand All @@ -5580,7 +5578,7 @@ x-stoplight:
\ be routed to that Organization's Admin Console.\n4. Go to Settings in the\
\ sub-tenant's primary navigation.\n5. You can obtain your Organization ID\
\ below your Organization's Contact Information on the Settings page.\n\n\
#### To obtain all Organization IDs via the API\n\n1. You can make an API\
#### To Obtain All Organization IDs via the API\n\n1. You can make an API\
\ request to this endpoint using the API key of your Primary Organization.\
\ `https://console.jumpcloud.com/api/organizations/` This will return all\
\ your managed organizations.\n\n#### Sample Request\n```\ncurl -X GET \\\n\
Expand Down
2 changes: 1 addition & 1 deletion v1/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Command struct {
// The Command OS
CommandType string `json:"commandType,omitempty"`

// an array of IDs of the Command Runner Users that can execute this command.
// An array of IDs of the Command Runner Users that can execute this command.
CommandRunners []string `json:"commandRunners,omitempty"`

// The ID of the system user to run the command as.
Expand Down
2 changes: 1 addition & 1 deletion v1/commandslist_results.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type CommandslistResults struct {
// A crontab that consists of: [ (seconds) (minutes) (hours) (days of month) (months) (weekdays) ] or [ immediate ]. If you send this as an empty string, it will run immediately.
Schedule string `json:"schedule,omitempty"`

// trigger to execute command.
// Trigger to execute command.
Trigger string `json:"trigger,omitempty"`

// When the command will repeat.
Expand Down
2 changes: 1 addition & 1 deletion v1/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func NewConfiguration() *Configuration {
cfg := &Configuration{
BasePath: "https://console.jumpcloud.com/api",
DefaultHeader: make(map[string]string),
UserAgent: "Swagger-Codegen/1.33.0/go",
UserAgent: "Swagger-Codegen/1.34.0/go",
}
return cfg
}
Expand Down
2 changes: 1 addition & 1 deletion v1/docs/Command.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Name | Type | Description | Notes
**Name** | **string** | | [optional] [default to null]
**Command** | **string** | The command to execute on the server. | [default to null]
**CommandType** | **string** | The Command OS | [optional] [default to null]
**CommandRunners** | **[]string** | an array of IDs of the Command Runner Users that can execute this command. | [optional] [default to null]
**CommandRunners** | **[]string** | An array of IDs of the Command Runner Users that can execute this command. | [optional] [default to null]
**User** | **string** | The ID of the system user to run the command as. | [default to null]
**Sudo** | **bool** | | [optional] [default to null]
**Systems** | **[]string** | An array of system IDs to run the command on. Not available if you are using Groups. | [optional] [default to null]
Expand Down
2 changes: 1 addition & 1 deletion v1/docs/CommandslistResults.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Name | Type | Description | Notes
**LaunchType** | **string** | How the Command is executed. | [optional] [default to null]
**ListensTo** | **string** | | [optional] [default to null]
**Schedule** | **string** | A crontab that consists of: [ (seconds) (minutes) (hours) (days of month) (months) (weekdays) ] or [ immediate ]. If you send this as an empty string, it will run immediately. | [optional] [default to null]
**Trigger** | **string** | trigger to execute command. | [optional] [default to null]
**Trigger** | **string** | Trigger to execute command. | [optional] [default to null]
**ScheduleRepeatType** | **string** | When the command will repeat. | [optional] [default to null]
**Organization** | **string** | The ID of the Organization. | [optional] [default to null]
**Id** | **string** | The ID of the command. | [optional] [default to null]
Expand Down
Loading

0 comments on commit 3201460

Please sign in to comment.