swagger: '2.0' info: title: Resource manager API description: Manage Cloud Computing resources via API. version: "0.1.12" # the domain of the service host: 127.0.0.1:8002 # array of all schemes that your API supports schemes: # TODO: Change to HTTPS when not on localhost! - http # will be prefixed to all paths #basePath: /rpapp consumes: - application/json produces: - application/json securityDefinitions: api_key: type: apiKey name: Authorization in: header paths: /clusters/: get: summary: Get the list of all the cluster definitions registered. description: | Get the list of all the cluster definitions registered. No authentification is required. tags: - Cluster definitions responses: 200: description: An array of Cluster definitions schema: type: array items: $ref: '#/definitions/Cluster' default: description: Unexpected error schema: $ref: '#/definitions/Error' post: summary: Add a new cluster definition. description: | Add a new cluster definition. Authentification is required. security: - api_key: [] parameters: - name: data in: body description: cluster definition required: true schema: $ref: '#/definitions/ClusterPost' tags: - Cluster definitions responses: 201: description: The newly created cluster definition schema: $ref: '#/definitions/Cluster' default: description: Unexpected error schema: $ref: '#/definitions/Error' /clusters/{id}/: get: summary: Get a single cluster definition. description: | Get a single cluster definition. Authentification is required. parameters: - name: id in: path description: Id of the cluster description required: true type: integer minimum: 0 tags: - Cluster definitions responses: 200: description: The Cluster definitions matching the given Id schema: $ref: '#/definitions/Cluster' 404: description: No cluster definition with the given Id schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' put: summary: Redefine an already existing cluster definition. description: | Redefine an already existing cluster definition. Authentification is required. security: - api_key: [] parameters: - name: id in: path description: Id of the cluster description required: true type: integer minimum: 0 - name: data in: body description: cluster definition required: true schema: $ref: '#/definitions/ClusterPost' tags: - Cluster definitions responses: 200: description: The updated cluster definition schema: $ref: '#/definitions/Cluster' 404: description: No cluster definition with the given Id schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' delete: summary: Delete an already existing cluster definition. description: | Delete an already existing cluster definition. Authentification is required. parameters: - name: id in: path description: Id of the cluster description required: true type: integer minimum: 0 security: - api_key: [] tags: - Cluster definitions responses: 204: description: cluster definition correctly deleted 404: description: No cluster definition with the given Id schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' /clusters/{id}/new_account/: post: summary: Create a new user account on the specified cluster. description: | Create a new user account on the specified cluster. parameters: - name: id in: path description: Id of the cluster required: true type: integer minimum: 0 tags: - Cluster definitions responses: 201: description: The new account created on the cluster matching the given Id schema: $ref: '#/definitions/TemporaryAccountCredential' 404: description: No cluster definition with the given Id schema: $ref: '#/definitions/Error' 503: description: The cluster is not ready yet (still bootstrapping) schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' /clusters/{id}/add_host/: post: summary: Add a host to the specified cluster. description: | Add a host to the specified cluster. parameters: - name: id in: path description: Id of the cluster required: true type: integer minimum: 0 tags: - Cluster definitions responses: 201: description: The cluster matching the given Id schema: $ref: '#/definitions/Cluster' 404: description: No cluster definition with the given Id schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' /clusters/{id}/remove_host/: post: summary: Remove a host from the specified cluster. description: | Remove a host from the specified cluster. parameters: - name: id in: path description: Id of the cluster required: true type: integer minimum: 0 tags: - Cluster definitions responses: 201: description: The cluster matching the given Id schema: $ref: '#/definitions/Cluster' 404: description: No cluster definition with the given Id schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' /hosts/: get: summary: Get the list of all the Host definitions registered. description: | Get the list of all the Host definitions registered. No authentification is required. tags: - Host definitions responses: 200: description: An array of Host definitions schema: type: array items: $ref: '#/definitions/hosts' default: description: Unexpected error schema: $ref: '#/definitions/Error' post: summary: Add a new host definition. description: | Add a new host definition. Authentification is required. security: - api_key: [] parameters: - name: data in: body description: host definition required: true schema: $ref: '#/definitions/hostsPost' tags: - Host definitions responses: 201: description: The newly created host definition schema: $ref: '#/definitions/hosts' default: description: Unexpected error schema: $ref: '#/definitions/Error' /hosts/{id}/: get: summary: Get a single host definition. description: | Get a single host definition. Authentification is required. parameters: - name: id in: path description: Id of the host description required: true type: integer minimum: 0 tags: - Host definitions responses: 200: description: The Host definitions matching the given Id schema: $ref: '#/definitions/hosts' 404: description: No host definition with the given Id schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' delete: summary: Delete an existing host definition. description: | Delete an already existing host definition. Authentification is required. parameters: - name: id in: path description: Id of the host required: true type: integer minimum: 0 security: - api_key: [] tags: - Host definitions responses: 204: description: host correctly deleted 404: description: No host with the given Id schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' /users/: get: summary: Get the list of all the users registered. description: | Get the list of all the users registered. No authentification is required. tags: - Users responses: 200: description: An array of users schema: type: array items: $ref: '#/definitions/User' default: description: Unexpected error schema: $ref: '#/definitions/Error' post: summary: Register a new user. description: | Register a new user. Authentification is required. security: - api_key: [] parameters: - name: data in: body description: User required: true schema: $ref: '#/definitions/UserPost' tags: - Users responses: 201: description: The newly created user schema: $ref: '#/definitions/User' default: description: Unexpected error schema: $ref: '#/definitions/Error' /users/{id}/: get: summary: Get a single user. description: | Get a single user. Authentification is required. parameters: - name: id in: path description: ID of the user required: true type: integer minimum: 0 tags: - Users responses: 200: description: The user matching the given ID schema: $ref: '#/definitions/User' 404: description: No user with the given ID schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' put: summary: Redefine an already existing user. description: | Redefine an already existing user. Authentification is required. security: - api_key: [] parameters: - name: id in: path description: ID of the user required: true type: integer minimum: 0 - name: data in: body description: User required: true schema: $ref: '#/definitions/UserPost' tags: - Users responses: 200: description: The updated user schema: $ref: '#/definitions/User' 404: description: No user with the given ID schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' patch: summary: Modify an already existing user. description: | Modify an already existing user. Authentification is required. security: - api_key: [] parameters: - name: id in: path description: ID of the user required: true type: integer minimum: 0 - name: data in: body description: User required: true schema: $ref: '#/definitions/UserPatch' tags: - Users responses: 200: description: The updated user schema: $ref: '#/definitions/User' 404: description: No user with the given ID schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' delete: summary: Delete an already existing user. description: | Delete an already existing user. Authentification is required. parameters: - name: id in: path description: ID of the user required: true type: integer minimum: 0 security: - api_key: [] tags: - Users responses: 204: description: User correctly deleted 404: description: No user with the given ID schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' /credentials/: get: summary: Get the list of all the credentials registered. description: | Get the list of all the users registered. No authentification is required. tags: - Credentials responses: 200: description: An array of credentials schema: type: array items: $ref: '#/definitions/Credential' default: description: Unexpected error schema: $ref: '#/definitions/Error' post: summary: Register new credentials. description: | Register new credentials. Authentification is required. security: - api_key: [] parameters: - name: data in: body description: Credentials required: true schema: $ref: '#/definitions/CredentialPost' tags: - Credentials responses: 201: description: The newly created credentials schema: $ref: '#/definitions/Credential' default: description: Unexpected error schema: $ref: '#/definitions/Error' /credentials/{id}/: get: summary: Get a single piece of credentials. description: | Get a single piece of credentials. Authentification is required. parameters: - name: id in: path description: ID of the credentials required: true type: integer minimum: 0 tags: - Credentials responses: 200: description: The credentials matching the given ID schema: $ref: '#/definitions/Credential' 404: description: No user with the given ID schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' put: summary: Redefine an already existing piece of credentials. description: | Redefine an already existing piece of credentials. Authentification is required. security: - api_key: [] parameters: - name: id in: path description: ID of the credentials required: true type: integer minimum: 0 - name: data in: body description: Credentials required: true schema: $ref: '#/definitions/Credential' tags: - Credentials responses: 200: description: The updated credentials schema: $ref: '#/definitions/Credential' 404: description: No credentials with the given ID schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' patch: summary: Modify an already existing piece of credentials. description: | Modify an already existing piece of credentials. Authentification is required. security: - api_key: [] parameters: - name: id in: path description: ID of the credentials required: true type: integer minimum: 0 - name: data in: body description: Credentials required: true schema: $ref: '#/definitions/CredentialPatch' tags: - Credentials responses: 200: description: The updated user schema: $ref: '#/definitions/Credential' 404: description: No user with the given ID schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' delete: summary: Delete an already existing piece of credentials. description: | Delete an already existing piece of credentials. Authentification is required. parameters: - name: id in: path description: ID of the credentials required: true type: integer minimum: 0 security: - api_key: [] tags: - Credentials responses: 204: description: Credentials correctly deleted 404: description: No credentials with the given ID schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' /credentials/user/{id}/: get: summary: Get all the credentials of a user (without password). description: | Get all the credentials of a user (without password). Authentification is not required. parameters: - name: id in: path description: ID of the user required: true type: integer minimum: 0 tags: - Credentials responses: 200: description: An array of credentials schema: type: array items: $ref: '#/definitions/Credential' 404: description: No user with the given ID schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' /rsa_public_key/{id}/: get: summary: Get the RSA public key of a user. description: | Get the RSA public key of a user. Authentification is not required. parameters: - name: id in: path description: ID of the user required: true type: integer minimum: 0 tags: - Users responses: 200: description: The RSA public key of the user matching the given ID schema: $ref: '#/definitions/PublicKey' 404: description: No user with the given ID schema: $ref: '#/definitions/Error' default: description: Unexpected error schema: $ref: '#/definitions/Error' /api-token-auth/: post: summary: Get the authentification token for a user. description: | Get the authentification token for a user by providing his username and password. No authentification is required; however the credentials of the user are part of the request. parameters: - name: data in: body description: User credentials required: true schema: $ref: '#/definitions/Credentials' tags: - Users responses: 200: description: The authentification token of the user schema: $ref: '#/definitions/TokenResp' default: description: Unexpected error schema: $ref: '#/definitions/Error' definitions: Cluster: type: object properties: id: type: integer description: Unique ID of the cluster name: type: string description: Name given to the cluster uuid: type: string description: Internal UUID given to the cluster hints: type: string description: hints that will be used to select the infrastructure that will host cluster's nodes credential: type: string description: hints that will be used to select the infrastructure that will host cluster's nodes public_key: type: string description: Public key used to identify nodes of the cluster status: type: string description: Status of the cluster hosts_ids: type: array description: IDs of nodes of the cluster (can be null) items: type: string targeted_slaves_count: type: integer description: targeted number of slaves in the cluster current_slaves_count: type: integer description: current number of slaves in the cluster hosts_ips: type: array description: IP addresses of nodes of the cluster (can be null) items: type: string master_node_id: type: integer description: ID of the master node of the cluster (can be null) master_node_ip: type: string description: IP address of the master node of the cluster (can be null) user_id: type: integer description: ID of the user that created the cluster appliance: type: string description: Appliance of the cluster appliance_impl: type: string description: Appliance of the cluster ClusterPost: type: object required: - name - appliance - targeted_slaves_count properties: name: description: Name given to the cluster type: string appliance: type: string description: Appliance of the cluster targeted_slaves_count: type: integer description: Number of slaves in the cluster hosts: type: object properties: id: type: integer description: Unique ID of the host name: type: string description: Name given to the host is_master: type: boolean description: True if the host is a master_node instance_ip: type: string description: IP address of the host cluster_id: type: integer description: ID of the cluster hostsPost: type: object required: - cluster_id properties: cluster_id: description: ID of the cluster in which a new node will be added type: integer name: description: Name given to the host type: string User: type: object properties: id: type: integer description: Unique identifier representing a specific user username: type: string description: Name given to the user first_name: type: string description: First name of the user last_name: type: string description: Last name of the user email: type: string description: Email of the user credentials: type: array description: Array of the credentials IDs of the user items: type: integer clusters: type: array description: Array of the clusters IDs of the user items: type: integer is_staff: type: integer description: Boolean stating wether the user is a staff member or not is_superuser: type: integer description: Boolean stating wether the user is a superuser or not is_active: type: integer description: Boolean stating wether the user is active or not date_joined: type: string format: date-time description: Date and time of creation of the user UserPost: type: object required: - username - password properties: username: type: string description: Name given to the user password: type: string description: Password of the user first_name: type: string description: First name of the user last_name: type: string description: Last name of the user email: type: string description: Email of the user UserPatch: type: object properties: username: type: string description: Name given to the user password: type: string description: Password of the user first_name: type: string description: First name of the user last_name: type: string description: Last name of the user email: type: string description: Email of the user PublicKey: type: object properties: public_key: type: string description: RSA public key of the user Credential: type: object required: - site_name - user - name - credentials properties: site_name: type: string description: Name of the site name: type: string description: Name of the credential user: type: integer description: ID of the user credentials: type: string description: Encrypted credentials (JSON format encrypted) CredentialPost: type: object required: - site_name - name - credentials properties: site_name: type: string description: Name of the site name: type: string description: Name of the credential credentials: type: string description: Encrypted credentials (JSON format encrypted) CredentialPatch: type: object properties: site_name: type: string description: Name of the site name: type: string description: Name of the credential credentials: type: string description: Encrypted credentials (JSON format encrypted) TemporaryAccountCredential: type: object properties: username: type: string description: Name of the temporary user password: type: string description: Password of the temporary user Error: type: object properties: detail: type: string TokenResp: type: object properties: token: type: string Credentials: type: object required: - username - password properties: username: description: Username of the user type: string password: description: Password of the user type: string