diff --git a/api/beta.yaml b/api/beta.yaml index c9260ff98..a6b289134 100644 --- a/api/beta.yaml +++ b/api/beta.yaml @@ -30,6 +30,12 @@ paths: schema: $ref: '#/components/schemas/CreateProjectBody' responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectResponse' '201': description: '' content: @@ -80,6 +86,156 @@ paths: description: Unexpected error creating an organization tags: *ref_2 security: *ref_3 + /v1/oauth/authorize: + get: + operationId: authorize + parameters: + - name: client_id + required: true + in: query + schema: + type: string + - name: response_type + required: true + in: query + schema: + enum: + - code + - token + - id_token token + type: string + - name: redirect_uri + required: true + in: query + schema: + type: string + - name: scope + required: true + in: query + schema: + type: string + - name: state + required: false + in: query + schema: + type: string + - name: response_mode + required: false + in: query + schema: + type: string + - name: code_challenge + required: false + in: query + schema: + type: string + - name: code_challenge_method + required: false + in: query + schema: + enum: + - plain + - sha256 + type: string + responses: + '200': + description: '' + tags: &ref_4 + - oauth (beta) + /v1/oauth/token: + post: + operationId: token + parameters: + - name: grant_type + required: true + in: query + schema: + enum: + - authorization_code + - refresh_token + type: string + - name: client_id + required: true + in: query + schema: + type: string + - name: client_secret + required: true + in: query + schema: + type: string + - name: code + required: false + in: query + schema: + type: string + - name: code_verifier + required: false + in: query + schema: + type: string + - name: redirect_uri + required: true + in: query + schema: + type: string + - name: refresh_token + required: false + in: query + schema: + type: string + responses: + '201': + description: '' + tags: *ref_4 + /v1/oauth/authorizations/{id}: + get: + operationId: getAuthorizationRequest + parameters: + - name: id + required: true + in: path + schema: + type: string + responses: + '200': + description: '' + tags: &ref_5 + - oauth (beta) + security: &ref_6 + - bearer: [] + post: + operationId: approveAuthorizationRequest + parameters: + - name: id + required: true + in: path + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AuthorizationsApproveBody' + responses: + '201': + description: '' + tags: *ref_5 + security: *ref_6 + delete: + operationId: declineAuthorizationRequest + parameters: + - name: id + required: true + in: path + schema: + type: string + responses: + '200': + description: '' + tags: *ref_5 + security: *ref_6 /v1/projects/{ref}/functions: post: operationId: createFunction @@ -118,10 +274,10 @@ paths: requestBody: required: true content: - application/json: &ref_4 + application/json: &ref_7 schema: $ref: '#/components/schemas/CreateFunctionBody' - application/vnd.denoland.eszip: *ref_4 + application/vnd.denoland.eszip: *ref_7 responses: '201': description: '' @@ -133,9 +289,9 @@ paths: description: '' '500': description: Failed to create project's function - tags: &ref_5 + tags: &ref_8 - functions - security: &ref_6 + security: &ref_9 - apiKeyHeader: [] apiKeyParam: [] - bearer: [] @@ -165,8 +321,8 @@ paths: description: '' '500': description: Failed to retrieve project's functions - tags: *ref_5 - security: *ref_6 + tags: *ref_8 + security: *ref_9 /v1/projects/{ref}/functions/{function_slug}: get: operationId: getFunction @@ -199,9 +355,9 @@ paths: description: '' '500': description: Failed to retrieve function with given slug - tags: &ref_8 + tags: &ref_11 - functions - security: &ref_9 + security: &ref_12 - apiKeyHeader: [] apiKeyParam: [] - bearer: [] @@ -249,10 +405,10 @@ paths: requestBody: required: true content: - application/json: &ref_7 + application/json: &ref_10 schema: $ref: '#/components/schemas/UpdateFunctionBody' - application/vnd.denoland.eszip: *ref_7 + application/vnd.denoland.eszip: *ref_10 responses: '200': description: '' @@ -264,8 +420,8 @@ paths: description: '' '500': description: Failed to update function with given slug - tags: *ref_8 - security: *ref_9 + tags: *ref_11 + security: *ref_12 delete: operationId: deleteFunction summary: Delete a function @@ -293,8 +449,8 @@ paths: description: '' '500': description: Failed to delete function with given slug - tags: *ref_8 - security: *ref_9 + tags: *ref_11 + security: *ref_12 /v1/projects/{ref}/functions/{function_slug}/body: get: operationId: getFunctionBody @@ -323,8 +479,35 @@ paths: description: '' '500': description: Failed to retrieve function body with given slug - tags: *ref_8 - security: *ref_9 + tags: *ref_11 + security: *ref_12 + /v1/projects/{ref}/api-keys: + get: + operationId: getProjectApiKeys + parameters: + - name: ref + required: true + in: path + description: Project ref + schema: + minLength: 20 + maxLength: 20 + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/ApiKeyResponse' + '403': + description: '' + tags: + - projects + security: + - bearer: [] /v1/projects/{ref}/custom-hostname: get: operationId: getCustomHostnameConfig @@ -349,9 +532,9 @@ paths: description: '' '500': description: Failed to retrieve project's custom hostname config - tags: &ref_10 + tags: &ref_13 - custom hostname (beta) - security: &ref_11 + security: &ref_14 - bearer: [] delete: operationId: removeCustomHostnameConfig @@ -372,8 +555,8 @@ paths: description: '' '500': description: Failed to delete project custom hostname configuration - tags: *ref_10 - security: *ref_11 + tags: *ref_13 + security: *ref_14 /v1/projects/{ref}/custom-hostname/initialize: post: operationId: createCustomHostnameConfig @@ -404,8 +587,8 @@ paths: description: '' '500': description: Failed to update project custom hostname configuration - tags: *ref_10 - security: *ref_11 + tags: *ref_13 + security: *ref_14 /v1/projects/{ref}/custom-hostname/reverify: post: operationId: reverify @@ -432,8 +615,8 @@ paths: description: '' '500': description: Failed to verify project custom hostname configuration - tags: *ref_10 - security: *ref_11 + tags: *ref_13 + security: *ref_14 /v1/projects/{ref}/custom-hostname/activate: post: operationId: activate @@ -458,8 +641,8 @@ paths: description: '' '500': description: Failed to activate project custom hostname configuration - tags: *ref_10 - security: *ref_11 + tags: *ref_13 + security: *ref_14 /v1/projects/{ref}/network-bans/retrieve: post: operationId: getNetworkBans @@ -484,9 +667,9 @@ paths: description: '' '500': description: Failed to retrieve project's network bans - tags: &ref_12 + tags: &ref_15 - network bans (beta) - security: &ref_13 + security: &ref_16 - bearer: [] /v1/projects/{ref}/network-bans: delete: @@ -514,8 +697,8 @@ paths: description: '' '500': description: Failed to remove network bans. - tags: *ref_12 - security: *ref_13 + tags: *ref_15 + security: *ref_16 /v1/projects/{ref}/network-restrictions: get: operationId: getNetworkRestrictions @@ -540,9 +723,9 @@ paths: description: '' '500': description: Failed to retrieve project's network restrictions - tags: &ref_14 + tags: &ref_17 - network restrictions (beta) - security: &ref_15 + security: &ref_18 - bearer: [] /v1/projects/{ref}/network-restrictions/apply: post: @@ -574,11 +757,11 @@ paths: description: '' '500': description: Failed to update project network restrictions - tags: *ref_14 - security: *ref_15 + tags: *ref_17 + security: *ref_18 /v1/projects/{ref}/pgsodium: get: - operationId: getConfig + operationId: getPgsodiumConfig summary: Gets project's pgsodium config parameters: - name: ref @@ -600,12 +783,12 @@ paths: description: '' '500': description: Failed to retrieve project's pgsodium config - tags: &ref_16 + tags: &ref_19 - pgsodium (beta) - security: &ref_17 + security: &ref_20 - bearer: [] put: - operationId: updateConfig + operationId: updatePgsodiumConfig summary: >- Updates project's pgsodium config. Updating the root_key can cause all data encrypted with the older key to become inaccessible. @@ -635,8 +818,8 @@ paths: description: '' '500': description: Failed to update project's pgsodium config - tags: *ref_16 - security: *ref_17 + tags: *ref_19 + security: *ref_20 /v1/projects/{ref}/postgrest: get: operationId: getPostgRESTConfig @@ -656,14 +839,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PostgrestConfigResponse' + $ref: '#/components/schemas/PostgrestConfigWithJWTSecretResponse' '403': description: '' '500': description: Failed to retrieve project's postgrest config - tags: &ref_18 + tags: &ref_21 - services - security: &ref_19 + security: &ref_22 - bearer: [] patch: operationId: updatePostgRESTConfig @@ -694,8 +877,8 @@ paths: description: '' '500': description: Failed to update project's postgrest config - tags: *ref_18 - security: *ref_19 + tags: *ref_21 + security: *ref_22 /v1/projects/{ref}/secrets: get: operationId: getSecrets @@ -723,9 +906,9 @@ paths: description: '' '500': description: Failed to retrieve project's secrets - tags: &ref_20 + tags: &ref_23 - secrets - security: &ref_21 + security: &ref_24 - apiKeyHeader: [] apiKeyParam: [] - bearer: [] @@ -757,8 +940,8 @@ paths: description: '' '500': description: Failed to create project's secrets - tags: *ref_20 - security: *ref_21 + tags: *ref_23 + security: *ref_24 delete: operationId: deleteSecrets summary: Bulk delete secrets @@ -791,8 +974,8 @@ paths: description: '' '500': description: Failed to delete secrets with given names - tags: *ref_20 - security: *ref_21 + tags: *ref_23 + security: *ref_24 /v1/projects/{ref}/ssl-enforcement: get: operationId: getSslEnforcementConfig @@ -817,9 +1000,9 @@ paths: description: '' '500': description: Failed to retrieve project's SSL enforcement config - tags: &ref_22 + tags: &ref_25 - ssl enforcement (beta) - security: &ref_23 + security: &ref_26 - bearer: [] put: operationId: updateSslEnforcementConfig @@ -850,8 +1033,8 @@ paths: description: '' '500': description: Failed to update project's SSL enforcement configuration. - tags: *ref_22 - security: *ref_23 + tags: *ref_25 + security: *ref_26 /v1/projects/{ref}/types/typescript: get: operationId: getTypescriptTypes @@ -913,9 +1096,9 @@ paths: description: '' '500': description: Failed to get project vanity subdomain configuration - tags: &ref_24 + tags: &ref_27 - vanity subdomain (beta) - security: &ref_25 + security: &ref_28 - bearer: [] delete: operationId: removeVanitySubdomainConfig @@ -936,8 +1119,8 @@ paths: description: '' '500': description: Failed to delete project vanity subdomain configuration - tags: *ref_24 - security: *ref_25 + tags: *ref_27 + security: *ref_28 /v1/projects/{ref}/vanity-subdomain/check-availability: post: operationId: checkVanitySubdomainAvailability @@ -968,8 +1151,8 @@ paths: description: '' '500': description: Failed to check project vanity subdomain configuration - tags: *ref_24 - security: *ref_25 + tags: *ref_27 + security: *ref_28 /v1/projects/{ref}/vanity-subdomain/activate: post: operationId: activateVanitySubdomainPlease @@ -1000,8 +1183,8 @@ paths: description: '' '500': description: Failed to activate project vanity subdomain configuration - tags: *ref_24 - security: *ref_25 + tags: *ref_27 + security: *ref_28 /v1/projects/{ref}/upgrade: post: operationId: upgradeProject @@ -1028,9 +1211,9 @@ paths: description: '' '500': description: Failed to initiate project upgrade - tags: &ref_26 + tags: &ref_29 - database version upgrade (beta) - security: &ref_27 + security: &ref_30 - bearer: [] /v1/projects/{ref}/upgrade/eligibility: get: @@ -1056,8 +1239,8 @@ paths: description: '' '500': description: Failed to determine project upgrade eligibility - tags: *ref_26 - security: *ref_27 + tags: *ref_29 + security: *ref_30 /v1/projects/{ref}/upgrade/status: get: operationId: getUpgradeStatus @@ -1082,8 +1265,8 @@ paths: description: '' '500': description: Failed to retrieve project upgrade status - tags: *ref_26 - security: *ref_27 + tags: *ref_29 + security: *ref_30 /v1/projects/{ref}/readonly: get: operationId: getReadOnlyModeStatus @@ -1106,9 +1289,9 @@ paths: $ref: '#/components/schemas/ReadOnlyStatusResponse' '500': description: Failed to get project readonly mode status - tags: &ref_28 + tags: &ref_31 - database readonly mode - security: &ref_29 + security: &ref_32 - bearer: [] /v1/projects/{ref}/readonly/temporary-disable: post: @@ -1128,8 +1311,122 @@ paths: description: '' '500': description: Failed to disable project's readonly mode - tags: *ref_28 - security: *ref_29 + tags: *ref_31 + security: *ref_32 + /v1/projects/{ref}/config/database/postgres: + get: + operationId: getConfig + summary: Gets project's Postgres config + parameters: + - name: ref + required: true + in: path + description: Project ref + schema: + minLength: 20 + maxLength: 20 + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/PostgresConfigResponse' + '500': + description: Failed to retrieve project's Postgres config + tags: &ref_33 + - projects config + security: &ref_34 + - bearer: [] + - bearer: [] + put: + operationId: updateConfig + summary: Updates project's Postgres config + parameters: + - name: ref + required: true + in: path + description: Project ref + schema: + minLength: 20 + maxLength: 20 + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdatePostgresConfigBody' + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/PostgresConfigResponse' + '500': + description: Failed to update project's Postgres config + tags: *ref_33 + security: *ref_34 + /v1/projects/{ref}/config/database/pgbouncer: + get: + operationId: getPgbouncerConfig + summary: Gets project's pgbouncer config + parameters: + - name: ref + required: true + in: path + description: Project ref + schema: + minLength: 20 + maxLength: 20 + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectPgBouncerConfig' + '500': + description: Failed to retrieve project's pgbouncer config + tags: &ref_35 + - projects config + security: &ref_36 + - bearer: [] + - bearer: [] + patch: + operationId: updatePgbouncerConfig + summary: Updates project's pgbouncer config + parameters: + - name: ref + required: true + in: path + description: Project ref + schema: + minLength: 20 + maxLength: 20 + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdatePgbouncerConfigBody' + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/UpdatePoolingConfigResponse' + '403': + description: '' + '500': + description: Failed to update project's pgbouncer config + tags: *ref_35 + security: *ref_36 /v1/projects/{ref}/config/auth/sso/providers: post: operationId: createProviderForProject @@ -1160,9 +1457,9 @@ paths: description: '' '404': description: SAML 2.0 support is not enabled for this project - tags: &ref_30 + tags: &ref_37 - sso - security: &ref_31 + security: &ref_38 - bearer: [] get: operationId: listAllProviders @@ -1187,8 +1484,8 @@ paths: description: '' '404': description: SAML 2.0 support is not enabled for this project - tags: *ref_30 - security: *ref_31 + tags: *ref_37 + security: *ref_38 /v1/projects/{ref}/config/auth/sso/providers/{provider_id}: get: operationId: getProviderById @@ -1220,8 +1517,8 @@ paths: description: >- Either SAML 2.0 was not enabled for this project, or the provider does not exist - tags: *ref_30 - security: *ref_31 + tags: *ref_37 + security: *ref_38 put: operationId: updateProviderById summary: Updates a SSO provider by its UUID @@ -1258,8 +1555,8 @@ paths: description: >- Either SAML 2.0 was not enabled for this project, or the provider does not exist - tags: *ref_30 - security: *ref_31 + tags: *ref_37 + security: *ref_38 delete: operationId: removeProviderById summary: Removes a SSO provider by its UUID @@ -1290,8 +1587,8 @@ paths: description: >- Either SAML 2.0 was not enabled for this project, or the provider does not exist - tags: *ref_30 - security: *ref_31 + tags: *ref_37 + security: *ref_38 info: title: Supabase API (v1) description: '' @@ -1315,8 +1612,10 @@ components: properties: host: type: string + description: Database host version: type: string + description: Database version required: - host - version @@ -1325,14 +1624,21 @@ components: properties: id: type: string + description: Id of your project organization_id: type: string + description: Slug of your organization name: type: string + description: Name of your project region: type: string + description: Region of your project + example: us-east-1 created_at: type: string + description: Creation timestamp + example: '2023-03-29T16:32:59Z' database: $ref: '#/components/schemas/DatabaseResponse' required: @@ -1346,15 +1652,20 @@ components: properties: db_pass: type: string + description: Database password name: type: string + description: Name of your project, should not contain dots organization_id: type: string + description: Slug of your organization plan: type: string enum: - free - pro + description: Subscription plan + example: free region: type: string enum: @@ -1372,38 +1683,8 @@ components: - ca-central-1 - ap-south-1 - sa-east-1 - - ams - - arn - - bog - - bos - - cdg - - den - - dfw - - ewr - - fra - - gdl - - gig - - gru - - hkg - - iad - - jnb - - lax - - lhr - - maa - - mad - - mia - - nrt - - ord - - otp - - qro - - scl - - sea - - sin - - sjc - - syd - - waw - - yul - - yyz + description: Region you want your server to reside in + example: us-east-1 kps_enabled: type: boolean required: @@ -1429,6 +1710,13 @@ components: type: string required: - name + AuthorizationsApproveBody: + type: object + properties: + organization_id: + type: string + required: + - organization_id CreateFunctionBody: type: object properties: @@ -1455,7 +1743,7 @@ components: name: type: string status: - enum: &ref_32 + enum: &ref_39 - ACTIVE - REMOVED - THROTTLED @@ -1488,7 +1776,7 @@ components: name: type: string status: - enum: *ref_32 + enum: *ref_39 type: string version: type: number @@ -1517,6 +1805,16 @@ components: type: string verify_jwt: type: boolean + ApiKeyResponse: + type: object + properties: + name: + type: string + api_key: + type: string + required: + - name + - api_key UpdateCustomHostnameResponse: type: object properties: @@ -1605,7 +1903,7 @@ components: type: string required: - root_key - PostgrestConfigResponse: + PostgrestConfigWithJWTSecretResponse: type: object properties: max_rows: @@ -1614,6 +1912,8 @@ components: type: string db_extra_search_path: type: string + jwt_secret: + type: string required: - max_rows - db_schema @@ -1629,6 +1929,19 @@ components: type: string db_schema: type: string + PostgrestConfigResponse: + type: object + properties: + max_rows: + type: integer + db_schema: + type: string + db_extra_search_path: + type: string + required: + - max_rows + - db_schema + - db_extra_search_path SecretResponse: type: object properties: @@ -1821,21 +2134,256 @@ components: - enabled - override_enabled - override_active_until - AttributeValue: + PostgresConfigResponse: type: object properties: - name: + statement_timeout: + type: integer + minimum: 0 + maximum: 2147483647 + effective_cache_size: + type: integer + minimum: 1 + maximum: 2147483647 + maintenance_work_mem: + type: integer + minimum: 1024 + maximum: 2147483647 + max_connections: + type: integer + minimum: 1 + maximum: 262143 + max_parallel_maintenance_workers: + type: integer + minimum: 0 + maximum: 1024 + max_parallel_workers: + type: integer + minimum: 0 + maximum: 1024 + max_parallel_workers_per_gather: + type: integer + minimum: 0 + maximum: 1024 + max_worker_processes: + type: integer + minimum: 0 + maximum: 262143 + shared_buffers: + type: integer + minimum: 16 + maximum: 1073741823 + work_mem: + type: integer + minimum: 64 + maximum: 2147483647 + session_replication_role: + enum: + - origin + - replica + - local type: string - names: - type: array - items: - type: string + required: + - statement_timeout + - effective_cache_size + - maintenance_work_mem + - max_connections + - max_parallel_maintenance_workers + - max_parallel_workers + - max_parallel_workers_per_gather + - max_worker_processes + - shared_buffers + - work_mem + - session_replication_role + UpdatePostgresConfigBody: + type: object + properties: + statement_timeout: + type: integer + minimum: 0 + maximum: 2147483647 + effective_cache_size: + type: integer + minimum: 1 + maximum: 2147483647 + maintenance_work_mem: + type: integer + minimum: 1024 + maximum: 2147483647 + max_connections: + type: integer + minimum: 1 + maximum: 262143 + max_parallel_maintenance_workers: + type: integer + minimum: 0 + maximum: 1024 + max_parallel_workers: + type: integer + minimum: 0 + maximum: 1024 + max_parallel_workers_per_gather: + type: integer + minimum: 0 + maximum: 1024 + max_worker_processes: + type: integer + minimum: 0 + maximum: 262143 + shared_buffers: + type: integer + minimum: 16 + maximum: 1073741823 + work_mem: + type: integer + minimum: 64 + maximum: 2147483647 + session_replication_role: + enum: + - origin + - replica + - local + type: string + required: + - statement_timeout + - effective_cache_size + - maintenance_work_mem + - max_connections + - max_parallel_maintenance_workers + - max_parallel_workers + - max_parallel_workers_per_gather + - max_worker_processes + - shared_buffers + - work_mem + - session_replication_role + ProjectPgBouncerConfig: + type: object + properties: + db_dns_name: + type: string + db_host: + type: string + db_name: + type: string + db_port: + type: number + db_ssl: + type: boolean + db_user: + type: string + default_pool_size: + type: number + ignore_startup_parameters: + type: string + inserted_at: + type: string + pgbouncer_enabled: + type: boolean + pgbouncer_status: + enum: + - COMING_DOWN + - COMING_UP + - DISABLED + - ENABLED + - RELOADING + type: string + pool_mode: + enum: + - transaction + - session + - statement + type: string + max_client_conn: + type: number + nullable: true + required: + - db_dns_name + - db_host + - db_name + - db_port + - db_ssl + - db_user + - default_pool_size + - ignore_startup_parameters + - inserted_at + - pgbouncer_enabled + - pgbouncer_status + - pool_mode + UpdatePgbouncerConfigBody: + type: object + properties: + default_pool_size: + type: integer + minimum: 0 + maximum: 65535 + max_client_conn: + type: integer + nullable: true + minimum: 0 + maximum: 18000 + ignore_startup_parameters: + type: string + pgbouncer_enabled: + type: boolean + pool_mode: + enum: &ref_40 + - transaction + - session + - statement + type: string + required: + - default_pool_size + - ignore_startup_parameters + - pgbouncer_enabled + - pool_mode + UpdatePoolingConfigResponse: + type: object + properties: + default_pool_size: + type: integer + minimum: 0 + maximum: 65535 + max_client_conn: + type: integer + nullable: true + minimum: 0 + maximum: 18000 + ignore_startup_parameters: + type: string + pgbouncer_enabled: + type: boolean + pool_mode: + enum: *ref_40 + type: string + pgbouncer_status: + enum: + - COMING_DOWN + - COMING_UP + - DISABLED + - ENABLED + - RELOADING + type: string + required: + - default_pool_size + - ignore_startup_parameters + - pgbouncer_enabled + - pool_mode + - pgbouncer_status + AttributeValue: + type: object + properties: default: oneOf: - type: object - type: number - type: string - type: boolean + name: + type: string + names: + type: array + items: + type: string AttributeMapping: type: object properties: diff --git a/internal/link/link.go b/internal/link/link.go index 6c22ce9de..e95e46a73 100644 --- a/internal/link/link.go +++ b/internal/link/link.go @@ -83,7 +83,7 @@ func linkPostgrest(ctx context.Context, projectRef string) error { return nil } -func updateApiConfig(config api.PostgrestConfigResponse) { +func updateApiConfig(config api.PostgrestConfigWithJWTSecretResponse) { maxRows := uint(config.MaxRows) searchPath := readCsv(config.DbExtraSearchPath) dbSchema := readCsv(config.DbSchema) diff --git a/pkg/api/client.gen.go b/pkg/api/client.gen.go index 9d6f0be10..6281f4a62 100644 --- a/pkg/api/client.gen.go +++ b/pkg/api/client.gen.go @@ -89,6 +89,23 @@ func WithRequestEditorFn(fn RequestEditorFn) ClientOption { // The interface specification for the client above. type ClientInterface interface { + // DeclineAuthorizationRequest request + DeclineAuthorizationRequest(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetAuthorizationRequest request + GetAuthorizationRequest(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ApproveAuthorizationRequest request with any body + ApproveAuthorizationRequestWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + ApproveAuthorizationRequest(ctx context.Context, id string, body ApproveAuthorizationRequestJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // Authorize request + Authorize(ctx context.Context, params *AuthorizeParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // Token request + Token(ctx context.Context, params *TokenParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetOrganizations request GetOrganizations(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -105,6 +122,9 @@ type ClientInterface interface { CreateProject(ctx context.Context, body CreateProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetProjectApiKeys request + GetProjectApiKeys(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListAllProviders request ListAllProviders(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -124,6 +144,22 @@ type ClientInterface interface { UpdateProviderById(ctx context.Context, ref string, providerId string, body UpdateProviderByIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetPgbouncerConfig request + GetPgbouncerConfig(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // UpdatePgbouncerConfig request with any body + UpdatePgbouncerConfigWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + UpdatePgbouncerConfig(ctx context.Context, ref string, body UpdatePgbouncerConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetConfig request + GetConfig(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // UpdateConfig request with any body + UpdateConfigWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + UpdateConfig(ctx context.Context, ref string, body UpdateConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // RemoveCustomHostnameConfig request RemoveCustomHostnameConfig(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -179,13 +215,13 @@ type ClientInterface interface { ApplyNetworkRestrictions(ctx context.Context, ref string, body ApplyNetworkRestrictionsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetConfig request - GetConfig(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetPgsodiumConfig request + GetPgsodiumConfig(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) - // UpdateConfig request with any body - UpdateConfigWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // UpdatePgsodiumConfig request with any body + UpdatePgsodiumConfigWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - UpdateConfig(ctx context.Context, ref string, body UpdateConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + UpdatePgsodiumConfig(ctx context.Context, ref string, body UpdatePgsodiumConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetPostgRESTConfig request GetPostgRESTConfig(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -253,6 +289,78 @@ type ClientInterface interface { CheckVanitySubdomainAvailability(ctx context.Context, ref string, body CheckVanitySubdomainAvailabilityJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) } +func (c *Client) DeclineAuthorizationRequest(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeclineAuthorizationRequestRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetAuthorizationRequest(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetAuthorizationRequestRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) ApproveAuthorizationRequestWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewApproveAuthorizationRequestRequestWithBody(c.Server, id, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) ApproveAuthorizationRequest(ctx context.Context, id string, body ApproveAuthorizationRequestJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewApproveAuthorizationRequestRequest(c.Server, id, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) Authorize(ctx context.Context, params *AuthorizeParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewAuthorizeRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) Token(ctx context.Context, params *TokenParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewTokenRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) GetOrganizations(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetOrganizationsRequest(c.Server) if err != nil { @@ -325,6 +433,18 @@ func (c *Client) CreateProject(ctx context.Context, body CreateProjectJSONReques return c.Client.Do(req) } +func (c *Client) GetProjectApiKeys(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetProjectApiKeysRequest(c.Server, ref) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) ListAllProviders(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewListAllProvidersRequest(c.Server, ref) if err != nil { @@ -409,6 +529,78 @@ func (c *Client) UpdateProviderById(ctx context.Context, ref string, providerId return c.Client.Do(req) } +func (c *Client) GetPgbouncerConfig(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetPgbouncerConfigRequest(c.Server, ref) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) UpdatePgbouncerConfigWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdatePgbouncerConfigRequestWithBody(c.Server, ref, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) UpdatePgbouncerConfig(ctx context.Context, ref string, body UpdatePgbouncerConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdatePgbouncerConfigRequest(c.Server, ref, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetConfig(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetConfigRequest(c.Server, ref) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) UpdateConfigWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateConfigRequestWithBody(c.Server, ref, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) UpdateConfig(ctx context.Context, ref string, body UpdateConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateConfigRequest(c.Server, ref, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) RemoveCustomHostnameConfig(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewRemoveCustomHostnameConfigRequest(c.Server, ref) if err != nil { @@ -649,8 +841,8 @@ func (c *Client) ApplyNetworkRestrictions(ctx context.Context, ref string, body return c.Client.Do(req) } -func (c *Client) GetConfig(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetConfigRequest(c.Server, ref) +func (c *Client) GetPgsodiumConfig(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetPgsodiumConfigRequest(c.Server, ref) if err != nil { return nil, err } @@ -661,8 +853,8 @@ func (c *Client) GetConfig(ctx context.Context, ref string, reqEditors ...Reques return c.Client.Do(req) } -func (c *Client) UpdateConfigWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateConfigRequestWithBody(c.Server, ref, contentType, body) +func (c *Client) UpdatePgsodiumConfigWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdatePgsodiumConfigRequestWithBody(c.Server, ref, contentType, body) if err != nil { return nil, err } @@ -673,8 +865,8 @@ func (c *Client) UpdateConfigWithBody(ctx context.Context, ref string, contentTy return c.Client.Do(req) } -func (c *Client) UpdateConfig(ctx context.Context, ref string, body UpdateConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateConfigRequest(c.Server, ref, body) +func (c *Client) UpdatePgsodiumConfig(ctx context.Context, ref string, body UpdatePgsodiumConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdatePgsodiumConfigRequest(c.Server, ref, body) if err != nil { return nil, err } @@ -973,54 +1165,23 @@ func (c *Client) CheckVanitySubdomainAvailability(ctx context.Context, ref strin return c.Client.Do(req) } -// NewGetOrganizationsRequest generates requests for GetOrganizations -func NewGetOrganizationsRequest(server string) (*http.Request, error) { +// NewDeclineAuthorizationRequestRequest generates requests for DeclineAuthorizationRequest +func NewDeclineAuthorizationRequestRequest(server string, id string) (*http.Request, error) { var err error - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/organizations") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} + var pathParam0 string -// NewCreateOrganizationRequest calls the generic CreateOrganization builder with application/json body -func NewCreateOrganizationRequest(server string, body CreateOrganizationJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) if err != nil { return nil, err } - bodyReader = bytes.NewReader(buf) - return NewCreateOrganizationRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateOrganizationRequestWithBody generates requests for CreateOrganization with any type of body -func NewCreateOrganizationRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/v1/organizations") + operationPath := fmt.Sprintf("/v1/oauth/authorizations/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -1030,26 +1191,31 @@ func NewCreateOrganizationRequestWithBody(server string, contentType string, bod return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) - return req, nil } -// NewGetProjectsRequest generates requests for GetProjects -func NewGetProjectsRequest(server string) (*http.Request, error) { +// NewGetAuthorizationRequestRequest generates requests for GetAuthorizationRequest +func NewGetAuthorizationRequestRequest(server string, id string) (*http.Request, error) { var err error + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/v1/projects") + operationPath := fmt.Sprintf("/v1/oauth/authorizations/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -1067,27 +1233,34 @@ func NewGetProjectsRequest(server string) (*http.Request, error) { return req, nil } -// NewCreateProjectRequest calls the generic CreateProject builder with application/json body -func NewCreateProjectRequest(server string, body CreateProjectJSONRequestBody) (*http.Request, error) { +// NewApproveAuthorizationRequestRequest calls the generic ApproveAuthorizationRequest builder with application/json body +func NewApproveAuthorizationRequestRequest(server string, id string, body ApproveAuthorizationRequestJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewCreateProjectRequestWithBody(server, "application/json", bodyReader) + return NewApproveAuthorizationRequestRequestWithBody(server, id, "application/json", bodyReader) } -// NewCreateProjectRequestWithBody generates requests for CreateProject with any type of body -func NewCreateProjectRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { +// NewApproveAuthorizationRequestRequestWithBody generates requests for ApproveAuthorizationRequest with any type of body +func NewApproveAuthorizationRequestRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { var err error + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/v1/projects") + operationPath := fmt.Sprintf("/v1/oauth/authorizations/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -1107,23 +1280,16 @@ func NewCreateProjectRequestWithBody(server string, contentType string, body io. return req, nil } -// NewListAllProvidersRequest generates requests for ListAllProviders -func NewListAllProvidersRequest(server string, ref string) (*http.Request, error) { +// NewAuthorizeRequest generates requests for Authorize +func NewAuthorizeRequest(server string, params *AuthorizeParams) (*http.Request, error) { var err error - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) - if err != nil { - return nil, err - } - serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/v1/projects/%s/config/auth/sso/providers", pathParam0) + operationPath := fmt.Sprintf("/v1/oauth/authorize") if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -1133,22 +1299,467 @@ func NewListAllProvidersRequest(server string, ref string) (*http.Request, error return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { + queryValues := queryURL.Query() + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "client_id", runtime.ParamLocationQuery, params.ClientId); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - return req, nil -} - -// NewCreateProviderForProjectRequest calls the generic CreateProviderForProject builder with application/json body -func NewCreateProviderForProjectRequest(server string, ref string, body CreateProviderForProjectJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "response_type", runtime.ParamLocationQuery, params.ResponseType); err != nil { return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - bodyReader = bytes.NewReader(buf) + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "redirect_uri", runtime.ParamLocationQuery, params.RedirectUri); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "scope", runtime.ParamLocationQuery, params.Scope); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + if params.State != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "state", runtime.ParamLocationQuery, *params.State); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.ResponseMode != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "response_mode", runtime.ParamLocationQuery, *params.ResponseMode); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.CodeChallenge != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "code_challenge", runtime.ParamLocationQuery, *params.CodeChallenge); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.CodeChallengeMethod != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "code_challenge_method", runtime.ParamLocationQuery, *params.CodeChallengeMethod); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewTokenRequest generates requests for Token +func NewTokenRequest(server string, params *TokenParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/oauth/token") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + queryValues := queryURL.Query() + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "grant_type", runtime.ParamLocationQuery, params.GrantType); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "client_id", runtime.ParamLocationQuery, params.ClientId); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "client_secret", runtime.ParamLocationQuery, params.ClientSecret); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + if params.Code != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "code", runtime.ParamLocationQuery, *params.Code); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.CodeVerifier != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "code_verifier", runtime.ParamLocationQuery, *params.CodeVerifier); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "redirect_uri", runtime.ParamLocationQuery, params.RedirectUri); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + if params.RefreshToken != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "refresh_token", runtime.ParamLocationQuery, *params.RefreshToken); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetOrganizationsRequest generates requests for GetOrganizations +func NewGetOrganizationsRequest(server string) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewCreateOrganizationRequest calls the generic CreateOrganization builder with application/json body +func NewCreateOrganizationRequest(server string, body CreateOrganizationJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewCreateOrganizationRequestWithBody(server, "application/json", bodyReader) +} + +// NewCreateOrganizationRequestWithBody generates requests for CreateOrganization with any type of body +func NewCreateOrganizationRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewGetProjectsRequest generates requests for GetProjects +func NewGetProjectsRequest(server string) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewCreateProjectRequest calls the generic CreateProject builder with application/json body +func NewCreateProjectRequest(server string, body CreateProjectJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewCreateProjectRequestWithBody(server, "application/json", bodyReader) +} + +// NewCreateProjectRequestWithBody generates requests for CreateProject with any type of body +func NewCreateProjectRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewGetProjectApiKeysRequest generates requests for GetProjectApiKeys +func NewGetProjectApiKeysRequest(server string, ref string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/api-keys", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewListAllProvidersRequest generates requests for ListAllProviders +func NewListAllProvidersRequest(server string, ref string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/config/auth/sso/providers", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewCreateProviderForProjectRequest calls the generic CreateProviderForProject builder with application/json body +func NewCreateProviderForProjectRequest(server string, ref string, body CreateProviderForProjectJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) return NewCreateProviderForProjectRequestWithBody(server, ref, "application/json", bodyReader) } @@ -1292,9 +1903,171 @@ func NewUpdateProviderByIdRequestWithBody(server string, ref string, providerId return nil, err } - var pathParam1 string + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "provider_id", runtime.ParamLocationPath, providerId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/config/auth/sso/providers/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("PUT", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewGetPgbouncerConfigRequest generates requests for GetPgbouncerConfig +func NewGetPgbouncerConfigRequest(server string, ref string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/config/database/pgbouncer", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewUpdatePgbouncerConfigRequest calls the generic UpdatePgbouncerConfig builder with application/json body +func NewUpdatePgbouncerConfigRequest(server string, ref string, body UpdatePgbouncerConfigJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewUpdatePgbouncerConfigRequestWithBody(server, ref, "application/json", bodyReader) +} + +// NewUpdatePgbouncerConfigRequestWithBody generates requests for UpdatePgbouncerConfig with any type of body +func NewUpdatePgbouncerConfigRequestWithBody(server string, ref string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/config/database/pgbouncer", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("PATCH", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewGetConfigRequest generates requests for GetConfig +func NewGetConfigRequest(server string, ref string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/config/database/postgres", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewUpdateConfigRequest calls the generic UpdateConfig builder with application/json body +func NewUpdateConfigRequest(server string, ref string, body UpdateConfigJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewUpdateConfigRequestWithBody(server, ref, "application/json", bodyReader) +} + +// NewUpdateConfigRequestWithBody generates requests for UpdateConfig with any type of body +func NewUpdateConfigRequestWithBody(server string, ref string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "provider_id", runtime.ParamLocationPath, providerId) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) if err != nil { return nil, err } @@ -1304,7 +2077,7 @@ func NewUpdateProviderByIdRequestWithBody(server string, ref string, providerId return nil, err } - operationPath := fmt.Sprintf("/v1/projects/%s/config/auth/sso/providers/%s", pathParam0, pathParam1) + operationPath := fmt.Sprintf("/v1/projects/%s/config/database/postgres", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -2063,8 +2836,8 @@ func NewApplyNetworkRestrictionsRequestWithBody(server string, ref string, conte return req, nil } -// NewGetConfigRequest generates requests for GetConfig -func NewGetConfigRequest(server string, ref string) (*http.Request, error) { +// NewGetPgsodiumConfigRequest generates requests for GetPgsodiumConfig +func NewGetPgsodiumConfigRequest(server string, ref string) (*http.Request, error) { var err error var pathParam0 string @@ -2097,19 +2870,19 @@ func NewGetConfigRequest(server string, ref string) (*http.Request, error) { return req, nil } -// NewUpdateConfigRequest calls the generic UpdateConfig builder with application/json body -func NewUpdateConfigRequest(server string, ref string, body UpdateConfigJSONRequestBody) (*http.Request, error) { +// NewUpdatePgsodiumConfigRequest calls the generic UpdatePgsodiumConfig builder with application/json body +func NewUpdatePgsodiumConfigRequest(server string, ref string, body UpdatePgsodiumConfigJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewUpdateConfigRequestWithBody(server, ref, "application/json", bodyReader) + return NewUpdatePgsodiumConfigRequestWithBody(server, ref, "application/json", bodyReader) } -// NewUpdateConfigRequestWithBody generates requests for UpdateConfig with any type of body -func NewUpdateConfigRequestWithBody(server string, ref string, contentType string, body io.Reader) (*http.Request, error) { +// NewUpdatePgsodiumConfigRequestWithBody generates requests for UpdatePgsodiumConfig with any type of body +func NewUpdatePgsodiumConfigRequestWithBody(server string, ref string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -2876,6 +3649,23 @@ func WithBaseURL(baseURL string) ClientOption { // ClientWithResponsesInterface is the interface specification for the client with responses above. type ClientWithResponsesInterface interface { + // DeclineAuthorizationRequest request + DeclineAuthorizationRequestWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeclineAuthorizationRequestResponse, error) + + // GetAuthorizationRequest request + GetAuthorizationRequestWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetAuthorizationRequestResponse, error) + + // ApproveAuthorizationRequest request with any body + ApproveAuthorizationRequestWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ApproveAuthorizationRequestResponse, error) + + ApproveAuthorizationRequestWithResponse(ctx context.Context, id string, body ApproveAuthorizationRequestJSONRequestBody, reqEditors ...RequestEditorFn) (*ApproveAuthorizationRequestResponse, error) + + // Authorize request + AuthorizeWithResponse(ctx context.Context, params *AuthorizeParams, reqEditors ...RequestEditorFn) (*AuthorizeResponse, error) + + // Token request + TokenWithResponse(ctx context.Context, params *TokenParams, reqEditors ...RequestEditorFn) (*TokenResponse, error) + // GetOrganizations request GetOrganizationsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetOrganizationsResponse, error) @@ -2892,6 +3682,9 @@ type ClientWithResponsesInterface interface { CreateProjectWithResponse(ctx context.Context, body CreateProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateProjectResponse, error) + // GetProjectApiKeys request + GetProjectApiKeysWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetProjectApiKeysResponse, error) + // ListAllProviders request ListAllProvidersWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*ListAllProvidersResponse, error) @@ -2911,6 +3704,22 @@ type ClientWithResponsesInterface interface { UpdateProviderByIdWithResponse(ctx context.Context, ref string, providerId string, body UpdateProviderByIdJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateProviderByIdResponse, error) + // GetPgbouncerConfig request + GetPgbouncerConfigWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetPgbouncerConfigResponse, error) + + // UpdatePgbouncerConfig request with any body + UpdatePgbouncerConfigWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdatePgbouncerConfigResponse, error) + + UpdatePgbouncerConfigWithResponse(ctx context.Context, ref string, body UpdatePgbouncerConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdatePgbouncerConfigResponse, error) + + // GetConfig request + GetConfigWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetConfigResponse, error) + + // UpdateConfig request with any body + UpdateConfigWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateConfigResponse, error) + + UpdateConfigWithResponse(ctx context.Context, ref string, body UpdateConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateConfigResponse, error) + // RemoveCustomHostnameConfig request RemoveCustomHostnameConfigWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*RemoveCustomHostnameConfigResponse, error) @@ -2966,13 +3775,13 @@ type ClientWithResponsesInterface interface { ApplyNetworkRestrictionsWithResponse(ctx context.Context, ref string, body ApplyNetworkRestrictionsJSONRequestBody, reqEditors ...RequestEditorFn) (*ApplyNetworkRestrictionsResponse, error) - // GetConfig request - GetConfigWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetConfigResponse, error) + // GetPgsodiumConfig request + GetPgsodiumConfigWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetPgsodiumConfigResponse, error) - // UpdateConfig request with any body - UpdateConfigWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateConfigResponse, error) + // UpdatePgsodiumConfig request with any body + UpdatePgsodiumConfigWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdatePgsodiumConfigResponse, error) - UpdateConfigWithResponse(ctx context.Context, ref string, body UpdateConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateConfigResponse, error) + UpdatePgsodiumConfigWithResponse(ctx context.Context, ref string, body UpdatePgsodiumConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdatePgsodiumConfigResponse, error) // GetPostgRESTConfig request GetPostgRESTConfigWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetPostgRESTConfigResponse, error) @@ -3040,6 +3849,111 @@ type ClientWithResponsesInterface interface { CheckVanitySubdomainAvailabilityWithResponse(ctx context.Context, ref string, body CheckVanitySubdomainAvailabilityJSONRequestBody, reqEditors ...RequestEditorFn) (*CheckVanitySubdomainAvailabilityResponse, error) } +type DeclineAuthorizationRequestResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r DeclineAuthorizationRequestResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r DeclineAuthorizationRequestResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetAuthorizationRequestResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r GetAuthorizationRequestResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetAuthorizationRequestResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type ApproveAuthorizationRequestResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r ApproveAuthorizationRequestResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ApproveAuthorizationRequestResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type AuthorizeResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r AuthorizeResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r AuthorizeResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type TokenResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r TokenResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r TokenResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type GetOrganizationsResponse struct { Body []byte HTTPResponse *http.Response @@ -3109,6 +4023,7 @@ func (r GetProjectsResponse) StatusCode() int { type CreateProjectResponse struct { Body []byte HTTPResponse *http.Response + JSON200 *ProjectResponse JSON201 *ProjectResponse } @@ -3128,6 +4043,28 @@ func (r CreateProjectResponse) StatusCode() int { return 0 } +type GetProjectApiKeysResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *[]ApiKeyResponse +} + +// Status returns HTTPResponse.Status +func (r GetProjectApiKeysResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetProjectApiKeysResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type ListAllProvidersResponse struct { Body []byte HTTPResponse *http.Response @@ -3238,6 +4175,94 @@ func (r UpdateProviderByIdResponse) StatusCode() int { return 0 } +type GetPgbouncerConfigResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *ProjectPgBouncerConfig +} + +// Status returns HTTPResponse.Status +func (r GetPgbouncerConfigResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetPgbouncerConfigResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type UpdatePgbouncerConfigResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *UpdatePoolingConfigResponse +} + +// Status returns HTTPResponse.Status +func (r UpdatePgbouncerConfigResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r UpdatePgbouncerConfigResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetConfigResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *PostgresConfigResponse +} + +// Status returns HTTPResponse.Status +func (r GetConfigResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetConfigResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type UpdateConfigResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *PostgresConfigResponse +} + +// Status returns HTTPResponse.Status +func (r UpdateConfigResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r UpdateConfigResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type RemoveCustomHostnameConfigResponse struct { Body []byte HTTPResponse *http.Response @@ -3564,14 +4589,14 @@ func (r ApplyNetworkRestrictionsResponse) StatusCode() int { return 0 } -type GetConfigResponse struct { +type GetPgsodiumConfigResponse struct { Body []byte HTTPResponse *http.Response JSON200 *PgsodiumConfigResponse } // Status returns HTTPResponse.Status -func (r GetConfigResponse) Status() string { +func (r GetPgsodiumConfigResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -3579,21 +4604,21 @@ func (r GetConfigResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetConfigResponse) StatusCode() int { +func (r GetPgsodiumConfigResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type UpdateConfigResponse struct { +type UpdatePgsodiumConfigResponse struct { Body []byte HTTPResponse *http.Response JSON200 *PgsodiumConfigResponse } // Status returns HTTPResponse.Status -func (r UpdateConfigResponse) Status() string { +func (r UpdatePgsodiumConfigResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -3601,7 +4626,7 @@ func (r UpdateConfigResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r UpdateConfigResponse) StatusCode() int { +func (r UpdatePgsodiumConfigResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -3611,7 +4636,7 @@ func (r UpdateConfigResponse) StatusCode() int { type GetPostgRESTConfigResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *PostgrestConfigResponse + JSON200 *PostgrestConfigWithJWTSecretResponse } // Status returns HTTPResponse.Status @@ -3975,7 +5000,60 @@ func (r CheckVanitySubdomainAvailabilityResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } - return 0 + return 0 +} + +// DeclineAuthorizationRequestWithResponse request returning *DeclineAuthorizationRequestResponse +func (c *ClientWithResponses) DeclineAuthorizationRequestWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeclineAuthorizationRequestResponse, error) { + rsp, err := c.DeclineAuthorizationRequest(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeclineAuthorizationRequestResponse(rsp) +} + +// GetAuthorizationRequestWithResponse request returning *GetAuthorizationRequestResponse +func (c *ClientWithResponses) GetAuthorizationRequestWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetAuthorizationRequestResponse, error) { + rsp, err := c.GetAuthorizationRequest(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetAuthorizationRequestResponse(rsp) +} + +// ApproveAuthorizationRequestWithBodyWithResponse request with arbitrary body returning *ApproveAuthorizationRequestResponse +func (c *ClientWithResponses) ApproveAuthorizationRequestWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ApproveAuthorizationRequestResponse, error) { + rsp, err := c.ApproveAuthorizationRequestWithBody(ctx, id, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseApproveAuthorizationRequestResponse(rsp) +} + +func (c *ClientWithResponses) ApproveAuthorizationRequestWithResponse(ctx context.Context, id string, body ApproveAuthorizationRequestJSONRequestBody, reqEditors ...RequestEditorFn) (*ApproveAuthorizationRequestResponse, error) { + rsp, err := c.ApproveAuthorizationRequest(ctx, id, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseApproveAuthorizationRequestResponse(rsp) +} + +// AuthorizeWithResponse request returning *AuthorizeResponse +func (c *ClientWithResponses) AuthorizeWithResponse(ctx context.Context, params *AuthorizeParams, reqEditors ...RequestEditorFn) (*AuthorizeResponse, error) { + rsp, err := c.Authorize(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseAuthorizeResponse(rsp) +} + +// TokenWithResponse request returning *TokenResponse +func (c *ClientWithResponses) TokenWithResponse(ctx context.Context, params *TokenParams, reqEditors ...RequestEditorFn) (*TokenResponse, error) { + rsp, err := c.Token(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseTokenResponse(rsp) } // GetOrganizationsWithResponse request returning *GetOrganizationsResponse @@ -4030,6 +5108,15 @@ func (c *ClientWithResponses) CreateProjectWithResponse(ctx context.Context, bod return ParseCreateProjectResponse(rsp) } +// GetProjectApiKeysWithResponse request returning *GetProjectApiKeysResponse +func (c *ClientWithResponses) GetProjectApiKeysWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetProjectApiKeysResponse, error) { + rsp, err := c.GetProjectApiKeys(ctx, ref, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetProjectApiKeysResponse(rsp) +} + // ListAllProvidersWithResponse request returning *ListAllProvidersResponse func (c *ClientWithResponses) ListAllProvidersWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*ListAllProvidersResponse, error) { rsp, err := c.ListAllProviders(ctx, ref, reqEditors...) @@ -4091,6 +5178,58 @@ func (c *ClientWithResponses) UpdateProviderByIdWithResponse(ctx context.Context return ParseUpdateProviderByIdResponse(rsp) } +// GetPgbouncerConfigWithResponse request returning *GetPgbouncerConfigResponse +func (c *ClientWithResponses) GetPgbouncerConfigWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetPgbouncerConfigResponse, error) { + rsp, err := c.GetPgbouncerConfig(ctx, ref, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetPgbouncerConfigResponse(rsp) +} + +// UpdatePgbouncerConfigWithBodyWithResponse request with arbitrary body returning *UpdatePgbouncerConfigResponse +func (c *ClientWithResponses) UpdatePgbouncerConfigWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdatePgbouncerConfigResponse, error) { + rsp, err := c.UpdatePgbouncerConfigWithBody(ctx, ref, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdatePgbouncerConfigResponse(rsp) +} + +func (c *ClientWithResponses) UpdatePgbouncerConfigWithResponse(ctx context.Context, ref string, body UpdatePgbouncerConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdatePgbouncerConfigResponse, error) { + rsp, err := c.UpdatePgbouncerConfig(ctx, ref, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdatePgbouncerConfigResponse(rsp) +} + +// GetConfigWithResponse request returning *GetConfigResponse +func (c *ClientWithResponses) GetConfigWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetConfigResponse, error) { + rsp, err := c.GetConfig(ctx, ref, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetConfigResponse(rsp) +} + +// UpdateConfigWithBodyWithResponse request with arbitrary body returning *UpdateConfigResponse +func (c *ClientWithResponses) UpdateConfigWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateConfigResponse, error) { + rsp, err := c.UpdateConfigWithBody(ctx, ref, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateConfigResponse(rsp) +} + +func (c *ClientWithResponses) UpdateConfigWithResponse(ctx context.Context, ref string, body UpdateConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateConfigResponse, error) { + rsp, err := c.UpdateConfig(ctx, ref, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateConfigResponse(rsp) +} + // RemoveCustomHostnameConfigWithResponse request returning *RemoveCustomHostnameConfigResponse func (c *ClientWithResponses) RemoveCustomHostnameConfigWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*RemoveCustomHostnameConfigResponse, error) { rsp, err := c.RemoveCustomHostnameConfig(ctx, ref, reqEditors...) @@ -4266,30 +5405,30 @@ func (c *ClientWithResponses) ApplyNetworkRestrictionsWithResponse(ctx context.C return ParseApplyNetworkRestrictionsResponse(rsp) } -// GetConfigWithResponse request returning *GetConfigResponse -func (c *ClientWithResponses) GetConfigWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetConfigResponse, error) { - rsp, err := c.GetConfig(ctx, ref, reqEditors...) +// GetPgsodiumConfigWithResponse request returning *GetPgsodiumConfigResponse +func (c *ClientWithResponses) GetPgsodiumConfigWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetPgsodiumConfigResponse, error) { + rsp, err := c.GetPgsodiumConfig(ctx, ref, reqEditors...) if err != nil { return nil, err } - return ParseGetConfigResponse(rsp) + return ParseGetPgsodiumConfigResponse(rsp) } -// UpdateConfigWithBodyWithResponse request with arbitrary body returning *UpdateConfigResponse -func (c *ClientWithResponses) UpdateConfigWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateConfigResponse, error) { - rsp, err := c.UpdateConfigWithBody(ctx, ref, contentType, body, reqEditors...) +// UpdatePgsodiumConfigWithBodyWithResponse request with arbitrary body returning *UpdatePgsodiumConfigResponse +func (c *ClientWithResponses) UpdatePgsodiumConfigWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdatePgsodiumConfigResponse, error) { + rsp, err := c.UpdatePgsodiumConfigWithBody(ctx, ref, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParseUpdateConfigResponse(rsp) + return ParseUpdatePgsodiumConfigResponse(rsp) } -func (c *ClientWithResponses) UpdateConfigWithResponse(ctx context.Context, ref string, body UpdateConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateConfigResponse, error) { - rsp, err := c.UpdateConfig(ctx, ref, body, reqEditors...) +func (c *ClientWithResponses) UpdatePgsodiumConfigWithResponse(ctx context.Context, ref string, body UpdatePgsodiumConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdatePgsodiumConfigResponse, error) { + rsp, err := c.UpdatePgsodiumConfig(ctx, ref, body, reqEditors...) if err != nil { return nil, err } - return ParseUpdateConfigResponse(rsp) + return ParseUpdatePgsodiumConfigResponse(rsp) } // GetPostgRESTConfigWithResponse request returning *GetPostgRESTConfigResponse @@ -4501,6 +5640,86 @@ func (c *ClientWithResponses) CheckVanitySubdomainAvailabilityWithResponse(ctx c return ParseCheckVanitySubdomainAvailabilityResponse(rsp) } +// ParseDeclineAuthorizationRequestResponse parses an HTTP response from a DeclineAuthorizationRequestWithResponse call +func ParseDeclineAuthorizationRequestResponse(rsp *http.Response) (*DeclineAuthorizationRequestResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &DeclineAuthorizationRequestResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParseGetAuthorizationRequestResponse parses an HTTP response from a GetAuthorizationRequestWithResponse call +func ParseGetAuthorizationRequestResponse(rsp *http.Response) (*GetAuthorizationRequestResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetAuthorizationRequestResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParseApproveAuthorizationRequestResponse parses an HTTP response from a ApproveAuthorizationRequestWithResponse call +func ParseApproveAuthorizationRequestResponse(rsp *http.Response) (*ApproveAuthorizationRequestResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ApproveAuthorizationRequestResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParseAuthorizeResponse parses an HTTP response from a AuthorizeWithResponse call +func ParseAuthorizeResponse(rsp *http.Response) (*AuthorizeResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &AuthorizeResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParseTokenResponse parses an HTTP response from a TokenWithResponse call +func ParseTokenResponse(rsp *http.Response) (*TokenResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &TokenResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + // ParseGetOrganizationsResponse parses an HTTP response from a GetOrganizationsWithResponse call func ParseGetOrganizationsResponse(rsp *http.Response) (*GetOrganizationsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -4593,6 +5812,13 @@ func ParseCreateProjectResponse(rsp *http.Response) (*CreateProjectResponse, err } switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest ProjectResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: var dest ProjectResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -4605,6 +5831,32 @@ func ParseCreateProjectResponse(rsp *http.Response) (*CreateProjectResponse, err return response, nil } +// ParseGetProjectApiKeysResponse parses an HTTP response from a GetProjectApiKeysWithResponse call +func ParseGetProjectApiKeysResponse(rsp *http.Response) (*GetProjectApiKeysResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetProjectApiKeysResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest []ApiKeyResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + // ParseListAllProvidersResponse parses an HTTP response from a ListAllProvidersWithResponse call func ParseListAllProvidersResponse(rsp *http.Response) (*ListAllProvidersResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -4735,6 +5987,110 @@ func ParseUpdateProviderByIdResponse(rsp *http.Response) (*UpdateProviderByIdRes return response, nil } +// ParseGetPgbouncerConfigResponse parses an HTTP response from a GetPgbouncerConfigWithResponse call +func ParseGetPgbouncerConfigResponse(rsp *http.Response) (*GetPgbouncerConfigResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetPgbouncerConfigResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest ProjectPgBouncerConfig + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseUpdatePgbouncerConfigResponse parses an HTTP response from a UpdatePgbouncerConfigWithResponse call +func ParseUpdatePgbouncerConfigResponse(rsp *http.Response) (*UpdatePgbouncerConfigResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &UpdatePgbouncerConfigResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest UpdatePoolingConfigResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseGetConfigResponse parses an HTTP response from a GetConfigWithResponse call +func ParseGetConfigResponse(rsp *http.Response) (*GetConfigResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetConfigResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest PostgresConfigResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseUpdateConfigResponse parses an HTTP response from a UpdateConfigWithResponse call +func ParseUpdateConfigResponse(rsp *http.Response) (*UpdateConfigResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &UpdateConfigResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest PostgresConfigResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + // ParseRemoveCustomHostnameConfigResponse parses an HTTP response from a RemoveCustomHostnameConfigWithResponse call func ParseRemoveCustomHostnameConfigResponse(rsp *http.Response) (*RemoveCustomHostnameConfigResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -5085,15 +6441,15 @@ func ParseApplyNetworkRestrictionsResponse(rsp *http.Response) (*ApplyNetworkRes return response, nil } -// ParseGetConfigResponse parses an HTTP response from a GetConfigWithResponse call -func ParseGetConfigResponse(rsp *http.Response) (*GetConfigResponse, error) { +// ParseGetPgsodiumConfigResponse parses an HTTP response from a GetPgsodiumConfigWithResponse call +func ParseGetPgsodiumConfigResponse(rsp *http.Response) (*GetPgsodiumConfigResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetConfigResponse{ + response := &GetPgsodiumConfigResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -5111,15 +6467,15 @@ func ParseGetConfigResponse(rsp *http.Response) (*GetConfigResponse, error) { return response, nil } -// ParseUpdateConfigResponse parses an HTTP response from a UpdateConfigWithResponse call -func ParseUpdateConfigResponse(rsp *http.Response) (*UpdateConfigResponse, error) { +// ParseUpdatePgsodiumConfigResponse parses an HTTP response from a UpdatePgsodiumConfigWithResponse call +func ParseUpdatePgsodiumConfigResponse(rsp *http.Response) (*UpdatePgsodiumConfigResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &UpdateConfigResponse{ + response := &UpdatePgsodiumConfigResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -5152,7 +6508,7 @@ func ParseGetPostgRESTConfigResponse(rsp *http.Response) (*GetPostgRESTConfigRes switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest PostgrestConfigResponse + var dest PostgrestConfigWithJWTSecretResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } diff --git a/pkg/api/types.gen.go b/pkg/api/types.gen.go index c4a71202e..6193f512e 100644 --- a/pkg/api/types.gen.go +++ b/pkg/api/types.gen.go @@ -23,52 +23,20 @@ const ( // Defines values for CreateProjectBodyRegion. const ( - Ams CreateProjectBodyRegion = "ams" ApNortheast1 CreateProjectBodyRegion = "ap-northeast-1" ApNortheast2 CreateProjectBodyRegion = "ap-northeast-2" ApSouth1 CreateProjectBodyRegion = "ap-south-1" ApSoutheast1 CreateProjectBodyRegion = "ap-southeast-1" ApSoutheast2 CreateProjectBodyRegion = "ap-southeast-2" - Arn CreateProjectBodyRegion = "arn" - Bog CreateProjectBodyRegion = "bog" - Bos CreateProjectBodyRegion = "bos" CaCentral1 CreateProjectBodyRegion = "ca-central-1" - Cdg CreateProjectBodyRegion = "cdg" - Den CreateProjectBodyRegion = "den" - Dfw CreateProjectBodyRegion = "dfw" EuCentral1 CreateProjectBodyRegion = "eu-central-1" EuWest1 CreateProjectBodyRegion = "eu-west-1" EuWest2 CreateProjectBodyRegion = "eu-west-2" EuWest3 CreateProjectBodyRegion = "eu-west-3" - Ewr CreateProjectBodyRegion = "ewr" - Fra CreateProjectBodyRegion = "fra" - Gdl CreateProjectBodyRegion = "gdl" - Gig CreateProjectBodyRegion = "gig" - Gru CreateProjectBodyRegion = "gru" - Hkg CreateProjectBodyRegion = "hkg" - Iad CreateProjectBodyRegion = "iad" - Jnb CreateProjectBodyRegion = "jnb" - Lax CreateProjectBodyRegion = "lax" - Lhr CreateProjectBodyRegion = "lhr" - Maa CreateProjectBodyRegion = "maa" - Mad CreateProjectBodyRegion = "mad" - Mia CreateProjectBodyRegion = "mia" - Nrt CreateProjectBodyRegion = "nrt" - Ord CreateProjectBodyRegion = "ord" - Otp CreateProjectBodyRegion = "otp" - Qro CreateProjectBodyRegion = "qro" SaEast1 CreateProjectBodyRegion = "sa-east-1" - Scl CreateProjectBodyRegion = "scl" - Sea CreateProjectBodyRegion = "sea" - Sin CreateProjectBodyRegion = "sin" - Sjc CreateProjectBodyRegion = "sjc" - Syd CreateProjectBodyRegion = "syd" UsEast1 CreateProjectBodyRegion = "us-east-1" UsWest1 CreateProjectBodyRegion = "us-west-1" UsWest2 CreateProjectBodyRegion = "us-west-2" - Waw CreateProjectBodyRegion = "waw" - Yul CreateProjectBodyRegion = "yul" - Yyz CreateProjectBodyRegion = "yyz" ) // Defines values for CreateProviderBodyType. @@ -134,6 +102,29 @@ const ( Stored NetworkRestrictionsResponseStatus = "stored" ) +// Defines values for PostgresConfigResponseSessionReplicationRole. +const ( + PostgresConfigResponseSessionReplicationRoleLocal PostgresConfigResponseSessionReplicationRole = "local" + PostgresConfigResponseSessionReplicationRoleOrigin PostgresConfigResponseSessionReplicationRole = "origin" + PostgresConfigResponseSessionReplicationRoleReplica PostgresConfigResponseSessionReplicationRole = "replica" +) + +// Defines values for ProjectPgBouncerConfigPgbouncerStatus. +const ( + ProjectPgBouncerConfigPgbouncerStatusCOMINGDOWN ProjectPgBouncerConfigPgbouncerStatus = "COMING_DOWN" + ProjectPgBouncerConfigPgbouncerStatusCOMINGUP ProjectPgBouncerConfigPgbouncerStatus = "COMING_UP" + ProjectPgBouncerConfigPgbouncerStatusDISABLED ProjectPgBouncerConfigPgbouncerStatus = "DISABLED" + ProjectPgBouncerConfigPgbouncerStatusENABLED ProjectPgBouncerConfigPgbouncerStatus = "ENABLED" + ProjectPgBouncerConfigPgbouncerStatusRELOADING ProjectPgBouncerConfigPgbouncerStatus = "RELOADING" +) + +// Defines values for ProjectPgBouncerConfigPoolMode. +const ( + ProjectPgBouncerConfigPoolModeSession ProjectPgBouncerConfigPoolMode = "session" + ProjectPgBouncerConfigPoolModeStatement ProjectPgBouncerConfigPoolMode = "statement" + ProjectPgBouncerConfigPoolModeTransaction ProjectPgBouncerConfigPoolMode = "transaction" +) + // Defines values for UpdateCustomHostnameResponseStatus. const ( N1NotStarted UpdateCustomHostnameResponseStatus = "1_not_started" @@ -143,6 +134,36 @@ const ( N5ServicesReconfigured UpdateCustomHostnameResponseStatus = "5_services_reconfigured" ) +// Defines values for UpdatePgbouncerConfigBodyPoolMode. +const ( + UpdatePgbouncerConfigBodyPoolModeSession UpdatePgbouncerConfigBodyPoolMode = "session" + UpdatePgbouncerConfigBodyPoolModeStatement UpdatePgbouncerConfigBodyPoolMode = "statement" + UpdatePgbouncerConfigBodyPoolModeTransaction UpdatePgbouncerConfigBodyPoolMode = "transaction" +) + +// Defines values for UpdatePoolingConfigResponsePgbouncerStatus. +const ( + UpdatePoolingConfigResponsePgbouncerStatusCOMINGDOWN UpdatePoolingConfigResponsePgbouncerStatus = "COMING_DOWN" + UpdatePoolingConfigResponsePgbouncerStatusCOMINGUP UpdatePoolingConfigResponsePgbouncerStatus = "COMING_UP" + UpdatePoolingConfigResponsePgbouncerStatusDISABLED UpdatePoolingConfigResponsePgbouncerStatus = "DISABLED" + UpdatePoolingConfigResponsePgbouncerStatusENABLED UpdatePoolingConfigResponsePgbouncerStatus = "ENABLED" + UpdatePoolingConfigResponsePgbouncerStatusRELOADING UpdatePoolingConfigResponsePgbouncerStatus = "RELOADING" +) + +// Defines values for UpdatePoolingConfigResponsePoolMode. +const ( + Session UpdatePoolingConfigResponsePoolMode = "session" + Statement UpdatePoolingConfigResponsePoolMode = "statement" + Transaction UpdatePoolingConfigResponsePoolMode = "transaction" +) + +// Defines values for UpdatePostgresConfigBodySessionReplicationRole. +const ( + UpdatePostgresConfigBodySessionReplicationRoleLocal UpdatePostgresConfigBodySessionReplicationRole = "local" + UpdatePostgresConfigBodySessionReplicationRoleOrigin UpdatePostgresConfigBodySessionReplicationRole = "origin" + UpdatePostgresConfigBodySessionReplicationRoleReplica UpdatePostgresConfigBodySessionReplicationRole = "replica" +) + // Defines values for VanitySubdomainConfigResponseStatus. const ( Active VanitySubdomainConfigResponseStatus = "active" @@ -150,11 +171,36 @@ const ( NotUsed VanitySubdomainConfigResponseStatus = "not-used" ) +// Defines values for AuthorizeParamsResponseType. +const ( + Code AuthorizeParamsResponseType = "code" + IdTokenToken AuthorizeParamsResponseType = "id_token token" + Token AuthorizeParamsResponseType = "token" +) + +// Defines values for AuthorizeParamsCodeChallengeMethod. +const ( + Plain AuthorizeParamsCodeChallengeMethod = "plain" + Sha256 AuthorizeParamsCodeChallengeMethod = "sha256" +) + +// Defines values for TokenParamsGrantType. +const ( + AuthorizationCode TokenParamsGrantType = "authorization_code" + RefreshToken TokenParamsGrantType = "refresh_token" +) + // ActivateVanitySubdomainResponse defines model for ActivateVanitySubdomainResponse. type ActivateVanitySubdomainResponse struct { CustomDomain string `json:"custom_domain"` } +// ApiKeyResponse defines model for ApiKeyResponse. +type ApiKeyResponse struct { + ApiKey string `json:"api_key"` + Name string `json:"name"` +} + // AttributeMapping defines model for AttributeMapping. type AttributeMapping struct { Keys map[string]AttributeValue `json:"keys"` @@ -184,6 +230,11 @@ type AttributeValue_Default struct { union json.RawMessage } +// AuthorizationsApproveBody defines model for AuthorizationsApproveBody. +type AuthorizationsApproveBody struct { + OrganizationId string `json:"organization_id"` +} + // CreateFunctionBody defines model for CreateFunctionBody. type CreateFunctionBody struct { Body string `json:"body"` @@ -199,18 +250,27 @@ type CreateOrganizationBody struct { // CreateProjectBody defines model for CreateProjectBody. type CreateProjectBody struct { - DbPass string `json:"db_pass"` - KpsEnabled *bool `json:"kps_enabled,omitempty"` - Name string `json:"name"` - OrganizationId string `json:"organization_id"` - Plan CreateProjectBodyPlan `json:"plan"` - Region CreateProjectBodyRegion `json:"region"` + // DbPass Database password + DbPass string `json:"db_pass"` + KpsEnabled *bool `json:"kps_enabled,omitempty"` + + // Name Name of your project, should not contain dots + Name string `json:"name"` + + // OrganizationId Slug of your organization + OrganizationId string `json:"organization_id"` + + // Plan Subscription plan + Plan CreateProjectBodyPlan `json:"plan"` + + // Region Region you want your server to reside in + Region CreateProjectBodyRegion `json:"region"` } -// CreateProjectBodyPlan defines model for CreateProjectBody.Plan. +// CreateProjectBodyPlan Subscription plan type CreateProjectBodyPlan string -// CreateProjectBodyRegion defines model for CreateProjectBody.Region. +// CreateProjectBodyRegion Region you want your server to reside in type CreateProjectBodyRegion string // CreateProviderBody defines model for CreateProviderBody. @@ -244,7 +304,10 @@ type CreateSecretBody struct { // DatabaseResponse defines model for DatabaseResponse. type DatabaseResponse struct { - Host string `json:"host"` + // Host Database host + Host string `json:"host"` + + // Version Database version Version string `json:"version"` } @@ -369,6 +432,24 @@ type PgsodiumConfigResponse struct { RootKey string `json:"root_key"` } +// PostgresConfigResponse defines model for PostgresConfigResponse. +type PostgresConfigResponse struct { + EffectiveCacheSize int `json:"effective_cache_size"` + MaintenanceWorkMem int `json:"maintenance_work_mem"` + MaxConnections int `json:"max_connections"` + MaxParallelMaintenanceWorkers int `json:"max_parallel_maintenance_workers"` + MaxParallelWorkers int `json:"max_parallel_workers"` + MaxParallelWorkersPerGather int `json:"max_parallel_workers_per_gather"` + MaxWorkerProcesses int `json:"max_worker_processes"` + SessionReplicationRole PostgresConfigResponseSessionReplicationRole `json:"session_replication_role"` + SharedBuffers int `json:"shared_buffers"` + StatementTimeout int `json:"statement_timeout"` + WorkMem int `json:"work_mem"` +} + +// PostgresConfigResponseSessionReplicationRole defines model for PostgresConfigResponse.SessionReplicationRole. +type PostgresConfigResponseSessionReplicationRole string + // PostgrestConfigResponse defines model for PostgrestConfigResponse. type PostgrestConfigResponse struct { DbExtraSearchPath string `json:"db_extra_search_path"` @@ -376,14 +457,54 @@ type PostgrestConfigResponse struct { MaxRows int `json:"max_rows"` } +// PostgrestConfigWithJWTSecretResponse defines model for PostgrestConfigWithJWTSecretResponse. +type PostgrestConfigWithJWTSecretResponse struct { + DbExtraSearchPath string `json:"db_extra_search_path"` + DbSchema string `json:"db_schema"` + JwtSecret *string `json:"jwt_secret,omitempty"` + MaxRows int `json:"max_rows"` +} + +// ProjectPgBouncerConfig defines model for ProjectPgBouncerConfig. +type ProjectPgBouncerConfig struct { + DbDnsName string `json:"db_dns_name"` + DbHost string `json:"db_host"` + DbName string `json:"db_name"` + DbPort float32 `json:"db_port"` + DbSsl bool `json:"db_ssl"` + DbUser string `json:"db_user"` + DefaultPoolSize float32 `json:"default_pool_size"` + IgnoreStartupParameters string `json:"ignore_startup_parameters"` + InsertedAt string `json:"inserted_at"` + MaxClientConn *float32 `json:"max_client_conn"` + PgbouncerEnabled bool `json:"pgbouncer_enabled"` + PgbouncerStatus ProjectPgBouncerConfigPgbouncerStatus `json:"pgbouncer_status"` + PoolMode ProjectPgBouncerConfigPoolMode `json:"pool_mode"` +} + +// ProjectPgBouncerConfigPgbouncerStatus defines model for ProjectPgBouncerConfig.PgbouncerStatus. +type ProjectPgBouncerConfigPgbouncerStatus string + +// ProjectPgBouncerConfigPoolMode defines model for ProjectPgBouncerConfig.PoolMode. +type ProjectPgBouncerConfigPoolMode string + // ProjectResponse defines model for ProjectResponse. type ProjectResponse struct { - CreatedAt string `json:"created_at"` - Database *DatabaseResponse `json:"database,omitempty"` - Id string `json:"id"` - Name string `json:"name"` - OrganizationId string `json:"organization_id"` - Region string `json:"region"` + // CreatedAt Creation timestamp + CreatedAt string `json:"created_at"` + Database *DatabaseResponse `json:"database,omitempty"` + + // Id Id of your project + Id string `json:"id"` + + // Name Name of your project + Name string `json:"name"` + + // OrganizationId Slug of your organization + OrganizationId string `json:"organization_id"` + + // Region Region of your project + Region string `json:"region"` } // ProjectUpgradeEligibilityResponse defines model for ProjectUpgradeEligibilityResponse. @@ -486,11 +607,57 @@ type UpdateFunctionBody struct { VerifyJwt *bool `json:"verify_jwt,omitempty"` } +// UpdatePgbouncerConfigBody defines model for UpdatePgbouncerConfigBody. +type UpdatePgbouncerConfigBody struct { + DefaultPoolSize int `json:"default_pool_size"` + IgnoreStartupParameters string `json:"ignore_startup_parameters"` + MaxClientConn *int `json:"max_client_conn"` + PgbouncerEnabled bool `json:"pgbouncer_enabled"` + PoolMode UpdatePgbouncerConfigBodyPoolMode `json:"pool_mode"` +} + +// UpdatePgbouncerConfigBodyPoolMode defines model for UpdatePgbouncerConfigBody.PoolMode. +type UpdatePgbouncerConfigBodyPoolMode string + // UpdatePgsodiumConfigBody defines model for UpdatePgsodiumConfigBody. type UpdatePgsodiumConfigBody struct { RootKey string `json:"root_key"` } +// UpdatePoolingConfigResponse defines model for UpdatePoolingConfigResponse. +type UpdatePoolingConfigResponse struct { + DefaultPoolSize int `json:"default_pool_size"` + IgnoreStartupParameters string `json:"ignore_startup_parameters"` + MaxClientConn *int `json:"max_client_conn"` + PgbouncerEnabled bool `json:"pgbouncer_enabled"` + PgbouncerStatus UpdatePoolingConfigResponsePgbouncerStatus `json:"pgbouncer_status"` + PoolMode UpdatePoolingConfigResponsePoolMode `json:"pool_mode"` +} + +// UpdatePoolingConfigResponsePgbouncerStatus defines model for UpdatePoolingConfigResponse.PgbouncerStatus. +type UpdatePoolingConfigResponsePgbouncerStatus string + +// UpdatePoolingConfigResponsePoolMode defines model for UpdatePoolingConfigResponse.PoolMode. +type UpdatePoolingConfigResponsePoolMode string + +// UpdatePostgresConfigBody defines model for UpdatePostgresConfigBody. +type UpdatePostgresConfigBody struct { + EffectiveCacheSize int `json:"effective_cache_size"` + MaintenanceWorkMem int `json:"maintenance_work_mem"` + MaxConnections int `json:"max_connections"` + MaxParallelMaintenanceWorkers int `json:"max_parallel_maintenance_workers"` + MaxParallelWorkers int `json:"max_parallel_workers"` + MaxParallelWorkersPerGather int `json:"max_parallel_workers_per_gather"` + MaxWorkerProcesses int `json:"max_worker_processes"` + SessionReplicationRole UpdatePostgresConfigBodySessionReplicationRole `json:"session_replication_role"` + SharedBuffers int `json:"shared_buffers"` + StatementTimeout int `json:"statement_timeout"` + WorkMem int `json:"work_mem"` +} + +// UpdatePostgresConfigBodySessionReplicationRole defines model for UpdatePostgresConfigBody.SessionReplicationRole. +type UpdatePostgresConfigBodySessionReplicationRole string + // UpdatePostgrestConfigBody defines model for UpdatePostgrestConfigBody. type UpdatePostgrestConfigBody struct { DbExtraSearchPath *string `json:"db_extra_search_path,omitempty"` @@ -534,6 +701,38 @@ type VanitySubdomainConfigResponse struct { // VanitySubdomainConfigResponseStatus defines model for VanitySubdomainConfigResponse.Status. type VanitySubdomainConfigResponseStatus string +// AuthorizeParams defines parameters for Authorize. +type AuthorizeParams struct { + ClientId string `form:"client_id" json:"client_id"` + ResponseType AuthorizeParamsResponseType `form:"response_type" json:"response_type"` + RedirectUri string `form:"redirect_uri" json:"redirect_uri"` + Scope string `form:"scope" json:"scope"` + State *string `form:"state,omitempty" json:"state,omitempty"` + ResponseMode *string `form:"response_mode,omitempty" json:"response_mode,omitempty"` + CodeChallenge *string `form:"code_challenge,omitempty" json:"code_challenge,omitempty"` + CodeChallengeMethod *AuthorizeParamsCodeChallengeMethod `form:"code_challenge_method,omitempty" json:"code_challenge_method,omitempty"` +} + +// AuthorizeParamsResponseType defines parameters for Authorize. +type AuthorizeParamsResponseType string + +// AuthorizeParamsCodeChallengeMethod defines parameters for Authorize. +type AuthorizeParamsCodeChallengeMethod string + +// TokenParams defines parameters for Token. +type TokenParams struct { + GrantType TokenParamsGrantType `form:"grant_type" json:"grant_type"` + ClientId string `form:"client_id" json:"client_id"` + ClientSecret string `form:"client_secret" json:"client_secret"` + Code *string `form:"code,omitempty" json:"code,omitempty"` + CodeVerifier *string `form:"code_verifier,omitempty" json:"code_verifier,omitempty"` + RedirectUri string `form:"redirect_uri" json:"redirect_uri"` + RefreshToken *string `form:"refresh_token,omitempty" json:"refresh_token,omitempty"` +} + +// TokenParamsGrantType defines parameters for Token. +type TokenParamsGrantType string + // CreateFunctionParams defines parameters for CreateFunction. type CreateFunctionParams struct { Slug *string `form:"slug,omitempty" json:"slug,omitempty"` @@ -561,6 +760,9 @@ type GetTypescriptTypesParams struct { IncludedSchemas *string `form:"included_schemas,omitempty" json:"included_schemas,omitempty"` } +// ApproveAuthorizationRequestJSONRequestBody defines body for ApproveAuthorizationRequest for application/json ContentType. +type ApproveAuthorizationRequestJSONRequestBody = AuthorizationsApproveBody + // CreateOrganizationJSONRequestBody defines body for CreateOrganization for application/json ContentType. type CreateOrganizationJSONRequestBody = CreateOrganizationBody @@ -573,6 +775,12 @@ type CreateProviderForProjectJSONRequestBody = CreateProviderBody // UpdateProviderByIdJSONRequestBody defines body for UpdateProviderById for application/json ContentType. type UpdateProviderByIdJSONRequestBody = UpdateProviderBody +// UpdatePgbouncerConfigJSONRequestBody defines body for UpdatePgbouncerConfig for application/json ContentType. +type UpdatePgbouncerConfigJSONRequestBody = UpdatePgbouncerConfigBody + +// UpdateConfigJSONRequestBody defines body for UpdateConfig for application/json ContentType. +type UpdateConfigJSONRequestBody = UpdatePostgresConfigBody + // CreateCustomHostnameConfigJSONRequestBody defines body for CreateCustomHostnameConfig for application/json ContentType. type CreateCustomHostnameConfigJSONRequestBody = UpdateCustomHostnameBody @@ -588,8 +796,8 @@ type RemoveNetworkBanJSONRequestBody = RemoveNetworkBanRequest // ApplyNetworkRestrictionsJSONRequestBody defines body for ApplyNetworkRestrictions for application/json ContentType. type ApplyNetworkRestrictionsJSONRequestBody = NetworkRestrictionsRequest -// UpdateConfigJSONRequestBody defines body for UpdateConfig for application/json ContentType. -type UpdateConfigJSONRequestBody = UpdatePgsodiumConfigBody +// UpdatePgsodiumConfigJSONRequestBody defines body for UpdatePgsodiumConfig for application/json ContentType. +type UpdatePgsodiumConfigJSONRequestBody = UpdatePgsodiumConfigBody // UpdatePostgRESTConfigJSONRequestBody defines body for UpdatePostgRESTConfig for application/json ContentType. type UpdatePostgRESTConfigJSONRequestBody = UpdatePostgrestConfigBody