Skip to main content

trellis_sdk_auth/
client.rs

1//! Thin typed client helpers for `trellis.auth@v1`.
2
3use trellis_client::TrellisClientError;
4
5/// Typed API wrapper for the `trellis.auth@v1` contract.
6pub struct AuthClient<'a> {
7    inner: &'a trellis_client::TrellisClient,
8}
9
10impl<'a> AuthClient<'a> {
11    /// Wrap an already connected low-level Trellis client.
12    pub fn new(inner: &'a trellis_client::TrellisClient) -> Self {
13        Self { inner }
14    }
15
16    /// Call `Auth.ActivateWorkload`.
17    pub async fn auth_activate_workload(&self, input: &crate::types::AuthActivateWorkloadRequest) -> Result<crate::types::AuthActivateWorkloadResponse, TrellisClientError> {
18        self.inner.call::<crate::rpc::AuthActivateWorkloadRpc>(input).await
19    }
20
21    /// Call `Auth.ClearLoginPortalSelection`.
22    pub async fn auth_clear_login_portal_selection(&self, input: &crate::types::AuthClearLoginPortalSelectionRequest) -> Result<crate::types::AuthClearLoginPortalSelectionResponse, TrellisClientError> {
23        self.inner.call::<crate::rpc::AuthClearLoginPortalSelectionRpc>(input).await
24    }
25
26    /// Call `Auth.ClearWorkloadPortalSelection`.
27    pub async fn auth_clear_workload_portal_selection(&self, input: &crate::types::AuthClearWorkloadPortalSelectionRequest) -> Result<crate::types::AuthClearWorkloadPortalSelectionResponse, TrellisClientError> {
28        self.inner.call::<crate::rpc::AuthClearWorkloadPortalSelectionRpc>(input).await
29    }
30
31    /// Call `Auth.CreatePortal`.
32    pub async fn auth_create_portal(&self, input: &crate::types::AuthCreatePortalRequest) -> Result<crate::types::AuthCreatePortalResponse, TrellisClientError> {
33        self.inner.call::<crate::rpc::AuthCreatePortalRpc>(input).await
34    }
35
36    /// Call `Auth.CreateWorkloadProfile`.
37    pub async fn auth_create_workload_profile(&self, input: &crate::types::AuthCreateWorkloadProfileRequest) -> Result<crate::types::AuthCreateWorkloadProfileResponse, TrellisClientError> {
38        self.inner.call::<crate::rpc::AuthCreateWorkloadProfileRpc>(input).await
39    }
40
41    /// Call `Auth.DecideWorkloadActivationReview`.
42    pub async fn auth_decide_workload_activation_review(&self, input: &crate::types::AuthDecideWorkloadActivationReviewRequest) -> Result<crate::types::AuthDecideWorkloadActivationReviewResponse, TrellisClientError> {
43        self.inner.call::<crate::rpc::AuthDecideWorkloadActivationReviewRpc>(input).await
44    }
45
46    /// Call `Auth.DisablePortal`.
47    pub async fn auth_disable_portal(&self, input: &crate::types::AuthDisablePortalRequest) -> Result<crate::types::AuthDisablePortalResponse, TrellisClientError> {
48        self.inner.call::<crate::rpc::AuthDisablePortalRpc>(input).await
49    }
50
51    /// Call `Auth.DisableWorkloadInstance`.
52    pub async fn auth_disable_workload_instance(&self, input: &crate::types::AuthDisableWorkloadInstanceRequest) -> Result<crate::types::AuthDisableWorkloadInstanceResponse, TrellisClientError> {
53        self.inner.call::<crate::rpc::AuthDisableWorkloadInstanceRpc>(input).await
54    }
55
56    /// Call `Auth.DisableWorkloadProfile`.
57    pub async fn auth_disable_workload_profile(&self, input: &crate::types::AuthDisableWorkloadProfileRequest) -> Result<crate::types::AuthDisableWorkloadProfileResponse, TrellisClientError> {
58        self.inner.call::<crate::rpc::AuthDisableWorkloadProfileRpc>(input).await
59    }
60
61    /// Call `Auth.GetInstalledContract`.
62    pub async fn auth_get_installed_contract(&self, input: &crate::types::AuthGetInstalledContractRequest) -> Result<crate::types::AuthGetInstalledContractResponse, TrellisClientError> {
63        self.inner.call::<crate::rpc::AuthGetInstalledContractRpc>(input).await
64    }
65
66    /// Call `Auth.GetLoginPortalDefault`.
67    pub async fn auth_get_login_portal_default(&self) -> Result<crate::types::AuthGetLoginPortalDefaultResponse, TrellisClientError> {
68        self.inner.call::<crate::rpc::AuthGetLoginPortalDefaultRpc>(&crate::rpc::Empty {}).await
69    }
70
71    /// Call `Auth.GetWorkloadActivationStatus`.
72    pub async fn auth_get_workload_activation_status(&self, input: &crate::types::AuthGetWorkloadActivationStatusRequest) -> Result<crate::types::AuthGetWorkloadActivationStatusResponse, TrellisClientError> {
73        self.inner.call::<crate::rpc::AuthGetWorkloadActivationStatusRpc>(input).await
74    }
75
76    /// Call `Auth.GetWorkloadConnectInfo`.
77    pub async fn auth_get_workload_connect_info(&self, input: &crate::types::AuthGetWorkloadConnectInfoRequest) -> Result<crate::types::AuthGetWorkloadConnectInfoResponse, TrellisClientError> {
78        self.inner.call::<crate::rpc::AuthGetWorkloadConnectInfoRpc>(input).await
79    }
80
81    /// Call `Auth.GetWorkloadPortalDefault`.
82    pub async fn auth_get_workload_portal_default(&self) -> Result<crate::types::AuthGetWorkloadPortalDefaultResponse, TrellisClientError> {
83        self.inner.call::<crate::rpc::AuthGetWorkloadPortalDefaultRpc>(&crate::rpc::Empty {}).await
84    }
85
86    /// Call `Auth.Health`.
87    pub async fn auth_health(&self) -> Result<crate::types::AuthHealthResponse, TrellisClientError> {
88        self.inner.call::<crate::rpc::AuthHealthRpc>(&crate::rpc::Empty {}).await
89    }
90
91    /// Call `Auth.InstallService`.
92    pub async fn auth_install_service(&self, input: &crate::types::AuthInstallServiceRequest) -> Result<crate::types::AuthInstallServiceResponse, TrellisClientError> {
93        self.inner.call::<crate::rpc::AuthInstallServiceRpc>(input).await
94    }
95
96    /// Call `Auth.KickConnection`.
97    pub async fn auth_kick_connection(&self, input: &crate::types::AuthKickConnectionRequest) -> Result<crate::types::AuthKickConnectionResponse, TrellisClientError> {
98        self.inner.call::<crate::rpc::AuthKickConnectionRpc>(input).await
99    }
100
101    /// Call `Auth.ListApprovals`.
102    pub async fn auth_list_approvals(&self, input: &crate::types::AuthListApprovalsRequest) -> Result<crate::types::AuthListApprovalsResponse, TrellisClientError> {
103        self.inner.call::<crate::rpc::AuthListApprovalsRpc>(input).await
104    }
105
106    /// Call `Auth.ListConnections`.
107    pub async fn auth_list_connections(&self, input: &crate::types::AuthListConnectionsRequest) -> Result<crate::types::AuthListConnectionsResponse, TrellisClientError> {
108        self.inner.call::<crate::rpc::AuthListConnectionsRpc>(input).await
109    }
110
111    /// Call `Auth.ListInstalledContracts`.
112    pub async fn auth_list_installed_contracts(&self, input: &crate::types::AuthListInstalledContractsRequest) -> Result<crate::types::AuthListInstalledContractsResponse, TrellisClientError> {
113        self.inner.call::<crate::rpc::AuthListInstalledContractsRpc>(input).await
114    }
115
116    /// Call `Auth.ListLoginPortalSelections`.
117    pub async fn auth_list_login_portal_selections(&self) -> Result<crate::types::AuthListLoginPortalSelectionsResponse, TrellisClientError> {
118        self.inner.call::<crate::rpc::AuthListLoginPortalSelectionsRpc>(&crate::rpc::Empty {}).await
119    }
120
121    /// Call `Auth.ListPortals`.
122    pub async fn auth_list_portals(&self) -> Result<crate::types::AuthListPortalsResponse, TrellisClientError> {
123        self.inner.call::<crate::rpc::AuthListPortalsRpc>(&crate::rpc::Empty {}).await
124    }
125
126    /// Call `Auth.ListServices`.
127    pub async fn auth_list_services(&self) -> Result<crate::types::AuthListServicesResponse, TrellisClientError> {
128        self.inner.call::<crate::rpc::AuthListServicesRpc>(&crate::rpc::Empty {}).await
129    }
130
131    /// Call `Auth.ListSessions`.
132    pub async fn auth_list_sessions(&self, input: &crate::types::AuthListSessionsRequest) -> Result<crate::types::AuthListSessionsResponse, TrellisClientError> {
133        self.inner.call::<crate::rpc::AuthListSessionsRpc>(input).await
134    }
135
136    /// Call `Auth.ListUsers`.
137    pub async fn auth_list_users(&self) -> Result<crate::types::AuthListUsersResponse, TrellisClientError> {
138        self.inner.call::<crate::rpc::AuthListUsersRpc>(&crate::rpc::Empty {}).await
139    }
140
141    /// Call `Auth.ListWorkloadActivationReviews`.
142    pub async fn auth_list_workload_activation_reviews(&self, input: &crate::types::AuthListWorkloadActivationReviewsRequest) -> Result<crate::types::AuthListWorkloadActivationReviewsResponse, TrellisClientError> {
143        self.inner.call::<crate::rpc::AuthListWorkloadActivationReviewsRpc>(input).await
144    }
145
146    /// Call `Auth.ListWorkloadActivations`.
147    pub async fn auth_list_workload_activations(&self, input: &crate::types::AuthListWorkloadActivationsRequest) -> Result<crate::types::AuthListWorkloadActivationsResponse, TrellisClientError> {
148        self.inner.call::<crate::rpc::AuthListWorkloadActivationsRpc>(input).await
149    }
150
151    /// Call `Auth.ListWorkloadInstances`.
152    pub async fn auth_list_workload_instances(&self, input: &crate::types::AuthListWorkloadInstancesRequest) -> Result<crate::types::AuthListWorkloadInstancesResponse, TrellisClientError> {
153        self.inner.call::<crate::rpc::AuthListWorkloadInstancesRpc>(input).await
154    }
155
156    /// Call `Auth.ListWorkloadPortalSelections`.
157    pub async fn auth_list_workload_portal_selections(&self) -> Result<crate::types::AuthListWorkloadPortalSelectionsResponse, TrellisClientError> {
158        self.inner.call::<crate::rpc::AuthListWorkloadPortalSelectionsRpc>(&crate::rpc::Empty {}).await
159    }
160
161    /// Call `Auth.ListWorkloadProfiles`.
162    pub async fn auth_list_workload_profiles(&self, input: &crate::types::AuthListWorkloadProfilesRequest) -> Result<crate::types::AuthListWorkloadProfilesResponse, TrellisClientError> {
163        self.inner.call::<crate::rpc::AuthListWorkloadProfilesRpc>(input).await
164    }
165
166    /// Call `Auth.Logout`.
167    pub async fn auth_logout(&self) -> Result<crate::types::AuthLogoutResponse, TrellisClientError> {
168        self.inner.call::<crate::rpc::AuthLogoutRpc>(&crate::rpc::Empty {}).await
169    }
170
171    /// Call `Auth.Me`.
172    pub async fn auth_me(&self) -> Result<crate::types::AuthMeResponse, TrellisClientError> {
173        self.inner.call::<crate::rpc::AuthMeRpc>(&crate::rpc::Empty {}).await
174    }
175
176    /// Call `Auth.ProvisionWorkloadInstance`.
177    pub async fn auth_provision_workload_instance(&self, input: &crate::types::AuthProvisionWorkloadInstanceRequest) -> Result<crate::types::AuthProvisionWorkloadInstanceResponse, TrellisClientError> {
178        self.inner.call::<crate::rpc::AuthProvisionWorkloadInstanceRpc>(input).await
179    }
180
181    /// Call `Auth.RenewBindingToken`.
182    pub async fn auth_renew_binding_token(&self) -> Result<crate::types::AuthRenewBindingTokenResponse, TrellisClientError> {
183        self.inner.call::<crate::rpc::AuthRenewBindingTokenRpc>(&crate::rpc::Empty {}).await
184    }
185
186    /// Call `Auth.RevokeApproval`.
187    pub async fn auth_revoke_approval(&self, input: &crate::types::AuthRevokeApprovalRequest) -> Result<crate::types::AuthRevokeApprovalResponse, TrellisClientError> {
188        self.inner.call::<crate::rpc::AuthRevokeApprovalRpc>(input).await
189    }
190
191    /// Call `Auth.RevokeSession`.
192    pub async fn auth_revoke_session(&self, input: &crate::types::AuthRevokeSessionRequest) -> Result<crate::types::AuthRevokeSessionResponse, TrellisClientError> {
193        self.inner.call::<crate::rpc::AuthRevokeSessionRpc>(input).await
194    }
195
196    /// Call `Auth.RevokeWorkloadActivation`.
197    pub async fn auth_revoke_workload_activation(&self, input: &crate::types::AuthRevokeWorkloadActivationRequest) -> Result<crate::types::AuthRevokeWorkloadActivationResponse, TrellisClientError> {
198        self.inner.call::<crate::rpc::AuthRevokeWorkloadActivationRpc>(input).await
199    }
200
201    /// Call `Auth.SetLoginPortalDefault`.
202    pub async fn auth_set_login_portal_default(&self, input: &crate::types::AuthSetLoginPortalDefaultRequest) -> Result<crate::types::AuthSetLoginPortalDefaultResponse, TrellisClientError> {
203        self.inner.call::<crate::rpc::AuthSetLoginPortalDefaultRpc>(input).await
204    }
205
206    /// Call `Auth.SetLoginPortalSelection`.
207    pub async fn auth_set_login_portal_selection(&self, input: &crate::types::AuthSetLoginPortalSelectionRequest) -> Result<crate::types::AuthSetLoginPortalSelectionResponse, TrellisClientError> {
208        self.inner.call::<crate::rpc::AuthSetLoginPortalSelectionRpc>(input).await
209    }
210
211    /// Call `Auth.SetWorkloadPortalDefault`.
212    pub async fn auth_set_workload_portal_default(&self, input: &crate::types::AuthSetWorkloadPortalDefaultRequest) -> Result<crate::types::AuthSetWorkloadPortalDefaultResponse, TrellisClientError> {
213        self.inner.call::<crate::rpc::AuthSetWorkloadPortalDefaultRpc>(input).await
214    }
215
216    /// Call `Auth.SetWorkloadPortalSelection`.
217    pub async fn auth_set_workload_portal_selection(&self, input: &crate::types::AuthSetWorkloadPortalSelectionRequest) -> Result<crate::types::AuthSetWorkloadPortalSelectionResponse, TrellisClientError> {
218        self.inner.call::<crate::rpc::AuthSetWorkloadPortalSelectionRpc>(input).await
219    }
220
221    /// Call `Auth.UpdateUser`.
222    pub async fn auth_update_user(&self, input: &crate::types::AuthUpdateUserRequest) -> Result<crate::types::AuthUpdateUserResponse, TrellisClientError> {
223        self.inner.call::<crate::rpc::AuthUpdateUserRpc>(input).await
224    }
225
226    /// Call `Auth.UpgradeServiceContract`.
227    pub async fn auth_upgrade_service_contract(&self, input: &crate::types::AuthUpgradeServiceContractRequest) -> Result<crate::types::AuthUpgradeServiceContractResponse, TrellisClientError> {
228        self.inner.call::<crate::rpc::AuthUpgradeServiceContractRpc>(input).await
229    }
230
231    /// Call `Auth.ValidateRequest`.
232    pub async fn auth_validate_request(&self, input: &crate::types::AuthValidateRequestRequest) -> Result<crate::types::AuthValidateRequestResponse, TrellisClientError> {
233        self.inner.call::<crate::rpc::AuthValidateRequestRpc>(input).await
234    }
235
236    /// Publish `Auth.Connect`.
237    pub async fn publish_auth_connect(&self, event: &crate::types::AuthConnectEvent) -> Result<(), TrellisClientError> {
238        self.inner.publish::<crate::events::AuthConnectEventDescriptor>(event).await
239    }
240
241    /// Publish `Auth.ConnectionKicked`.
242    pub async fn publish_auth_connection_kicked(&self, event: &crate::types::AuthConnectionKickedEvent) -> Result<(), TrellisClientError> {
243        self.inner.publish::<crate::events::AuthConnectionKickedEventDescriptor>(event).await
244    }
245
246    /// Publish `Auth.Disconnect`.
247    pub async fn publish_auth_disconnect(&self, event: &crate::types::AuthDisconnectEvent) -> Result<(), TrellisClientError> {
248        self.inner.publish::<crate::events::AuthDisconnectEventDescriptor>(event).await
249    }
250
251    /// Publish `Auth.SessionRevoked`.
252    pub async fn publish_auth_session_revoked(&self, event: &crate::types::AuthSessionRevokedEvent) -> Result<(), TrellisClientError> {
253        self.inner.publish::<crate::events::AuthSessionRevokedEventDescriptor>(event).await
254    }
255
256    /// Publish `Auth.WorkloadActivationReviewRequested`.
257    pub async fn publish_auth_workload_activation_review_requested(&self, event: &crate::types::AuthWorkloadActivationReviewRequestedEvent) -> Result<(), TrellisClientError> {
258        self.inner.publish::<crate::events::AuthWorkloadActivationReviewRequestedEventDescriptor>(event).await
259    }
260
261}
262