Skip to content

Commit f28c909

Browse files
Adds CreatedAt to AgentPool (#1159)
* Adds CreatedAt to AgentPool * Updated changelog --------- Co-authored-by: jpadrianoGo <[email protected]>
1 parent 8a454f7 commit f28c909

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
## Enhancements
44

5-
* Adds `CreatedBy` relation to `AgentToken` by @jpadrianoGo [#1149](https://github.com/hashicorp/go-tfe/pull/1149)
65
* Adds `Logs` method to `QueryRuns`, which is EXPERIMENTAL, SUBJECT TO CHANGE, and may not be available to all users by @brandonc [#1186](https://github.com/hashicorp/go-tfe/pull/1186)
6+
* Adds `CreatedAt` field to `AgentPool` by @jpadrianoGo [#1150](https://github.com/hashicorp/go-tfe/pull/1150)
7+
* Adds `CreatedBy` relation to `AgentToken` by @jpadrianoGo [#1149](https://github.com/hashicorp/go-tfe/pull/1149)
78

89
# v1.90.0
910

agent_pool.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"context"
88
"fmt"
99
"net/url"
10+
"time"
1011
)
1112

1213
// Compile-time proof of interface implementation.
@@ -52,10 +53,11 @@ type AgentPoolList struct {
5253

5354
// AgentPool represents a HCP Terraform agent pool.
5455
type AgentPool struct {
55-
ID string `jsonapi:"primary,agent-pools"`
56-
Name string `jsonapi:"attr,name"`
57-
AgentCount int `jsonapi:"attr,agent-count"`
58-
OrganizationScoped bool `jsonapi:"attr,organization-scoped"`
56+
ID string `jsonapi:"primary,agent-pools"`
57+
Name string `jsonapi:"attr,name"`
58+
AgentCount int `jsonapi:"attr,agent-count"`
59+
OrganizationScoped bool `jsonapi:"attr,organization-scoped"`
60+
CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"`
5961

6062
// Relations
6163
Organization *Organization `jsonapi:"relation,organization"`

agent_pool_integration_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,23 @@ func TestAgentPoolsRead(t *testing.T) {
248248
})
249249
}
250250

251+
func TestAgentPoolsReadCreatedAt(t *testing.T) {
252+
client := testClient(t)
253+
ctx := context.Background()
254+
255+
orgTest, orgTestCleanup := createOrganization(t, client)
256+
defer orgTestCleanup()
257+
258+
upgradeOrganizationSubscription(t, client, orgTest)
259+
260+
pool, poolCleanup := createAgentPool(t, client, orgTest)
261+
defer poolCleanup()
262+
263+
k, err := client.AgentPools.Read(ctx, pool.ID)
264+
assert.NotEmpty(t, k.CreatedAt)
265+
require.NoError(t, err)
266+
}
267+
251268
func TestAgentPoolsUpdate(t *testing.T) {
252269
client := testClient(t)
253270
ctx := context.Background()

0 commit comments

Comments
 (0)