# Vcs

This endpoint is used to create, update, search or delete vcs (version control system) information inside a Terrakube organization so you can connect to private git repositories to run modules and workspaces

{% hint style="warning" %}
To use this endpoint you should have "manageVcs" access at team level and a Terrakube Organization
{% endhint %}

### Entity fields:

| Path                         | Type   | Description                                                |
| ---------------------------- | ------ | ---------------------------------------------------------- |
| data.type                    | string | Should be "vcs"                                            |
| data.attributes.name         | string | Unique vcs name for an Terrakube organization              |
| data.attributes.description  | string | Free text for description                                  |
| data.attributes.vcsType      | string | Supported values: GITHUB, GITLAB, BITBUCKET, AZURE\_DEVOPS |
| data.attributes.clientID     | string | Client Application Id                                      |
| data.attributes.clientSecret | string | Client Application secret                                  |

### Example:

```
{
  "data": {
    "type": "vcs",
    "attributes": {
      "name": "GitHubConnection",
      "description": "Private repositories inside GitHub",
      "vcsType": "GITHUB",
      "clientId": "{{githubClientId}}",
      "clientSecret": "{{githubClientSecret}}"
    }
  }
}
```

### Supported Operations

## GET /organization/{organizationId}/vcs/{vcsId}

> Returns an instance of type vcs

```json
{"openapi":"3.0.1","info":{"title":"Elide Service","version":"0.0.1"},"tags":[{"name":"vcs"}],"servers":[{"url":"/api/v1"}],"paths":{"/organization/{organizationId}/vcs/{vcsId}":{"get":{"tags":["vcs"],"description":"Returns an instance of type vcs","parameters":[{"name":"fields[vcs]","in":"query","description":"Selects the set of vcs fields that should be returned in the result.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["accessToken","apiUrl","callback","clientId","clientSecret","connectionType","createdBy","createdDate","description","endpoint","name","privateKey","redirectUrl","status","updatedBy","updatedDate","vcsType","organization","workspace"]}}},{"name":"include","in":"query","description":"Selects the set of relationships that should be expanded as a compound document in the result.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["organization","workspace"]}}}],"responses":{"200":{"description":"Successful response","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/vcs"},"included":{"uniqueItems":true,"type":"array","description":"Included resources","items":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"attributes":{"type":"object"},"relationships":{"type":"object"}}}}}}}}}}}}},"components":{"schemas":{"vcs":{"type":"object","properties":{"type":{"type":"string","description":"Create Permissions : (team manage vcs)\nDelete Permissions : (team manage vcs)"},"id":{"type":"string"},"attributes":{"type":"object","properties":{"accessToken":{"type":"string","description":"Read Permissions : (read access token)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false},"apiUrl":{"type":"string","description":"Read Permissions : (team view vcs)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false},"callback":{"type":"string","description":"Read Permissions : (team view vcs)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false},"clientId":{"type":"string","description":"Read Permissions : (team view vcs)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false},"clientSecret":{"type":"string","description":"Read Permissions : (read vcs secret)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false},"connectionType":{"type":"string","description":"Read Permissions : (team view vcs)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false,"enum":["OAUTH","STANDALONE"]},"createdBy":{"type":"string","description":"Read Permissions : (team view vcs)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false},"createdDate":{"type":"string","description":"Read Permissions : (team view vcs)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false},"description":{"type":"string","description":"Read Permissions : (team view vcs)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false},"endpoint":{"type":"string","description":"Read Permissions : (team view vcs)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false},"name":{"type":"string","description":"Read Permissions : (team view vcs)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false},"privateKey":{"type":"string","description":"Read Permissions : (read vcs secret)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false},"redirectUrl":{"type":"string","description":"Read Permissions : (team view vcs)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false},"status":{"type":"string","description":"Read Permissions : (team view vcs)\nUpdate Permissions : (user is a super service)","readOnly":false,"writeOnly":false,"enum":["PENDING","COMPLETED","ERROR"]},"updatedBy":{"type":"string","description":"Read Permissions : (team view vcs)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false},"updatedDate":{"type":"string","description":"Read Permissions : (team view vcs)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false},"vcsType":{"type":"string","description":"Read Permissions : (team view vcs)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false,"enum":["GITHUB","GITLAB","BITBUCKET","AZURE_DEVOPS","AZURE_SP_MI","PUBLIC"]}}},"relationships":{"type":"object","properties":{"organization":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["organization"]},"id":{"type":"string"}},"description":"Read Permissions : (team view vcs)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false}}}},"workspace":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["workspace"]},"id":{"type":"string"}},"description":"Read Permissions : (team view vcs)\nUpdate Permissions : (team manage vcs)","readOnly":false,"writeOnly":false}}}}}}}}}}}
```

{% openapi src="<https://4014930676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfAN3V983Y82_trlbcu%2Fuploads%2Fgit-blob-2824914a25a0c9dcaeb76f04beced4d42e3917dc%2Fv1_4.yml?alt=media&token=d400fdb2-a7d2-4d5a-b731-28b1f7540c09>" path="/organization/{organizationId}/vcs" method="post" %}
[v1\_4.yml](https://4014930676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfAN3V983Y82_trlbcu%2Fuploads%2Fgit-blob-2824914a25a0c9dcaeb76f04beced4d42e3917dc%2Fv1_4.yml?alt=media\&token=d400fdb2-a7d2-4d5a-b731-28b1f7540c09)
{% endopenapi %}

{% openapi src="<https://4014930676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfAN3V983Y82_trlbcu%2Fuploads%2Fgit-blob-2824914a25a0c9dcaeb76f04beced4d42e3917dc%2Fv1_4.yml?alt=media&token=d400fdb2-a7d2-4d5a-b731-28b1f7540c09>" path="/organization/{organizationId}/vcs/{vcsId}" method="delete" %}
[v1\_4.yml](https://4014930676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfAN3V983Y82_trlbcu%2Fuploads%2Fgit-blob-2824914a25a0c9dcaeb76f04beced4d42e3917dc%2Fv1_4.yml?alt=media\&token=d400fdb2-a7d2-4d5a-b731-28b1f7540c09)
{% endopenapi %}

{% openapi src="<https://4014930676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfAN3V983Y82_trlbcu%2Fuploads%2Fgit-blob-2824914a25a0c9dcaeb76f04beced4d42e3917dc%2Fv1_4.yml?alt=media&token=d400fdb2-a7d2-4d5a-b731-28b1f7540c09>" path="/organization/{organizationId}/vcs/{vcsId}" method="patch" %}
[v1\_4.yml](https://4014930676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfAN3V983Y82_trlbcu%2Fuploads%2Fgit-blob-2824914a25a0c9dcaeb76f04beced4d42e3917dc%2Fv1_4.yml?alt=media\&token=d400fdb2-a7d2-4d5a-b731-28b1f7540c09)
{% endopenapi %}

{% hint style="info" %}
For a complete list of organization operation please visit the [OpenAPI specification](https://github.com/AzBuilder/terrakube-server/tree/main/openapi-spec)
{% endhint %}
