go/resources/containers/methods/retrieve/index.md +0 −132 deleted
File Deleted View Diff
1## Retrieve container
2
3`client.Containers.Get(ctx, containerID) (*ContainerGetResponse, error)`
4
5**get** `/containers/{container_id}`
6
7Retrieve Container
8
9### Parameters
10
11- `containerID string`
12
13### Returns
14
15- `type ContainerGetResponse struct{…}`
16
17 - `ID string`
18
19 Unique identifier for the container.
20
21 - `CreatedAt int64`
22
23 Unix timestamp (in seconds) when the container was created.
24
25 - `Name string`
26
27 Name of the container.
28
29 - `Object string`
30
31 The type of this object.
32
33 - `Status string`
34
35 Status of the container (e.g., active, deleted).
36
37 - `ExpiresAfter ContainerGetResponseExpiresAfter`
38
39 The container will expire after this time period.
40 The anchor is the reference point for the expiration.
41 The minutes is the number of minutes after the anchor before the container expires.
42
43 - `Anchor string`
44
45 The reference point for the expiration.
46
47 - `const ContainerGetResponseExpiresAfterAnchorLastActiveAt ContainerGetResponseExpiresAfterAnchor = "last_active_at"`
48
49 - `Minutes int64`
50
51 The number of minutes after the anchor before the container expires.
52
53 - `LastActiveAt int64`
54
55 Unix timestamp (in seconds) when the container was last active.
56
57 - `MemoryLimit ContainerGetResponseMemoryLimit`
58
59 The memory limit configured for the container.
60
61 - `const ContainerGetResponseMemoryLimit1g ContainerGetResponseMemoryLimit = "1g"`
62
63 - `const ContainerGetResponseMemoryLimit4g ContainerGetResponseMemoryLimit = "4g"`
64
65 - `const ContainerGetResponseMemoryLimit16g ContainerGetResponseMemoryLimit = "16g"`
66
67 - `const ContainerGetResponseMemoryLimit64g ContainerGetResponseMemoryLimit = "64g"`
68
69 - `NetworkPolicy ContainerGetResponseNetworkPolicy`
70
71 Network access policy for the container.
72
73 - `Type string`
74
75 The network policy mode.
76
77 - `const ContainerGetResponseNetworkPolicyTypeAllowlist ContainerGetResponseNetworkPolicyType = "allowlist"`
78
79 - `const ContainerGetResponseNetworkPolicyTypeDisabled ContainerGetResponseNetworkPolicyType = "disabled"`
80
81 - `AllowedDomains []string`
82
83 Allowed outbound domains when `type` is `allowlist`.
84
85### Example
86
87```go
88package main
89
90import (
91 "context"
92 "fmt"
93
94 "github.com/openai/openai-go"
95 "github.com/openai/openai-go/option"
96)
97
98func main() {
99 client := openai.NewClient(
100 option.WithAPIKey("My API Key"),
101 )
102 container, err := client.Containers.Get(context.TODO(), "container_id")
103 if err != nil {
104 panic(err.Error())
105 }
106 fmt.Printf("%+v\n", container.ID)
107}
108```
109
110#### Response
111
112```json
113{
114 "id": "id",
115 "created_at": 0,
116 "name": "name",
117 "object": "object",
118 "status": "status",
119 "expires_after": {
120 "anchor": "last_active_at",
121 "minutes": 0
122 },
123 "last_active_at": 0,
124 "memory_limit": "1g",
125 "network_policy": {
126 "type": "allowlist",
127 "allowed_domains": [
128 "string"
129 ]
130 }
131}
132```