<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # Environments API > 原文:[https://docs.gitlab.com/ee/api/environments.html](https://docs.gitlab.com/ee/api/environments.html) * [List environments](#list-environments) * [Get a specific environment](#get-a-specific-environment) * [Create a new environment](#create-a-new-environment) * [Edit an existing environment](#edit-an-existing-environment) * [Delete an environment](#delete-an-environment) * [Stop an environment](#stop-an-environment) # Environments API[](#environments-api "Permalink") ## List environments[](#list-environments "Permalink") 獲取給定項目的所有環境. ``` GET /projects/:id/environments ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 經過身份驗證的用戶擁有[的項目](README.html#namespaced-path-encoding)的 ID 或[URL 編碼路徑](README.html#namespaced-path-encoding) | | `name` | string | no | 使用此名稱返回環境. 與`search`互斥 | | `search` | string | no | 返回符合搜索條件的環境列表. 與`name`互斥 | | `states` | string | no | 列出與特定狀態匹配的所有環境. 接受的值: `available`或已`stopped` . 如果沒有給出狀態值,則返回所有環境. | ``` curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/environments?name=review%2Ffix-foo" ``` 響應示例: ``` [ { "id": 1, "name": "review/fix-foo", "slug": "review-fix-foo-dfjre3", "external_url": "https://review-fix-foo-dfjre3.example.gitlab.com", "state": "available" } ] ``` ## Get a specific environment[](#get-a-specific-environment "Permalink") ``` GET /projects/:id/environments/:environment_id ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 經過身份驗證的用戶擁有[的項目](README.html#namespaced-path-encoding)的 ID 或[URL 編碼路徑](README.html#namespaced-path-encoding) | | `environment_id` | integer | yes | 環境的 ID | ``` curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/environments/1" ``` 回應范例 ``` { "id": 1, "name": "review/fix-foo", "slug": "review-fix-foo-dfjre3", "external_url": "https://review-fix-foo-dfjre3.example.gitlab.com" "state": "available", "last_deployment": { "id": 100, "iid": 34, "ref": "fdroid", "sha": "416d8ea11849050d3d1f5104cf8cf51053e790ab", "created_at": "2019-03-25T18:55:13.252Z", "status": "success", "user": { "id": 1, "name": "Administrator", "state": "active", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://localhost:3000/root" } "deployable": { "id": 710, "status": "success", "stage": "deploy", "name": "staging", "ref": "fdroid", "tag": false, "coverage": null, "created_at": "2019-03-25T18:55:13.215Z", "started_at": "2019-03-25T12:54:50.082Z", "finished_at": "2019-03-25T18:55:13.216Z", "duration": 21623.13423, "user": { "id": 1, "name": "Administrator", "username": "root", "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://gitlab.dev/root", "created_at": "2015-12-21T13:14:24.077Z", "bio": null, "location": null, "public_email": "", "skype": "", "linkedin": "", "twitter": "", "website_url": "", "organization": null } "commit": { "id": "416d8ea11849050d3d1f5104cf8cf51053e790ab", "short_id": "416d8ea1", "created_at": "2016-01-02T15:39:18.000Z", "parent_ids": [ "e9a4449c95c64358840902508fc827f1a2eab7df" ], "title": "Removed fabric to fix #40", "message": "Removed fabric to fix #40\n", "author_name": "Administrator", "author_email": "admin@example.com", "authored_date": "2016-01-02T15:39:18.000Z", "committer_name": "Administrator", "committer_email": "admin@example.com", "committed_date": "2016-01-02T15:39:18.000Z" }, "pipeline": { "id": 34, "sha": "416d8ea11849050d3d1f5104cf8cf51053e790ab", "ref": "fdroid", "status": "success", "web_url": "http://localhost:3000/Commit451/lab-coat/pipelines/34" }, "web_url": "http://localhost:3000/Commit451/lab-coat/-/jobs/710", "artifacts": [ { "file_type": "trace", "size": 1305, "filename": "job.log", "file_format": null } ], "runner": null, "artifacts_expire_at": null } } } ``` ## Create a new environment[](#create-a-new-environment "Permalink") 使用給定名稱和`external_url`創建一個新環境. 如果成功創建了環境,則返回`201`否則返回`400` . ``` POST /projects/:id/environments ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 經過身份驗證的用戶擁有[的項目](README.html#namespaced-path-encoding)的 ID 或[URL 編碼路徑](README.html#namespaced-path-encoding) | | `name` | string | yes | 環境名稱 | | `external_url` | string | no | Place to link to for this environment | ``` curl --data "name=deploy&external_url=https://deploy.example.gitlab.com" --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/environments" ``` 響應示例: ``` { "id": 1, "name": "deploy", "slug": "deploy", "external_url": "https://deploy.example.gitlab.com", "state": "available" } ``` ## Edit an existing environment[](#edit-an-existing-environment "Permalink") 更新現有環境的名稱和/或`external_url` . 如果成功更新了環境,它將返回`200` . 如果出現錯誤,則返回狀態碼`400` . ``` PUT /projects/:id/environments/:environments_id ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 經過身份驗證的用戶擁有[的項目](README.html#namespaced-path-encoding)的 ID 或[URL 編碼路徑](README.html#namespaced-path-encoding) | | `environment_id` | integer | yes | 環境的 ID | | `name` | string | no | 環境的新名稱 | | `external_url` | string | no | 新的`external_url` | ``` curl --request PUT --data "name=staging&external_url=https://staging.example.gitlab.com" --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/environments/1" ``` 響應示例: ``` { "id": 1, "name": "staging", "slug": "staging", "external_url": "https://staging.example.gitlab.com", "state": "available" } ``` ## Delete an environment[](#delete-an-environment "Permalink") 如果成功刪除了環境,則返回`204`如果環境不存在,則返回`404` . ``` DELETE /projects/:id/environments/:environment_id ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 經過身份驗證的用戶擁有[的項目](README.html#namespaced-path-encoding)的 ID 或[URL 編碼路徑](README.html#namespaced-path-encoding) | | `environment_id` | integer | yes | 環境的 ID | ``` curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/environments/1" ``` ## Stop an environment[](#stop-an-environment "Permalink") 如果成功停止了環境,則返回`200`如果環境不存在,則返回`404` . ``` POST /projects/:id/environments/:environment_id/stop ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 經過身份驗證的用戶擁有[的項目](README.html#namespaced-path-encoding)的 ID 或[URL 編碼路徑](README.html#namespaced-path-encoding) | | `environment_id` | integer | yes | 環境的 ID | ``` curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/environments/1/stop" ``` 響應示例: ``` { "id": 1, "name": "deploy", "slug": "deploy", "external_url": "https://deploy.example.gitlab.com", "state": "stopped" } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看