From 881d3a9551c743ba83db06419e6754ee9e6cd628 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Fri, 7 Feb 2025 19:01:13 +0800 Subject: [PATCH] chore: bump openapi spec for function deploy --- api/beta.yaml | 174 +++++++++++++++++++++++------- pkg/api/client.gen.go | 242 +++++++++++++++++++++++++++++++++++++++++ pkg/api/types.gen.go | 246 ++++++++++++++++++++++++++++++++---------- 3 files changed, 566 insertions(+), 96 deletions(-) diff --git a/api/beta.yaml b/api/beta.yaml index 5163460d67..a2531eb821 100644 --- a/api/beta.yaml +++ b/api/beta.yaml @@ -2220,6 +2220,34 @@ paths: - Database security: - bearer: [] + /v1/projects/{ref}/database/context: + get: + operationId: getDatabaseMetadata + summary: Gets database metadata for the given project. + description: >- + This is an **experimental** endpoint. It is subject to change or removal + in future versions. Use it with caution, as it may not remain supported + or stable. + deprecated: true + parameters: + - name: ref + required: true + in: path + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/GetProjectDbMetadataResponseDto' + '403': + description: '' + tags: + - Database + security: + - bearer: [] /v1/projects/{ref}/functions: get: operationId: v1-list-all-functions @@ -2326,6 +2354,49 @@ paths: - Edge Functions security: - bearer: [] + /v1/projects/{ref}/functions/deploy: + post: + operationId: v1-deploy-a-function + summary: Deploy a function + description: >- + A new endpoint to deploy functions. It will create if function does not + exist. + parameters: + - name: ref + required: true + in: path + description: Project ref + schema: + minLength: 20 + maxLength: 20 + type: string + - name: slug + required: false + in: query + schema: + pattern: /^[A-Za-z0-9_-]+$/ + type: string + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/FunctionDeployBody' + responses: + '201': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/FunctionResponse' + '403': + description: '' + '500': + description: Failed to deploy function + tags: + - Edge Functions + security: + - bearer: [] /v1/projects/{ref}/functions/{function_slug}: get: operationId: v1-get-a-function @@ -3111,30 +3182,15 @@ components: description: Template URL used to create the project from the CLI. example: >- https://github.com/supabase/supabase/tree/master/examples/slack-clone/nextjs-slack-clone - release_channel: - type: string - enum: - - internal - - alpha - - beta - - ga - - withdrawn - - preview - description: Release channel. If not provided, GA will be used. - postgres_engine: - type: string - enum: - - '15' - - 17-oriole - description: >- - Postgres engine version. If not provided, the latest version will be - used. required: - db_pass - name - organization_id - region additionalProperties: false + hideDefinitions: + - release_channel + - postgres_engine V1ProjectResponse: type: object properties: @@ -5469,6 +5525,7 @@ components: - '13' - '14' - '15' + - '17' - 17-oriole required: - version @@ -5485,27 +5542,10 @@ components: - available_versions RestoreProjectBodyDto: type: object - properties: - release_channel: - type: string - enum: - - internal - - alpha - - beta - - ga - - withdrawn - - preview - description: >- - Release channel version. If not provided, GeneralAvailability will - be used. - postgres_engine: - type: string - enum: - - '15' - - 17-oriole - description: >- - Postgres engine version. If not provided, the latest version from - the given release channel will be used. + properties: {} + hideDefinitions: + - release_channel + - postgres_engine V1AnalyticsResponse: type: object properties: @@ -5544,6 +5584,32 @@ components: type: string required: - query + GetProjectDbMetadataResponseDto: + type: object + properties: + databases: + type: array + items: + type: object + properties: + name: + type: string + schemas: + type: array + items: + type: object + properties: + name: + type: string + required: + - name + additionalProperties: true + required: + - name + - schemas + additionalProperties: true + required: + - databases FunctionResponse: type: object properties: @@ -5605,6 +5671,36 @@ components: - slug - name - body + FunctionMetadata: + type: object + properties: + entrypoint_path: + type: string + import_map_path: + type: string + static_patterns: + type: array + items: + type: string + verify_jwt: + type: boolean + name: + type: string + required: + - entrypoint_path + FunctionDeployBody: + type: object + properties: + file: + type: array + items: + type: string + format: binary + metadata: + $ref: '#/components/schemas/FunctionMetadata' + required: + - file + - metadata FunctionSlugResponse: type: object properties: diff --git a/pkg/api/client.gen.go b/pkg/api/client.gen.go index 8a5b498d49..aa50e65e4f 100644 --- a/pkg/api/client.gen.go +++ b/pkg/api/client.gen.go @@ -274,6 +274,9 @@ type ClientInterface interface { V1RestorePitrBackup(ctx context.Context, ref string, body V1RestorePitrBackupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetDatabaseMetadata request + GetDatabaseMetadata(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1RunAQueryWithBody request with any body V1RunAQueryWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -290,6 +293,9 @@ type ClientInterface interface { V1CreateAFunction(ctx context.Context, ref string, params *V1CreateAFunctionParams, body V1CreateAFunctionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1DeployAFunctionWithBody request with any body + V1DeployAFunctionWithBody(ctx context.Context, ref string, params *V1DeployAFunctionParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1DeleteAFunction request V1DeleteAFunction(ctx context.Context, ref string, functionSlug string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1234,6 +1240,18 @@ func (c *Client) V1RestorePitrBackup(ctx context.Context, ref string, body V1Res return c.Client.Do(req) } +func (c *Client) GetDatabaseMetadata(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetDatabaseMetadataRequest(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) V1RunAQueryWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewV1RunAQueryRequestWithBody(c.Server, ref, contentType, body) if err != nil { @@ -1306,6 +1324,18 @@ func (c *Client) V1CreateAFunction(ctx context.Context, ref string, params *V1Cr return c.Client.Do(req) } +func (c *Client) V1DeployAFunctionWithBody(ctx context.Context, ref string, params *V1DeployAFunctionParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1DeployAFunctionRequestWithBody(c.Server, ref, params, 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) V1DeleteAFunction(ctx context.Context, ref string, functionSlug string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewV1DeleteAFunctionRequest(c.Server, ref, functionSlug) if err != nil { @@ -4112,6 +4142,40 @@ func NewV1RestorePitrBackupRequestWithBody(server string, ref string, contentTyp return req, nil } +// NewGetDatabaseMetadataRequest generates requests for GetDatabaseMetadata +func NewGetDatabaseMetadataRequest(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/database/context", 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 +} + // NewV1RunAQueryRequest calls the generic V1RunAQuery builder with application/json body func NewV1RunAQueryRequest(server string, ref string, body V1RunAQueryJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader @@ -4392,6 +4456,64 @@ func NewV1CreateAFunctionRequestWithBody(server string, ref string, params *V1Cr return req, nil } +// NewV1DeployAFunctionRequestWithBody generates requests for V1DeployAFunction with any type of body +func NewV1DeployAFunctionRequestWithBody(server string, ref string, params *V1DeployAFunctionParams, 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/functions/deploy", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if params.Slug != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "slug", runtime.ParamLocationQuery, *params.Slug); 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(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + // NewV1DeleteAFunctionRequest generates requests for V1DeleteAFunction func NewV1DeleteAFunctionRequest(server string, ref string, functionSlug string) (*http.Request, error) { var err error @@ -6362,6 +6484,9 @@ type ClientWithResponsesInterface interface { V1RestorePitrBackupWithResponse(ctx context.Context, ref string, body V1RestorePitrBackupJSONRequestBody, reqEditors ...RequestEditorFn) (*V1RestorePitrBackupResponse, error) + // GetDatabaseMetadataWithResponse request + GetDatabaseMetadataWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetDatabaseMetadataResponse, error) + // V1RunAQueryWithBodyWithResponse request with any body V1RunAQueryWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1RunAQueryResponse, error) @@ -6378,6 +6503,9 @@ type ClientWithResponsesInterface interface { V1CreateAFunctionWithResponse(ctx context.Context, ref string, params *V1CreateAFunctionParams, body V1CreateAFunctionJSONRequestBody, reqEditors ...RequestEditorFn) (*V1CreateAFunctionResponse, error) + // V1DeployAFunctionWithBodyWithResponse request with any body + V1DeployAFunctionWithBodyWithResponse(ctx context.Context, ref string, params *V1DeployAFunctionParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1DeployAFunctionResponse, error) + // V1DeleteAFunctionWithResponse request V1DeleteAFunctionWithResponse(ctx context.Context, ref string, functionSlug string, reqEditors ...RequestEditorFn) (*V1DeleteAFunctionResponse, error) @@ -7612,6 +7740,28 @@ func (r V1RestorePitrBackupResponse) StatusCode() int { return 0 } +type GetDatabaseMetadataResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *GetProjectDbMetadataResponseDto +} + +// Status returns HTTPResponse.Status +func (r GetDatabaseMetadataResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetDatabaseMetadataResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type V1RunAQueryResponse struct { Body []byte HTTPResponse *http.Response @@ -7699,6 +7849,28 @@ func (r V1CreateAFunctionResponse) StatusCode() int { return 0 } +type V1DeployAFunctionResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *FunctionResponse +} + +// Status returns HTTPResponse.Status +func (r V1DeployAFunctionResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1DeployAFunctionResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type V1DeleteAFunctionResponse struct { Body []byte HTTPResponse *http.Response @@ -9088,6 +9260,15 @@ func (c *ClientWithResponses) V1RestorePitrBackupWithResponse(ctx context.Contex return ParseV1RestorePitrBackupResponse(rsp) } +// GetDatabaseMetadataWithResponse request returning *GetDatabaseMetadataResponse +func (c *ClientWithResponses) GetDatabaseMetadataWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetDatabaseMetadataResponse, error) { + rsp, err := c.GetDatabaseMetadata(ctx, ref, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetDatabaseMetadataResponse(rsp) +} + // V1RunAQueryWithBodyWithResponse request with arbitrary body returning *V1RunAQueryResponse func (c *ClientWithResponses) V1RunAQueryWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1RunAQueryResponse, error) { rsp, err := c.V1RunAQueryWithBody(ctx, ref, contentType, body, reqEditors...) @@ -9140,6 +9321,15 @@ func (c *ClientWithResponses) V1CreateAFunctionWithResponse(ctx context.Context, return ParseV1CreateAFunctionResponse(rsp) } +// V1DeployAFunctionWithBodyWithResponse request with arbitrary body returning *V1DeployAFunctionResponse +func (c *ClientWithResponses) V1DeployAFunctionWithBodyWithResponse(ctx context.Context, ref string, params *V1DeployAFunctionParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1DeployAFunctionResponse, error) { + rsp, err := c.V1DeployAFunctionWithBody(ctx, ref, params, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1DeployAFunctionResponse(rsp) +} + // V1DeleteAFunctionWithResponse request returning *V1DeleteAFunctionResponse func (c *ClientWithResponses) V1DeleteAFunctionWithResponse(ctx context.Context, ref string, functionSlug string, reqEditors ...RequestEditorFn) (*V1DeleteAFunctionResponse, error) { rsp, err := c.V1DeleteAFunction(ctx, ref, functionSlug, reqEditors...) @@ -10825,6 +11015,32 @@ func ParseV1RestorePitrBackupResponse(rsp *http.Response) (*V1RestorePitrBackupR return response, nil } +// ParseGetDatabaseMetadataResponse parses an HTTP response from a GetDatabaseMetadataWithResponse call +func ParseGetDatabaseMetadataResponse(rsp *http.Response) (*GetDatabaseMetadataResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetDatabaseMetadataResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest GetProjectDbMetadataResponseDto + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + // ParseV1RunAQueryResponse parses an HTTP response from a V1RunAQueryWithResponse call func ParseV1RunAQueryResponse(rsp *http.Response) (*V1RunAQueryResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -10919,6 +11135,32 @@ func ParseV1CreateAFunctionResponse(rsp *http.Response) (*V1CreateAFunctionRespo return response, nil } +// ParseV1DeployAFunctionResponse parses an HTTP response from a V1DeployAFunctionWithResponse call +func ParseV1DeployAFunctionResponse(rsp *http.Response) (*V1DeployAFunctionResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1DeployAFunctionResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest FunctionResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON201 = &dest + + } + + return response, nil +} + // ParseV1DeleteAFunctionResponse parses an HTTP response from a V1DeleteAFunctionWithResponse call func ParseV1DeleteAFunctionResponse(rsp *http.Response) (*V1DeleteAFunctionResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) diff --git a/pkg/api/types.gen.go b/pkg/api/types.gen.go index 1bb326b916..10222cc590 100644 --- a/pkg/api/types.gen.go +++ b/pkg/api/types.gen.go @@ -5,6 +5,7 @@ package api import ( "encoding/json" + "fmt" "github.com/oapi-codegen/runtime" openapi_types "github.com/oapi-codegen/runtime/types" @@ -179,6 +180,7 @@ const ( ProjectAvailableRestoreVersionPostgresEngineN13 ProjectAvailableRestoreVersionPostgresEngine = "13" ProjectAvailableRestoreVersionPostgresEngineN14 ProjectAvailableRestoreVersionPostgresEngine = "14" ProjectAvailableRestoreVersionPostgresEngineN15 ProjectAvailableRestoreVersionPostgresEngine = "15" + ProjectAvailableRestoreVersionPostgresEngineN17 ProjectAvailableRestoreVersionPostgresEngine = "17" ProjectAvailableRestoreVersionPostgresEngineN17Oriole ProjectAvailableRestoreVersionPostgresEngine = "17-oriole" ) @@ -202,22 +204,6 @@ const ( ReleaseChannelWithdrawn ReleaseChannel = "withdrawn" ) -// Defines values for RestoreProjectBodyDtoPostgresEngine. -const ( - RestoreProjectBodyDtoPostgresEngineN15 RestoreProjectBodyDtoPostgresEngine = "15" - RestoreProjectBodyDtoPostgresEngineN17Oriole RestoreProjectBodyDtoPostgresEngine = "17-oriole" -) - -// Defines values for RestoreProjectBodyDtoReleaseChannel. -const ( - RestoreProjectBodyDtoReleaseChannelAlpha RestoreProjectBodyDtoReleaseChannel = "alpha" - RestoreProjectBodyDtoReleaseChannelBeta RestoreProjectBodyDtoReleaseChannel = "beta" - RestoreProjectBodyDtoReleaseChannelGa RestoreProjectBodyDtoReleaseChannel = "ga" - RestoreProjectBodyDtoReleaseChannelInternal RestoreProjectBodyDtoReleaseChannel = "internal" - RestoreProjectBodyDtoReleaseChannelPreview RestoreProjectBodyDtoReleaseChannel = "preview" - RestoreProjectBodyDtoReleaseChannelWithdrawn RestoreProjectBodyDtoReleaseChannel = "withdrawn" -) - // Defines values for SetUpReadReplicaBodyReadReplicaRegion. const ( SetUpReadReplicaBodyReadReplicaRegionApEast1 SetUpReadReplicaBodyReadReplicaRegion = "ap-east-1" @@ -354,12 +340,6 @@ const ( V1CreateProjectBodyDtoPlanPro V1CreateProjectBodyDtoPlan = "pro" ) -// Defines values for V1CreateProjectBodyDtoPostgresEngine. -const ( - V1CreateProjectBodyDtoPostgresEngineN15 V1CreateProjectBodyDtoPostgresEngine = "15" - V1CreateProjectBodyDtoPostgresEngineN17Oriole V1CreateProjectBodyDtoPostgresEngine = "17-oriole" -) - // Defines values for V1CreateProjectBodyDtoRegion. const ( V1CreateProjectBodyDtoRegionApEast1 V1CreateProjectBodyDtoRegion = "ap-east-1" @@ -382,16 +362,6 @@ const ( V1CreateProjectBodyDtoRegionUsWest2 V1CreateProjectBodyDtoRegion = "us-west-2" ) -// Defines values for V1CreateProjectBodyDtoReleaseChannel. -const ( - V1CreateProjectBodyDtoReleaseChannelAlpha V1CreateProjectBodyDtoReleaseChannel = "alpha" - V1CreateProjectBodyDtoReleaseChannelBeta V1CreateProjectBodyDtoReleaseChannel = "beta" - V1CreateProjectBodyDtoReleaseChannelGa V1CreateProjectBodyDtoReleaseChannel = "ga" - V1CreateProjectBodyDtoReleaseChannelInternal V1CreateProjectBodyDtoReleaseChannel = "internal" - V1CreateProjectBodyDtoReleaseChannelPreview V1CreateProjectBodyDtoReleaseChannel = "preview" - V1CreateProjectBodyDtoReleaseChannelWithdrawn V1CreateProjectBodyDtoReleaseChannel = "withdrawn" -) - // Defines values for V1OrganizationSlugResponseOptInTags. const ( AISQLGENERATOROPTIN V1OrganizationSlugResponseOptInTags = "AI_SQL_GENERATOR_OPT_IN" @@ -922,6 +892,21 @@ type Domain struct { UpdatedAt *string `json:"updated_at,omitempty"` } +// FunctionDeployBody defines model for FunctionDeployBody. +type FunctionDeployBody struct { + File []openapi_types.File `json:"file"` + Metadata FunctionMetadata `json:"metadata"` +} + +// FunctionMetadata defines model for FunctionMetadata. +type FunctionMetadata struct { + EntrypointPath string `json:"entrypoint_path"` + ImportMapPath *string `json:"import_map_path,omitempty"` + Name *string `json:"name,omitempty"` + StaticPatterns *[]string `json:"static_patterns,omitempty"` + VerifyJwt *bool `json:"verify_jwt,omitempty"` +} + // FunctionResponse defines model for FunctionResponse. type FunctionResponse struct { ComputeMultiplier *float32 `json:"compute_multiplier,omitempty"` @@ -965,6 +950,24 @@ type GetProjectAvailableRestoreVersionsResponse struct { AvailableVersions []ProjectAvailableRestoreVersion `json:"available_versions"` } +// GetProjectDbMetadataResponseDto defines model for GetProjectDbMetadataResponseDto. +type GetProjectDbMetadataResponseDto struct { + Databases []GetProjectDbMetadataResponseDto_Databases_Item `json:"databases"` +} + +// GetProjectDbMetadataResponseDto_Databases_Schemas_Item defines model for GetProjectDbMetadataResponseDto.Databases.Schemas.Item. +type GetProjectDbMetadataResponseDto_Databases_Schemas_Item struct { + Name string `json:"name"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// GetProjectDbMetadataResponseDto_Databases_Item defines model for GetProjectDbMetadataResponseDto.databases.Item. +type GetProjectDbMetadataResponseDto_Databases_Item struct { + Name string `json:"name"` + Schemas []GetProjectDbMetadataResponseDto_Databases_Schemas_Item `json:"schemas"` + AdditionalProperties map[string]interface{} `json:"-"` +} + // GetProviderResponse defines model for GetProviderResponse. type GetProviderResponse struct { CreatedAt *string `json:"created_at,omitempty"` @@ -1173,19 +1176,7 @@ type RemoveReadReplicaBody struct { } // RestoreProjectBodyDto defines model for RestoreProjectBodyDto. -type RestoreProjectBodyDto struct { - // PostgresEngine Postgres engine version. If not provided, the latest version from the given release channel will be used. - PostgresEngine *RestoreProjectBodyDtoPostgresEngine `json:"postgres_engine,omitempty"` - - // ReleaseChannel Release channel version. If not provided, GeneralAvailability will be used. - ReleaseChannel *RestoreProjectBodyDtoReleaseChannel `json:"release_channel,omitempty"` -} - -// RestoreProjectBodyDtoPostgresEngine Postgres engine version. If not provided, the latest version from the given release channel will be used. -type RestoreProjectBodyDtoPostgresEngine string - -// RestoreProjectBodyDtoReleaseChannel Release channel version. If not provided, GeneralAvailability will be used. -type RestoreProjectBodyDtoReleaseChannel string +type RestoreProjectBodyDto = map[string]interface{} // SamlDescriptor defines model for SamlDescriptor. type SamlDescriptor struct { @@ -1748,15 +1739,9 @@ type V1CreateProjectBodyDto struct { // Deprecated: Plan *V1CreateProjectBodyDtoPlan `json:"plan,omitempty"` - // PostgresEngine Postgres engine version. If not provided, the latest version will be used. - PostgresEngine *V1CreateProjectBodyDtoPostgresEngine `json:"postgres_engine,omitempty"` - // Region Region you want your server to reside in Region V1CreateProjectBodyDtoRegion `json:"region"` - // ReleaseChannel Release channel. If not provided, GA will be used. - ReleaseChannel *V1CreateProjectBodyDtoReleaseChannel `json:"release_channel,omitempty"` - // TemplateUrl Template URL used to create the project from the CLI. TemplateUrl *string `json:"template_url,omitempty"` } @@ -1767,15 +1752,9 @@ type V1CreateProjectBodyDtoDesiredInstanceSize string // V1CreateProjectBodyDtoPlan Subscription Plan is now set on organization level and is ignored in this request type V1CreateProjectBodyDtoPlan string -// V1CreateProjectBodyDtoPostgresEngine Postgres engine version. If not provided, the latest version will be used. -type V1CreateProjectBodyDtoPostgresEngine string - // V1CreateProjectBodyDtoRegion Region you want your server to reside in type V1CreateProjectBodyDtoRegion string -// V1CreateProjectBodyDtoReleaseChannel Release channel. If not provided, GA will be used. -type V1CreateProjectBodyDtoReleaseChannel string - // V1DatabaseResponse defines model for V1DatabaseResponse. type V1DatabaseResponse struct { // Host Database host @@ -2026,6 +2005,11 @@ type V1CreateAFunctionParams struct { ComputeMultiplier *float32 `form:"compute_multiplier,omitempty" json:"compute_multiplier,omitempty"` } +// V1DeployAFunctionParams defines parameters for V1DeployAFunction. +type V1DeployAFunctionParams struct { + Slug *string `form:"slug,omitempty" json:"slug,omitempty"` +} + // V1UpdateAFunctionParams defines parameters for V1UpdateAFunction. type V1UpdateAFunctionParams struct { Slug *string `form:"slug,omitempty" json:"slug,omitempty"` @@ -2134,6 +2118,9 @@ type V1RunAQueryJSONRequestBody = V1RunQueryBody // V1CreateAFunctionJSONRequestBody defines body for V1CreateAFunction for application/json ContentType. type V1CreateAFunctionJSONRequestBody = V1CreateFunctionBody +// V1DeployAFunctionMultipartRequestBody defines body for V1DeployAFunction for multipart/form-data ContentType. +type V1DeployAFunctionMultipartRequestBody = FunctionDeployBody + // V1UpdateAFunctionJSONRequestBody defines body for V1UpdateAFunction for application/json ContentType. type V1UpdateAFunctionJSONRequestBody = V1UpdateFunctionBody @@ -2176,6 +2163,151 @@ type V1ActivateVanitySubdomainConfigJSONRequestBody = VanitySubdomainBody // V1CheckVanitySubdomainAvailabilityJSONRequestBody defines body for V1CheckVanitySubdomainAvailability for application/json ContentType. type V1CheckVanitySubdomainAvailabilityJSONRequestBody = VanitySubdomainBody +// Getter for additional properties for GetProjectDbMetadataResponseDto_Databases_Schemas_Item. Returns the specified +// element and whether it was found +func (a GetProjectDbMetadataResponseDto_Databases_Schemas_Item) Get(fieldName string) (value interface{}, found bool) { + if a.AdditionalProperties != nil { + value, found = a.AdditionalProperties[fieldName] + } + return +} + +// Setter for additional properties for GetProjectDbMetadataResponseDto_Databases_Schemas_Item +func (a *GetProjectDbMetadataResponseDto_Databases_Schemas_Item) Set(fieldName string, value interface{}) { + if a.AdditionalProperties == nil { + a.AdditionalProperties = make(map[string]interface{}) + } + a.AdditionalProperties[fieldName] = value +} + +// Override default JSON handling for GetProjectDbMetadataResponseDto_Databases_Schemas_Item to handle AdditionalProperties +func (a *GetProjectDbMetadataResponseDto_Databases_Schemas_Item) UnmarshalJSON(b []byte) error { + object := make(map[string]json.RawMessage) + err := json.Unmarshal(b, &object) + if err != nil { + return err + } + + if raw, found := object["name"]; found { + err = json.Unmarshal(raw, &a.Name) + if err != nil { + return fmt.Errorf("error reading 'name': %w", err) + } + delete(object, "name") + } + + if len(object) != 0 { + a.AdditionalProperties = make(map[string]interface{}) + for fieldName, fieldBuf := range object { + var fieldVal interface{} + err := json.Unmarshal(fieldBuf, &fieldVal) + if err != nil { + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) + } + a.AdditionalProperties[fieldName] = fieldVal + } + } + return nil +} + +// Override default JSON handling for GetProjectDbMetadataResponseDto_Databases_Schemas_Item to handle AdditionalProperties +func (a GetProjectDbMetadataResponseDto_Databases_Schemas_Item) MarshalJSON() ([]byte, error) { + var err error + object := make(map[string]json.RawMessage) + + object["name"], err = json.Marshal(a.Name) + if err != nil { + return nil, fmt.Errorf("error marshaling 'name': %w", err) + } + + for fieldName, field := range a.AdditionalProperties { + object[fieldName], err = json.Marshal(field) + if err != nil { + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) + } + } + return json.Marshal(object) +} + +// Getter for additional properties for GetProjectDbMetadataResponseDto_Databases_Item. Returns the specified +// element and whether it was found +func (a GetProjectDbMetadataResponseDto_Databases_Item) Get(fieldName string) (value interface{}, found bool) { + if a.AdditionalProperties != nil { + value, found = a.AdditionalProperties[fieldName] + } + return +} + +// Setter for additional properties for GetProjectDbMetadataResponseDto_Databases_Item +func (a *GetProjectDbMetadataResponseDto_Databases_Item) Set(fieldName string, value interface{}) { + if a.AdditionalProperties == nil { + a.AdditionalProperties = make(map[string]interface{}) + } + a.AdditionalProperties[fieldName] = value +} + +// Override default JSON handling for GetProjectDbMetadataResponseDto_Databases_Item to handle AdditionalProperties +func (a *GetProjectDbMetadataResponseDto_Databases_Item) UnmarshalJSON(b []byte) error { + object := make(map[string]json.RawMessage) + err := json.Unmarshal(b, &object) + if err != nil { + return err + } + + if raw, found := object["name"]; found { + err = json.Unmarshal(raw, &a.Name) + if err != nil { + return fmt.Errorf("error reading 'name': %w", err) + } + delete(object, "name") + } + + if raw, found := object["schemas"]; found { + err = json.Unmarshal(raw, &a.Schemas) + if err != nil { + return fmt.Errorf("error reading 'schemas': %w", err) + } + delete(object, "schemas") + } + + if len(object) != 0 { + a.AdditionalProperties = make(map[string]interface{}) + for fieldName, fieldBuf := range object { + var fieldVal interface{} + err := json.Unmarshal(fieldBuf, &fieldVal) + if err != nil { + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) + } + a.AdditionalProperties[fieldName] = fieldVal + } + } + return nil +} + +// Override default JSON handling for GetProjectDbMetadataResponseDto_Databases_Item to handle AdditionalProperties +func (a GetProjectDbMetadataResponseDto_Databases_Item) MarshalJSON() ([]byte, error) { + var err error + object := make(map[string]json.RawMessage) + + object["name"], err = json.Marshal(a.Name) + if err != nil { + return nil, fmt.Errorf("error marshaling 'name': %w", err) + } + + object["schemas"], err = json.Marshal(a.Schemas) + if err != nil { + return nil, fmt.Errorf("error marshaling 'schemas': %w", err) + } + + for fieldName, field := range a.AdditionalProperties { + object[fieldName], err = json.Marshal(field) + if err != nil { + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) + } + } + return json.Marshal(object) +} + // AsAttributeValueDefault0 returns the union data inside the AttributeValue_Default as a AttributeValueDefault0 func (t AttributeValue_Default) AsAttributeValueDefault0() (AttributeValueDefault0, error) { var body AttributeValueDefault0