async_openai/types/project_service_account.rs
1use serde::{Deserialize, Serialize};
2
3use super::ProjectUserRole;
4
5/// Represents an individual service account in a project.
6#[derive(Debug, Serialize, Deserialize)]
7pub struct ProjectServiceAccount {
8 /// The object type, which is always `organization.project.service_account`.
9 pub object: String,
10 /// The identifier, which can be referenced in API endpoints.
11 pub id: String,
12 /// The name of the service account.
13 pub name: String,
14 /// `owner` or `member`.
15 pub role: ProjectUserRole,
16 /// The Unix timestamp (in seconds) of when the service account was created.
17 pub created_at: u32,
18}
19
20/// Represents the response object for listing project service accounts.
21#[derive(Debug, Serialize, Deserialize)]
22pub struct ProjectServiceAccountListResponse {
23 /// The object type, which is always `list`.
24 pub object: String,
25 /// The list of project service accounts.
26 pub data: Vec<ProjectServiceAccount>,
27 /// The ID of the first project service account in the list.
28 pub first_id: String,
29 /// The ID of the last project service account in the list.
30 pub last_id: String,
31 /// Indicates if there are more project service accounts available.
32 pub has_more: bool,
33}
34
35/// Represents the request object for creating a project service account.
36#[derive(Debug, Serialize, Deserialize)]
37pub struct ProjectServiceAccountCreateRequest {
38 /// The name of the service account being created.
39 pub name: String,
40}
41
42/// Represents the response object for creating a project service account.
43#[derive(Debug, Serialize, Deserialize)]
44pub struct ProjectServiceAccountCreateResponse {
45 /// The object type, which is always `organization.project.service_account`.
46 pub object: String,
47 /// The ID of the created service account.
48 pub id: String,
49 /// The name of the created service account.
50 pub name: String,
51 /// Service accounts can only have one role of type `member`.
52 pub role: String,
53 /// The Unix timestamp (in seconds) of when the service account was created.
54 pub created_at: u32,
55 /// The API key associated with the created service account.
56 pub api_key: ProjectServiceAccountApiKey,
57}
58
59/// Represents the API key associated with a project service account.
60#[derive(Debug, Serialize, Deserialize)]
61pub struct ProjectServiceAccountApiKey {
62 /// The object type, which is always `organization.project.service_account.api_key`.
63 pub object: String,
64 /// The value of the API key.
65 pub value: String,
66 /// The name of the API key.
67 pub name: String,
68 /// The Unix timestamp (in seconds) of when the API key was created.
69 pub created_at: u32,
70 /// The ID of the API key.
71 pub id: String,
72}
73
74/// Represents the response object for deleting a project service account.
75#[derive(Debug, Serialize, Deserialize)]
76pub struct ProjectServiceAccountDeleteResponse {
77 /// The object type, which is always `organization.project.service_account.deleted`.
78 pub object: String,
79 /// The ID of the deleted service account.
80 pub id: String,
81 /// Indicates if the service account was successfully deleted.
82 pub deleted: bool,
83}