api_models.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impliec.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
  11. */
  12. package api
  13. type MachineIdentityUniversalAuthRefreshRequest struct {
  14. AccessToken string `json:"accessToken"`
  15. }
  16. type MachineIdentityDetailsResponse struct {
  17. AccessToken string `json:"accessToken"`
  18. ExpiresIn int `json:"expiresIn"`
  19. AccessTokenMaxTTL int `json:"accessTokenMaxTTL"`
  20. TokenType string `json:"tokenType"`
  21. }
  22. type MachineIdentityUniversalAuthLoginRequest struct {
  23. ClientID string `json:"clientId"`
  24. ClientSecret string `json:"clientSecret"`
  25. }
  26. type RevokeMachineIdentityAccessTokenRequest struct {
  27. AccessToken string `json:"accessToken"`
  28. }
  29. type RevokeMachineIdentityAccessTokenResponse struct {
  30. Message string `json:"message"`
  31. }
  32. type GetSecretByKeyV3Request struct {
  33. EnvironmentSlug string `json:"environment"`
  34. ProjectSlug string `json:"workspaceSlug"`
  35. SecretPath string `json:"secretPath"`
  36. SecretKey string `json:"secretKey"`
  37. }
  38. type GetSecretByKeyV3Response struct {
  39. Secret SecretsV3 `json:"secret"`
  40. }
  41. type GetSecretsV3Request struct {
  42. EnvironmentSlug string `json:"environment"`
  43. ProjectSlug string `json:"workspaceSlug"`
  44. Recursive bool `json:"recursive"`
  45. SecretPath string `json:"secretPath"`
  46. }
  47. type GetSecretsV3Response struct {
  48. Secrets []SecretsV3 `json:"secrets"`
  49. ImportedSecrets []ImportedSecretV3 `json:"imports,omitempty"`
  50. Modified bool `json:"modified,omitempty"`
  51. ETag string `json:"ETag,omitempty"`
  52. }
  53. type SecretsV3 struct {
  54. ID string `json:"id"`
  55. Workspace string `json:"workspace"`
  56. Environment string `json:"environment"`
  57. Version int `json:"version"`
  58. Type string `json:"string"`
  59. SecretKey string `json:"secretKey"`
  60. SecretValue string `json:"secretValue"`
  61. SecretComment string `json:"secretComment"`
  62. }
  63. type ImportedSecretV3 struct {
  64. Environment string `json:"environment"`
  65. FolderID string `json:"folderId"`
  66. SecretPath string `json:"secretPath"`
  67. Secrets []SecretsV3 `json:"secrets"`
  68. }
  69. type InfisicalAPIErrorResponse struct {
  70. StatusCode int `json:"statusCode"`
  71. Message string `json:"message"`
  72. Error string `json:"error"`
  73. // According to Infisical's API docs, `details` are only returned for 403 errors.
  74. Details any `json:"details,omitempty"`
  75. }