|
| 1 | +package broker |
| 2 | + |
| 3 | +// Environment represents an environment and application may be deployed to |
| 4 | +type Environment struct { |
| 5 | + Name string `json:"name,omitempty"` |
| 6 | + Production bool `json:"production"` |
| 7 | + DisplayName string `json:"displayName,omitempty"` |
| 8 | + CreatedAt string `json:"createdAt,omitempty"` |
| 9 | + UpdatedAt string `json:"updatedAt,omitempty"` |
| 10 | + UUID string `json:"uuid,omitempty"` |
| 11 | + Embedded EnvironmentEmbeddedItems `json:"_embedded,omitempty"` |
| 12 | +} |
| 13 | + |
| 14 | +type EnvironmentCreateOrUpdateRequest struct { |
| 15 | + UUID string `json:"-"` |
| 16 | + DisplayName string `json:"displayName,omitempty"` |
| 17 | + Name string `json:"name,omitempty"` |
| 18 | + Production bool `json:"production"` |
| 19 | + Teams []string `json:"teamUuids"` |
| 20 | +} |
| 21 | + |
| 22 | +type EnvironmentCreateOrUpdateResponse struct { |
| 23 | + Name string `json:"name,omitempty"` |
| 24 | + Production bool `json:"production"` |
| 25 | + DisplayName string `json:"displayName,omitempty"` |
| 26 | + CreatedAt string `json:"createdAt,omitempty"` |
| 27 | + UpdatedAt string `json:"updatedAt,omitempty"` |
| 28 | + UUID string `json:"uuid,omitempty"` |
| 29 | + Teams []string `json:"teamUuids"` |
| 30 | + Embedded EnvironmentEmbeddedItems `json:"_embedded,omitempty"` |
| 31 | +} |
| 32 | + |
| 33 | +type EnvironmentEmbeddedItems struct { |
| 34 | + Teams []Team `json:"teams,omitempty"` |
| 35 | +} |
| 36 | + |
| 37 | +// POST environments |
| 38 | +// {"uuid":"2739c79b-a6ba-4398-be7a-85ec96f79fbe","name":"test1","displayName":"test1 with teams","production":false,"createdAt":"2022-03-07T12:22:05+00:00","teamUuids":["6d746ad5-919f-49e3-84c0-648cafc5d912"],"_embedded":{"teams":[{"uuid":"6d746ad5-919f-49e3-84c0-648cafc5d912","name":"Pactflow Demos","_links":{"self":{"title":"Team","href":"https://testdemo.pactflow.io/admin/teams/6d746ad5-919f-49e3-84c0-648cafc5d912"}}}]},"_links":{"self":{"title":"Environment","name":"test1","href":"https://testdemo.pactflow.io/environments/2739c79b-a6ba-4398-be7a-85ec96f79fbe"},"pb:currently-deployed-deployed-versions":{"title":"Versions currently deployed to test1 with teams environment","href":"https://testdemo.pactflow.io/environments/2739c79b-a6ba-4398-be7a-85ec96f79fbe/deployed-versions/currently-deployed"},"pb:currently-supported-released-versions":{"title":"Versions released and supported in test1 with teams environment","href":"https://testdemo.pactflow.io/environments/2739c79b-a6ba-4398-be7a-85ec96f79fbe/released-versions/currently-supported"},"pb:environments":{"title":"Environments","href":"https://testdemo.pactflow.io/environments"}}} |
| 39 | + |
| 40 | +// TODO: why does the GET not return `teamUuids` also? |
| 41 | + |
| 42 | +// GET environments/:env |
| 43 | + |
| 44 | +// { |
| 45 | +// "uuid": "e188cc63-7e49-4243-8fba-a8e5437d7d5c", |
| 46 | +// "name": "aoeuaoeua", |
| 47 | +// "displayName": "aoeuaoeu", |
| 48 | +// "production": true, |
| 49 | +// "updatedAt": "2022-03-02T09:29:02+00:00", |
| 50 | +// "createdAt": "2022-03-02T09:28:34+00:00", |
| 51 | +// "_embedded": { |
| 52 | +// "teams": [ |
| 53 | +// { |
| 54 | +// "uuid": "219af87b-7a6f-4efb-89dd-9cdd79a050d1", |
| 55 | +// "name": "O'reilly superstream", |
| 56 | +// "_links": { |
| 57 | +// "self": { |
| 58 | +// "title": "Team", |
| 59 | +// "href": "https://testdemo.pactflow.io/admin/teams/219af87b-7a6f-4efb-89dd-9cdd79a050d1" |
| 60 | +// } |
| 61 | +// } |
| 62 | +// } |
| 63 | +// ] |
| 64 | +// }, |
| 65 | +// "_links": { |
| 66 | +// "self": { |
| 67 | +// "title": "Environment", |
| 68 | +// "name": "aoeuaoeua", |
| 69 | +// "href": "https://testdemo.pactflow.io/environments/e188cc63-7e49-4243-8fba-a8e5437d7d5c" |
| 70 | +// }, |
| 71 | +// "pb:currently-deployed-deployed-versions": { |
| 72 | +// "title": "Versions currently deployed to aoeuaoeu environment", |
| 73 | +// "href": "https://testdemo.pactflow.io/environments/e188cc63-7e49-4243-8fba-a8e5437d7d5c/deployed-versions/currently-deployed" |
| 74 | +// }, |
| 75 | +// "pb:currently-supported-released-versions": { |
| 76 | +// "title": "Versions released and supported in aoeuaoeu environment", |
| 77 | +// "href": "https://testdemo.pactflow.io/environments/e188cc63-7e49-4243-8fba-a8e5437d7d5c/released-versions/currently-supported" |
| 78 | +// }, |
| 79 | +// "pb:environments": { |
| 80 | +// "title": "Environments", |
| 81 | +// "href": "https://testdemo.pactflow.io/environments" |
| 82 | +// } |
| 83 | +// } |
| 84 | +// } |
0 commit comments