Skip to content

Environments


Description of the JSON object structure for environment protection rules

You can learn more about how environment protection rules work here.

Field Type Description
environmentTemplate String Template for the protected environment name
ownerType String Type of the environment protection rule owner
allowToDeploy String Minimum role allowed to create protected environments. Possible values: NO_ONE - nobody, DEVELOPER - developers and above, ADMINS - administrators and above
uuid String UUID of the environment protection rule

Methods for environment protection rules

Method to get the list of environment protection rules

Available in the Enterprise version and on gitflic.ru

Companies: GET /company/{companyAlias}/environment-protection

Teams: GET /team/{teamAlias}/environment-protection

The request returns a list of environment protection rules for the specified entity with the given alias. You can configure the number of objects displayed per page.

Path variable Type Description
companyAlias String Company alias
teamAlias String Team alias

Responses

STATUS 200 - Environment protection rules returned:

Example response
    
{
    "_embedded": {
        "restEnvironmentProtectionModelList": [
            {
                "environmentTemplate": "**",
                "ownerType": "COMPANY",
                "allowToDeploy": "ADMINS",
                "uuid": "e7b6c8c8-aaaa-aaaa-aaaa-7b945816347f"
            },
            {
                "environmentTemplate": "feature-*",
                "ownerType": "COMPANY",
                "allowToDeploy": "DEVELOPER",
                "uuid": "6835a7c0-aaaa-aaaa-aaaa-1ced8aa44344"
            }
        ]
    },
    "page": {
        "size": 10,
        "totalElements": 2,
        "totalPages": 1,
        "number": 0
    }
}
    
  

STATUS 403 - Access denied.

STATUS 404 - Data not found.


Method to get an environment protection rule by UUID

Available in the Enterprise version and on gitflic.ru

Companies: GET /company/{companyAlias}/environment-protection/{environmentProtectionUuid}

Teams: GET /team/{teamAlias}/environment-protection/{environmentProtectionUuid}

The request returns the environment protection rule for the specified entity with the given alias and UUID.

Path variable Type Description
companyAlias String Company alias
teamAlias String Team alias
environmentProtectionUuid String Environment protection rule UUID

Responses

STATUS 200 - Environment protection rule returned:

Example response
    
{
    "environmentTemplate": "**",
    "ownerType": "COMPANY",
    "allowToDeploy": "ADMINS",
    "uuid": "e7b6c8c8-aaaa-aaaa-aaaa-7b945816347f"
}
    
  

STATUS 403 - Access denied.

STATUS 404 - Data not found.


Method to create an environment protection rule

Available in the Enterprise version and on gitflic.ru

Companies: POST /company/{companyAlias}/environment-protection/create

Teams: POST /team/{teamAlias}/environment-protection/create

The request creates and returns an environment protection rule for the specified entity with the given alias.

Path variable Type Description
companyAlias String Company alias
teamAlias String Team alias

Request

Supported JSON format

POST request body structure:

Field Type Description
environmentTemplate String Template for the protected environment name
allowToDeploy String Who is allowed to create environments. Possible values: NO_ONE - nobody, DEVELOPER - developers and above, ADMINS - administrators and above

Example JSON object

{
    "environmentTemplate": "**",
    "allowToDeploy": "ADMINS"
}

Responses

STATUS 200 - Environment protection rule created:

Example response
    
{
    "environmentTemplate": "**",
    "ownerType": "COMPANY",
    "allowToDeploy": "ADMINS",
    "uuid": "e7b6c8c8-aaaa-aaaa-aaaa-7b945816347f"
}
    
  

STATUS 403 - Access denied.

STATUS 404 - Data not found.

STATUS 422 - Required field missing in request body.


Method to edit an environment protection rule

Available in the Enterprise version and on gitflic.ru

Companies: PATCH /company/{companyAlias}/environment-protection/edit

Teams: PATCH /team/{teamAlias}/environment-protection/edit

The request edits and returns the environment protection rule for the specified entity with the given alias.

Path variable Type Description
companyAlias String Company alias
teamAlias String Team alias

Request

Supported JSON format

PATCH request body structure:

Field Type Description
uuid String Environment protection rule UUID
allowToDeploy String Who is allowed to create environments. Possible values: NO_ONE - nobody, DEVELOPER - developers and above, ADMINS - administrators and above

Example JSON object

{
    "uuid": "e7b6c8c8-aaaa-aaaa-aaaa-7b945816347f",
    "allowToDeploy": "ADMINS"
}

Responses

STATUS 200 - Environment protection rule updated:

Example response
    
{
    "environmentTemplate": "**",
    "ownerType": "COMPANY",
    "allowToDeploy": "ADMINS",
    "uuid": "e7b6c8c8-aaaa-aaaa-aaaa-7b945816347f"
}
    
  

STATUS 403 - Access denied.

STATUS 404 - Data not found.

STATUS 422 - Required field missing in request body.


Method to delete an environment protection rule

Available in the Enterprise version and on gitflic.ru

Companies: DELETE /company/{companyAlias}/environment-protection/{environmentProtectionUuid}

Teams: DELETE /team/{teamAlias}/environment-protection/{environmentProtectionUuid}

The request deletes the environment protection rule for the specified entity with the given alias and UUID.

Path variable Type Description
companyAlias String Company alias
teamAlias String Team alias
environmentProtectionUuid String Environment protection rule UUID

Responses

STATUS 204 - Environment protection rule deleted.

STATUS 403 - Access denied.

STATUS 404 - Data not found.


Method to apply environment protection rules to projects

Available in the Enterprise version and on gitflic.ru

Companies: POST /company/{companyAlias}/environment-protection/apply-settings-to-projects

Teams: POST /team/{teamAlias}/environment-protection/apply-settings-to-projects

The request applies environment protection rules to all projects of the specified entity with the given alias.

Path variable Type Description
companyAlias String Company alias
teamAlias String Team alias

Responses

STATUS 204 - Environment protection rules applied to all child projects.

STATUS 403 - Access denied.

STATUS 404 - Data not found.


Automated translation!

This page was translated using automatic translation tools. The text may contain inaccuracies.