# Teams

This endpoint is used to create, update, search or delete teams information inside a Terrakube organization.

{% hint style="info" %}
You need to be part of the administrator Active Directory Group to work with this endpoint
{% endhint %}

{% hint style="warning" %}
The default group is handled using the Spring Boot property

```
org.azbuilder.owner=TERRAKUBE_ADMIN
```

{% endhint %}

### Entity fields:

| Path                            | Type    | Description                                                                        |
| ------------------------------- | ------- | ---------------------------------------------------------------------------------- |
| data.type                       | string  | Should be "team"                                                                   |
| data.attributes.name            | string  | Active Directory Group name                                                        |
| data.attributes.manageWorkspace | boolean | Enable Create/Update/Delete Workspaces for a Team                                  |
| data.attributes.manageModule    | boolean | Enable Create/Update/Delete Workspaces for a Team                                  |
| data.attributes.manageProvider  | boolean | Enable Create/Update/Delete Terraform Provider for a Team                          |
| data.attributes.manageVcs       | boolean | Enable Create/Update/Delete VCS connection for private GIT Repositories for a Team |
| data.attributes.manageTemplates | boolean | Enable Create/Update/Delete Templates for a Team                                   |

### Example:

```
{
  "data": {
    "type": "team",
    "attributes": {
      "name": "TERRAKUBE_TEAM",
      "manageWorkspace": true,
      "manageModule": true,
      "manageProvider": true,
      "manageVcs": true,
      "manageTemplate": true
    }
  }
}
```

### Supported Operations

## GET /organization/{organizationId}/team/{teamId}

> Returns an instance of type team

```json
{"openapi":"3.0.1","info":{"title":"Elide Service","version":"0.0.1"},"tags":[{"name":"team"}],"servers":[{"url":"/api/v1"}],"paths":{"/organization/{organizationId}/team/{teamId}":{"get":{"tags":["team"],"description":"Returns an instance of type team","parameters":[{"name":"fields[team]","in":"query","description":"Selects the set of team fields that should be returned in the result.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["manageCollection","manageJob","manageModule","manageProvider","manageState","manageTemplate","manageVcs","manageWorkspace","name","organization"]}}},{"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"]}}}],"responses":{"200":{"description":"Successful response","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/team"},"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":{"team":{"type":"object","properties":{"type":{"type":"string","description":"Create Permissions : (user is a superuser)\nDelete Permissions : (user is a superuser)"},"id":{"type":"string"},"attributes":{"type":"object","properties":{"manageCollection":{"type":"boolean","description":"Update Permissions : (user is a superuser)","readOnly":false,"writeOnly":false},"manageJob":{"type":"boolean","description":"Update Permissions : (user is a superuser)","readOnly":false,"writeOnly":false},"manageModule":{"type":"boolean","description":"Update Permissions : (user is a superuser)","readOnly":false,"writeOnly":false},"manageProvider":{"type":"boolean","description":"Update Permissions : (user is a superuser)","readOnly":false,"writeOnly":false},"manageState":{"type":"boolean","description":"Update Permissions : (user is a superuser)","readOnly":false,"writeOnly":false},"manageTemplate":{"type":"boolean","description":"Update Permissions : (user is a superuser)","readOnly":false,"writeOnly":false},"manageVcs":{"type":"boolean","description":"Update Permissions : (user is a superuser)","readOnly":false,"writeOnly":false},"manageWorkspace":{"type":"boolean","description":"Update Permissions : (user is a superuser)","readOnly":false,"writeOnly":false},"name":{"type":"string","description":"Update Permissions : (user is a superuser)","readOnly":false,"writeOnly":false}}},"relationships":{"type":"object","properties":{"organization":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["organization"]},"id":{"type":"string"}},"description":"Update Permissions : (user is a superuser)","readOnly":false,"writeOnly":false}}}}}}}}}}}
```

{% openapi src="<https://raw.githubusercontent.com/AzBuilder/azb-server/main/openapi-spec/v1_3.yml>" path="/organization/{organizationId}/team" method="post" %}
<https://raw.githubusercontent.com/AzBuilder/azb-server/main/openapi-spec/v1_3.yml>
{% endopenapi %}

{% openapi src="<https://raw.githubusercontent.com/AzBuilder/azb-server/main/openapi-spec/v1_3.yml>" path="/organization/{organizationId}/team/{teamId}" method="delete" %}
<https://raw.githubusercontent.com/AzBuilder/azb-server/main/openapi-spec/v1_3.yml>
{% endopenapi %}

{% openapi src="<https://raw.githubusercontent.com/AzBuilder/azb-server/main/openapi-spec/v1_3.yml>" path="/organization/{organizationId}/team/{teamId}" method="patch" %}
<https://raw.githubusercontent.com/AzBuilder/azb-server/main/openapi-spec/v1_3.yml>
{% 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 %}
