diff --git a/apps/cli-go/pkg/api/client.gen.go b/apps/cli-go/pkg/api/client.gen.go index e1e9fa6ad..5de49ee89 100644 --- a/apps/cli-go/pkg/api/client.gen.go +++ b/apps/cli-go/pkg/api/client.gen.go @@ -449,6 +449,14 @@ type ClientInterface interface { V1CreateRestorePoint(ctx context.Context, ref string, body V1CreateRestorePointJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetBackupSchedule request + V1GetBackupSchedule(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1UpdateBackupScheduleWithBody request with any body + V1UpdateBackupScheduleWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + V1UpdateBackupSchedule(ctx context.Context, ref string, body V1UpdateBackupScheduleJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1UndoWithBody request with any body V1UndoWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -2241,6 +2249,42 @@ func (c *Client) V1CreateRestorePoint(ctx context.Context, ref string, body V1Cr return c.Client.Do(req) } +func (c *Client) V1GetBackupSchedule(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetBackupScheduleRequest(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) V1UpdateBackupScheduleWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1UpdateBackupScheduleRequestWithBody(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) V1UpdateBackupSchedule(ctx context.Context, ref string, body V1UpdateBackupScheduleJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1UpdateBackupScheduleRequest(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) V1UndoWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewV1UndoRequestWithBody(c.Server, ref, contentType, body) if err != nil { @@ -7961,6 +8005,87 @@ func NewV1CreateRestorePointRequestWithBody(server string, ref string, contentTy return req, nil } +// NewV1GetBackupScheduleRequest generates requests for V1GetBackupSchedule +func NewV1GetBackupScheduleRequest(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/backups/schedule", 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 +} + +// NewV1UpdateBackupScheduleRequest calls the generic V1UpdateBackupSchedule builder with application/json body +func NewV1UpdateBackupScheduleRequest(server string, ref string, body V1UpdateBackupScheduleJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewV1UpdateBackupScheduleRequestWithBody(server, ref, "application/json", bodyReader) +} + +// NewV1UpdateBackupScheduleRequestWithBody generates requests for V1UpdateBackupSchedule with any type of body +func NewV1UpdateBackupScheduleRequestWithBody(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/database/backups/schedule", 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 +} + // NewV1UndoRequest calls the generic V1Undo builder with application/json body func NewV1UndoRequest(server string, ref string, body V1UndoJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader @@ -11395,6 +11520,14 @@ type ClientWithResponsesInterface interface { V1CreateRestorePointWithResponse(ctx context.Context, ref string, body V1CreateRestorePointJSONRequestBody, reqEditors ...RequestEditorFn) (*V1CreateRestorePointResponse, error) + // V1GetBackupScheduleWithResponse request + V1GetBackupScheduleWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetBackupScheduleResponse, error) + + // V1UpdateBackupScheduleWithBodyWithResponse request with any body + V1UpdateBackupScheduleWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1UpdateBackupScheduleResponse, error) + + V1UpdateBackupScheduleWithResponse(ctx context.Context, ref string, body V1UpdateBackupScheduleJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UpdateBackupScheduleResponse, error) + // V1UndoWithBodyWithResponse request with any body V1UndoWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1UndoResponse, error) @@ -13797,6 +13930,50 @@ func (r V1CreateRestorePointResponse) StatusCode() int { return 0 } +type V1GetBackupScheduleResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *V1BackupScheduleResponse +} + +// Status returns HTTPResponse.Status +func (r V1GetBackupScheduleResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1GetBackupScheduleResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1UpdateBackupScheduleResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *V1BackupScheduleResponse +} + +// Status returns HTTPResponse.Status +func (r V1UpdateBackupScheduleResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1UpdateBackupScheduleResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type V1UndoResponse struct { Body []byte HTTPResponse *http.Response @@ -16296,6 +16473,32 @@ func (c *ClientWithResponses) V1CreateRestorePointWithResponse(ctx context.Conte return ParseV1CreateRestorePointResponse(rsp) } +// V1GetBackupScheduleWithResponse request returning *V1GetBackupScheduleResponse +func (c *ClientWithResponses) V1GetBackupScheduleWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetBackupScheduleResponse, error) { + rsp, err := c.V1GetBackupSchedule(ctx, ref, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1GetBackupScheduleResponse(rsp) +} + +// V1UpdateBackupScheduleWithBodyWithResponse request with arbitrary body returning *V1UpdateBackupScheduleResponse +func (c *ClientWithResponses) V1UpdateBackupScheduleWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1UpdateBackupScheduleResponse, error) { + rsp, err := c.V1UpdateBackupScheduleWithBody(ctx, ref, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1UpdateBackupScheduleResponse(rsp) +} + +func (c *ClientWithResponses) V1UpdateBackupScheduleWithResponse(ctx context.Context, ref string, body V1UpdateBackupScheduleJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UpdateBackupScheduleResponse, error) { + rsp, err := c.V1UpdateBackupSchedule(ctx, ref, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1UpdateBackupScheduleResponse(rsp) +} + // V1UndoWithBodyWithResponse request with arbitrary body returning *V1UndoResponse func (c *ClientWithResponses) V1UndoWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1UndoResponse, error) { rsp, err := c.V1UndoWithBody(ctx, ref, contentType, body, reqEditors...) @@ -19465,6 +19668,58 @@ func ParseV1CreateRestorePointResponse(rsp *http.Response) (*V1CreateRestorePoin return response, nil } +// ParseV1GetBackupScheduleResponse parses an HTTP response from a V1GetBackupScheduleWithResponse call +func ParseV1GetBackupScheduleResponse(rsp *http.Response) (*V1GetBackupScheduleResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1GetBackupScheduleResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest V1BackupScheduleResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseV1UpdateBackupScheduleResponse parses an HTTP response from a V1UpdateBackupScheduleWithResponse call +func ParseV1UpdateBackupScheduleResponse(rsp *http.Response) (*V1UpdateBackupScheduleResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1UpdateBackupScheduleResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest V1BackupScheduleResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + // ParseV1UndoResponse parses an HTTP response from a V1UndoWithResponse call func ParseV1UndoResponse(rsp *http.Response) (*V1UndoResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) diff --git a/apps/cli-go/pkg/api/types.gen.go b/apps/cli-go/pkg/api/types.gen.go index c597c94f0..b9e379fd2 100644 --- a/apps/cli-go/pkg/api/types.gen.go +++ b/apps/cli-go/pkg/api/types.gen.go @@ -5,6 +5,7 @@ package api import ( "encoding/json" + "errors" "fmt" "time" @@ -913,6 +914,11 @@ const ( X86Architecture ProjectUpgradeEligibilityResponseValidationErrors8Type = "x86_architecture" ) +// Defines values for ProjectUpgradeEligibilityResponseWarnings0Type. +const ( + PgGraphqlIntrospectionChange ProjectUpgradeEligibilityResponseWarnings0Type = "pg_graphql_introspection_change" +) + // Defines values for RegionsInfoAllSmartGroupCode. const ( RegionsInfoAllSmartGroupCodeAmericas RegionsInfoAllSmartGroupCode = "americas" @@ -1411,6 +1417,7 @@ const ( V1ListEntitlementsResponseEntitlementsFeatureKeyAuthUserSessions V1ListEntitlementsResponseEntitlementsFeatureKey = "auth.user_sessions" V1ListEntitlementsResponseEntitlementsFeatureKeyBackupRestoreToNewProject V1ListEntitlementsResponseEntitlementsFeatureKey = "backup.restore_to_new_project" V1ListEntitlementsResponseEntitlementsFeatureKeyBackupRetentionDays V1ListEntitlementsResponseEntitlementsFeatureKey = "backup.retention_days" + V1ListEntitlementsResponseEntitlementsFeatureKeyBackupSchedule V1ListEntitlementsResponseEntitlementsFeatureKey = "backup.schedule" V1ListEntitlementsResponseEntitlementsFeatureKeyBranchingLimit V1ListEntitlementsResponseEntitlementsFeatureKey = "branching_limit" V1ListEntitlementsResponseEntitlementsFeatureKeyBranchingPersistent V1ListEntitlementsResponseEntitlementsFeatureKey = "branching_persistent" V1ListEntitlementsResponseEntitlementsFeatureKeyCustomDomain V1ListEntitlementsResponseEntitlementsFeatureKey = "custom_domain" @@ -3394,6 +3401,7 @@ type ProjectUpgradeEligibilityResponse struct { // Deprecated: UserDefinedObjectsInInternalSchemas []string `json:"user_defined_objects_in_internal_schemas"` ValidationErrors []ProjectUpgradeEligibilityResponse_ValidationErrors_Item `json:"validation_errors"` + Warnings []ProjectUpgradeEligibilityResponse_Warnings_Item `json:"warnings"` } // ProjectUpgradeEligibilityResponseCurrentAppVersionReleaseChannel defines model for ProjectUpgradeEligibilityResponse.CurrentAppVersionReleaseChannel. @@ -3502,6 +3510,19 @@ type ProjectUpgradeEligibilityResponse_ValidationErrors_Item struct { union json.RawMessage } +// ProjectUpgradeEligibilityResponseWarnings0 defines model for . +type ProjectUpgradeEligibilityResponseWarnings0 struct { + Type ProjectUpgradeEligibilityResponseWarnings0Type `json:"type"` +} + +// ProjectUpgradeEligibilityResponseWarnings0Type defines model for ProjectUpgradeEligibilityResponse.Warnings.0.Type. +type ProjectUpgradeEligibilityResponseWarnings0Type string + +// ProjectUpgradeEligibilityResponse_Warnings_Item defines model for ProjectUpgradeEligibilityResponse.warnings.Item. +type ProjectUpgradeEligibilityResponse_Warnings_Item struct { + union json.RawMessage +} + // ProjectUpgradeInitiateResponse defines model for ProjectUpgradeInitiateResponse. type ProjectUpgradeInitiateResponse struct { TrackingId string `json:"tracking_id"` @@ -4417,6 +4438,15 @@ type UpgradeDatabaseBody struct { // UpgradeDatabaseBodyReleaseChannel defines model for UpgradeDatabaseBody.ReleaseChannel. type UpgradeDatabaseBodyReleaseChannel string +// V1BackupScheduleResponse defines model for V1BackupScheduleResponse. +type V1BackupScheduleResponse struct { + // ScheduleFor Time of day to schedule daily backups, in UTC. Format: HH:MM:SS. + ScheduleFor string `json:"schedule_for"` + + // UpdatedAt Timestamp of when the backup schedule was last updated. + UpdatedAt time.Time `json:"updated_at"` +} + // V1BackupsResponse defines model for V1BackupsResponse. type V1BackupsResponse struct { Backups []struct { @@ -4941,6 +4971,12 @@ type V1UndoBody struct { Name string `json:"name"` } +// V1UpdateBackupScheduleBody defines model for V1UpdateBackupScheduleBody. +type V1UpdateBackupScheduleBody struct { + // ScheduleFor Time of day to schedule daily backups, in UTC. Format: HH:MM:SS. + ScheduleFor string `json:"schedule_for"` +} + // V1UpdateFunctionBody defines model for V1UpdateFunctionBody. type V1UpdateFunctionBody struct { Body *string `json:"body,omitempty"` @@ -5379,6 +5415,9 @@ type V1RestorePitrBackupJSONRequestBody = V1RestorePitrBody // V1CreateRestorePointJSONRequestBody defines body for V1CreateRestorePoint for application/json ContentType. type V1CreateRestorePointJSONRequestBody = V1RestorePointPostBody +// V1UpdateBackupScheduleJSONRequestBody defines body for V1UpdateBackupSchedule for application/json ContentType. +type V1UpdateBackupScheduleJSONRequestBody = V1UpdateBackupScheduleBody + // V1UndoJSONRequestBody defines body for V1Undo for application/json ContentType. type V1UndoJSONRequestBody = V1UndoBody @@ -6709,6 +6748,65 @@ func (t *ProjectUpgradeEligibilityResponse_ValidationErrors_Item) UnmarshalJSON( return err } +// AsProjectUpgradeEligibilityResponseWarnings0 returns the union data inside the ProjectUpgradeEligibilityResponse_Warnings_Item as a ProjectUpgradeEligibilityResponseWarnings0 +func (t ProjectUpgradeEligibilityResponse_Warnings_Item) AsProjectUpgradeEligibilityResponseWarnings0() (ProjectUpgradeEligibilityResponseWarnings0, error) { + var body ProjectUpgradeEligibilityResponseWarnings0 + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromProjectUpgradeEligibilityResponseWarnings0 overwrites any union data inside the ProjectUpgradeEligibilityResponse_Warnings_Item as the provided ProjectUpgradeEligibilityResponseWarnings0 +func (t *ProjectUpgradeEligibilityResponse_Warnings_Item) FromProjectUpgradeEligibilityResponseWarnings0(v ProjectUpgradeEligibilityResponseWarnings0) error { + v.Type = "" + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeProjectUpgradeEligibilityResponseWarnings0 performs a merge with any union data inside the ProjectUpgradeEligibilityResponse_Warnings_Item, using the provided ProjectUpgradeEligibilityResponseWarnings0 +func (t *ProjectUpgradeEligibilityResponse_Warnings_Item) MergeProjectUpgradeEligibilityResponseWarnings0(v ProjectUpgradeEligibilityResponseWarnings0) error { + v.Type = "" + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +func (t ProjectUpgradeEligibilityResponse_Warnings_Item) Discriminator() (string, error) { + var discriminator struct { + Discriminator string `json:"type"` + } + err := json.Unmarshal(t.union, &discriminator) + return discriminator.Discriminator, err +} + +func (t ProjectUpgradeEligibilityResponse_Warnings_Item) ValueByDiscriminator() (interface{}, error) { + discriminator, err := t.Discriminator() + if err != nil { + return nil, err + } + switch discriminator { + case "": + return t.AsProjectUpgradeEligibilityResponseWarnings0() + default: + return nil, errors.New("unknown discriminator value: " + discriminator) + } +} + +func (t ProjectUpgradeEligibilityResponse_Warnings_Item) MarshalJSON() ([]byte, error) { + b, err := t.union.MarshalJSON() + return b, err +} + +func (t *ProjectUpgradeEligibilityResponse_Warnings_Item) UnmarshalJSON(b []byte) error { + err := t.union.UnmarshalJSON(b) + return err +} + // AsV1CreateProjectBodyRegionSelection0 returns the union data inside the V1CreateProjectBody_RegionSelection as a V1CreateProjectBodyRegionSelection0 func (t V1CreateProjectBody_RegionSelection) AsV1CreateProjectBodyRegionSelection0() (V1CreateProjectBodyRegionSelection0, error) { var body V1CreateProjectBodyRegionSelection0