From db908d9a5d0afe6eafdf09c9c5d3661dcf97e849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0v=C3=A1b=C3=ADk?= Date: Mon, 16 Nov 2026 03:21:36 +0100 Subject: [PATCH 1/7] refactor(backup): Backup client regenerated with operation ids MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backup's API document now gives every route an id, so the generated client's methods are named after what they do (ListDatasources, ListBackupPolicies, AttachPolicy, SetDatasourceCredentials, ...) instead of their paths. The commands call the new names; nothing they do changes. Generated from backend-mono's snapdb ids change (23060630); merge after it reaches the backend's main branch, so codegen-check agrees. Signed-off-by: Jan Švábík --- internal/api/snapdb/snapdb.gen.go | 1072 +++++++++++------------ internal/cli/backup/backup.go | 4 +- internal/cli/backup/completion.go | 4 +- internal/cli/backup/datasource.go | 6 +- internal/cli/backup/datasource_write.go | 4 +- internal/cli/backup/health.go | 2 +- internal/cli/backup/interactive.go | 2 +- internal/cli/backup/policy.go | 2 +- internal/cli/backup/policydefs.go | 20 +- internal/cli/backup/restores.go | 10 +- specs/snapdb.openapi.json | 107 ++- 11 files changed, 668 insertions(+), 565 deletions(-) diff --git a/internal/api/snapdb/snapdb.gen.go b/internal/api/snapdb/snapdb.gen.go index 2da4354..1ff7cef 100644 --- a/internal/api/snapdb/snapdb.gen.go +++ b/internal/api/snapdb/snapdb.gen.go @@ -460,15 +460,15 @@ func (e ResponseType) Valid() bool { } } -// Defines values for GetStorageDestinationsParamsOwnership. +// Defines values for ListStorageDestinationsParamsOwnership. const ( - All GetStorageDestinationsParamsOwnership = "all" - Byo GetStorageDestinationsParamsOwnership = "byo" - Managed GetStorageDestinationsParamsOwnership = "managed" + All ListStorageDestinationsParamsOwnership = "all" + Byo ListStorageDestinationsParamsOwnership = "byo" + Managed ListStorageDestinationsParamsOwnership = "managed" ) -// Valid indicates whether the value is a known member of the GetStorageDestinationsParamsOwnership enum. -func (e GetStorageDestinationsParamsOwnership) Valid() bool { +// Valid indicates whether the value is a known member of the ListStorageDestinationsParamsOwnership enum. +func (e ListStorageDestinationsParamsOwnership) Valid() bool { switch e { case All: return true @@ -1289,15 +1289,15 @@ type ListAuditLogsParams struct { ActorIds *[]string `form:"actorIds,omitempty" json:"actorIds,omitempty"` } -// GetBackupsParams defines parameters for GetBackups. -type GetBackupsParams struct { +// ListBackupsParams defines parameters for ListBackups. +type ListBackupsParams struct { Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` DatasourceIDs *[]string `form:"datasourceIDs,omitempty" json:"datasourceIDs,omitempty"` Limit *int `form:"limit,omitempty" json:"limit,omitempty"` } -// ListParams defines parameters for List. -type ListParams struct { +// ListDatasourcesParams defines parameters for ListDatasources. +type ListDatasourcesParams struct { // Cursor Pagination cursor Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` @@ -1321,8 +1321,8 @@ type GetRestoreCheckHistoryParams struct { Limit *int `form:"limit,omitempty" json:"limit,omitempty"` } -// GetDatasourcesDatasourceIdRestoresParams defines parameters for GetDatasourcesDatasourceIdRestores. -type GetDatasourcesDatasourceIdRestoresParams struct { +// ListDatasourceRestoresParams defines parameters for ListDatasourceRestores. +type ListDatasourceRestoresParams struct { Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` Limit *int `form:"limit,omitempty" json:"limit,omitempty"` @@ -1331,29 +1331,29 @@ type GetDatasourcesDatasourceIdRestoresParams struct { Trigger *string `form:"trigger,omitempty" json:"trigger,omitempty"` } -// GetStorageDestinationsParams defines parameters for GetStorageDestinations. -type GetStorageDestinationsParams struct { +// ListStorageDestinationsParams defines parameters for ListStorageDestinations. +type ListStorageDestinationsParams struct { // Search Substring search across name, bucket, endpoint URL, and type Search *string `form:"search,omitempty" json:"search,omitempty"` // Ownership Filter by ownership: all | managed | byo - Ownership *GetStorageDestinationsParamsOwnership `form:"ownership,omitempty" json:"ownership,omitempty"` + Ownership *ListStorageDestinationsParamsOwnership `form:"ownership,omitempty" json:"ownership,omitempty"` // UnverifiedOnly Only return BYO rows with NULL last_verified_at UnverifiedOnly *bool `form:"unverifiedOnly,omitempty" json:"unverifiedOnly,omitempty"` } -// GetStorageDestinationsParamsOwnership defines parameters for GetStorageDestinations. -type GetStorageDestinationsParamsOwnership string +// ListStorageDestinationsParamsOwnership defines parameters for ListStorageDestinations. +type ListStorageDestinationsParamsOwnership string -// PostBackupPoliciesJSONRequestBody defines body for PostBackupPolicies for application/json ContentType. -type PostBackupPoliciesJSONRequestBody = PolicyhandlerPayloadCreateRequest +// CreateBackupPolicyJSONRequestBody defines body for CreateBackupPolicy for application/json ContentType. +type CreateBackupPolicyJSONRequestBody = PolicyhandlerPayloadCreateRequest -// PatchBackupPoliciesIdJSONRequestBody defines body for PatchBackupPoliciesId for application/json ContentType. -type PatchBackupPoliciesIdJSONRequestBody = PolicyhandlerPayloadUpdateRequest +// UpdateBackupPolicyJSONRequestBody defines body for UpdateBackupPolicy for application/json ContentType. +type UpdateBackupPolicyJSONRequestBody = PolicyhandlerPayloadUpdateRequest -// PostDatasourcesJSONRequestBody defines body for PostDatasources for application/json ContentType. -type PostDatasourcesJSONRequestBody = DatasourcehandlerPayloadCreateRequest +// CreateDatasourceJSONRequestBody defines body for CreateDatasource for application/json ContentType. +type CreateDatasourceJSONRequestBody = DatasourcehandlerPayloadCreateRequest // ProtectDatasourceJSONRequestBody defines body for ProtectDatasource for application/json ContentType. type ProtectDatasourceJSONRequestBody = DatasourcehandlerPayloadProtectRequest @@ -1361,8 +1361,8 @@ type ProtectDatasourceJSONRequestBody = DatasourcehandlerPayloadProtectRequest // RunBackupNowJSONRequestBody defines body for RunBackupNow for application/json ContentType. type RunBackupNowJSONRequestBody = DatasourcehandlerPayloadRunBackupNowRequest -// PostDatasourcesDatasourceIdPoliciesJSONRequestBody defines body for PostDatasourcesDatasourceIdPolicies for application/json ContentType. -type PostDatasourcesDatasourceIdPoliciesJSONRequestBody = DatasourcehandlerPayloadDataSourcePolicyAttachRequest +// AttachPolicyJSONRequestBody defines body for AttachPolicy for application/json ContentType. +type AttachPolicyJSONRequestBody = DatasourcehandlerPayloadDataSourcePolicyAttachRequest // UpdatePolicyAttachmentJSONRequestBody defines body for UpdatePolicyAttachment for application/json ContentType. type UpdatePolicyAttachmentJSONRequestBody = DatasourcehandlerPayloadDatasourcePolicyUpdateRequest @@ -1373,8 +1373,8 @@ type DeleteDatasourceJSONRequestBody = DatasourcehandlerDeleteDatasourcePayload // UpdateDataSourceJSONRequestBody defines body for UpdateDataSource for application/json ContentType. type UpdateDataSourceJSONRequestBody = DatasourcehandlerPayloadDatasourceUpdateRequest -// PutDatasourcesIdCredentialsJSONRequestBody defines body for PutDatasourcesIdCredentials for application/json ContentType. -type PutDatasourcesIdCredentialsJSONRequestBody = DatasourcehandlerPayloadSetCredentialsRequest +// SetDatasourceCredentialsJSONRequestBody defines body for SetDatasourceCredentials for application/json ContentType. +type SetDatasourceCredentialsJSONRequestBody = DatasourcehandlerPayloadSetCredentialsRequest // PutRestoreCheckJSONRequestBody defines body for PutRestoreCheck for application/json ContentType. type PutRestoreCheckJSONRequestBody = DatasourcehandlerPayloadRestoreCheckRequest @@ -1382,20 +1382,20 @@ type PutRestoreCheckJSONRequestBody = DatasourcehandlerPayloadRestoreCheckReques // PutNotificationSettingsJSONRequestBody defines body for PutNotificationSettings for application/json ContentType. type PutNotificationSettingsJSONRequestBody = NotificationhandlerPayloadNotificationSettingsRequest -// PostRestoresJSONRequestBody defines body for PostRestores for application/json ContentType. -type PostRestoresJSONRequestBody = RestorehandlerPayloadCreateRequest +// CreateRestoreJSONRequestBody defines body for CreateRestore for application/json ContentType. +type CreateRestoreJSONRequestBody = RestorehandlerPayloadCreateRequest -// PostRestoresTargetProbeJSONRequestBody defines body for PostRestoresTargetProbe for application/json ContentType. -type PostRestoresTargetProbeJSONRequestBody = RestorehandlerPayloadProbeTargetRequest +// ProbeRestoreTargetJSONRequestBody defines body for ProbeRestoreTarget for application/json ContentType. +type ProbeRestoreTargetJSONRequestBody = RestorehandlerPayloadProbeTargetRequest -// PostStorageDestinationsJSONRequestBody defines body for PostStorageDestinations for application/json ContentType. -type PostStorageDestinationsJSONRequestBody = PolicyhandlerPayloadCreateStorageDestinationRequest +// CreateStorageDestinationJSONRequestBody defines body for CreateStorageDestination for application/json ContentType. +type CreateStorageDestinationJSONRequestBody = PolicyhandlerPayloadCreateStorageDestinationRequest -// PostStorageDestinationsManagedEnsureJSONRequestBody defines body for PostStorageDestinationsManagedEnsure for application/json ContentType. -type PostStorageDestinationsManagedEnsureJSONRequestBody = PolicyhandlerPayloadEnsureManagedStorageDestinationRequest +// EnsureManagedStorageDestinationJSONRequestBody defines body for EnsureManagedStorageDestination for application/json ContentType. +type EnsureManagedStorageDestinationJSONRequestBody = PolicyhandlerPayloadEnsureManagedStorageDestinationRequest -// PatchStorageDestinationsIdJSONRequestBody defines body for PatchStorageDestinationsId for application/json ContentType. -type PatchStorageDestinationsIdJSONRequestBody = PolicyhandlerPayloadUpdateStorageDestinationRequest +// UpdateStorageDestinationJSONRequestBody defines body for UpdateStorageDestination for application/json ContentType. +type UpdateStorageDestinationJSONRequestBody = PolicyhandlerPayloadUpdateStorageDestinationRequest // RequestEditorFn is the function signature for the RequestEditor callback function type RequestEditorFn func(ctx context.Context, req *http.Request) error @@ -1476,29 +1476,29 @@ type ClientInterface interface { // ListAuditLogActors request ListAuditLogActors(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetBackupPolicies request - GetBackupPolicies(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListBackupPolicies request + ListBackupPolicies(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - // PostBackupPoliciesWithBody request with any body - PostBackupPoliciesWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // CreateBackupPolicyWithBody request with any body + CreateBackupPolicyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PostBackupPolicies(ctx context.Context, body PostBackupPoliciesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + CreateBackupPolicy(ctx context.Context, body CreateBackupPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // PatchBackupPoliciesIdWithBody request with any body - PatchBackupPoliciesIdWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // UpdateBackupPolicyWithBody request with any body + UpdateBackupPolicyWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PatchBackupPoliciesId(ctx context.Context, id string, body PatchBackupPoliciesIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + UpdateBackupPolicy(ctx context.Context, id string, body UpdateBackupPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetBackups request - GetBackups(ctx context.Context, params *GetBackupsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListBackups request + ListBackups(ctx context.Context, params *ListBackupsParams, reqEditors ...RequestEditorFn) (*http.Response, error) - // List request - List(ctx context.Context, params *ListParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListDatasources request + ListDatasources(ctx context.Context, params *ListDatasourcesParams, reqEditors ...RequestEditorFn) (*http.Response, error) - // PostDatasourcesWithBody request with any body - PostDatasourcesWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // CreateDatasourceWithBody request with any body + CreateDatasourceWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PostDatasources(ctx context.Context, body PostDatasourcesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + CreateDatasource(ctx context.Context, body CreateDatasourceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // ProtectDatasourceWithBody request with any body ProtectDatasourceWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1531,13 +1531,13 @@ type ClientInterface interface { // ListPolicies request ListPolicies(ctx context.Context, datasourceId string, reqEditors ...RequestEditorFn) (*http.Response, error) - // PostDatasourcesDatasourceIdPoliciesWithBody request with any body - PostDatasourcesDatasourceIdPoliciesWithBody(ctx context.Context, datasourceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // AttachPolicyWithBody request with any body + AttachPolicyWithBody(ctx context.Context, datasourceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PostDatasourcesDatasourceIdPolicies(ctx context.Context, datasourceId string, body PostDatasourcesDatasourceIdPoliciesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + AttachPolicy(ctx context.Context, datasourceId string, body AttachPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // DeleteDatasourcesDatasourceIdPoliciesPolicyId request - DeleteDatasourcesDatasourceIdPoliciesPolicyId(ctx context.Context, datasourceId string, policyId string, reqEditors ...RequestEditorFn) (*http.Response, error) + // DetachPolicy request + DetachPolicy(ctx context.Context, datasourceId string, policyId string, reqEditors ...RequestEditorFn) (*http.Response, error) // UpdatePolicyAttachmentWithBody request with any body UpdatePolicyAttachmentWithBody(ctx context.Context, datasourceId string, policyId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1547,26 +1547,26 @@ type ClientInterface interface { // GetRestoreCheckHistory request GetRestoreCheckHistory(ctx context.Context, datasourceId string, params *GetRestoreCheckHistoryParams, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetDatasourcesDatasourceIdRestores request - GetDatasourcesDatasourceIdRestores(ctx context.Context, datasourceId string, params *GetDatasourcesDatasourceIdRestoresParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListDatasourceRestores request + ListDatasourceRestores(ctx context.Context, datasourceId string, params *ListDatasourceRestoresParams, reqEditors ...RequestEditorFn) (*http.Response, error) // DeleteDatasourceWithBody request with any body DeleteDatasourceWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) DeleteDatasource(ctx context.Context, id string, body DeleteDatasourceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // Get request - Get(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetDatasource request + GetDatasource(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) // UpdateDataSourceWithBody request with any body UpdateDataSourceWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) UpdateDataSource(ctx context.Context, id string, body UpdateDataSourceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // PutDatasourcesIdCredentialsWithBody request with any body - PutDatasourcesIdCredentialsWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // SetDatasourceCredentialsWithBody request with any body + SetDatasourceCredentialsWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PutDatasourcesIdCredentials(ctx context.Context, id string, body PutDatasourcesIdCredentialsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + SetDatasourceCredentials(ctx context.Context, id string, body SetDatasourceCredentialsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetRestoreCheck request GetRestoreCheck(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1590,45 +1590,45 @@ type ClientInterface interface { // TestNotifications request TestNotifications(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - // PostRestoresWithBody request with any body - PostRestoresWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // CreateRestoreWithBody request with any body + CreateRestoreWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PostRestores(ctx context.Context, body PostRestoresJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + CreateRestore(ctx context.Context, body CreateRestoreJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // PostRestoresTargetProbeWithBody request with any body - PostRestoresTargetProbeWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // ProbeRestoreTargetWithBody request with any body + ProbeRestoreTargetWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PostRestoresTargetProbe(ctx context.Context, body PostRestoresTargetProbeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + ProbeRestoreTarget(ctx context.Context, body ProbeRestoreTargetJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetRestoresId request - GetRestoresId(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetRestore request + GetRestore(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetRestoresIdLogsPresign request - GetRestoresIdLogsPresign(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetRestoreLogsLink request + GetRestoreLogsLink(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetStorageDestinations request - GetStorageDestinations(ctx context.Context, params *GetStorageDestinationsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListStorageDestinations request + ListStorageDestinations(ctx context.Context, params *ListStorageDestinationsParams, reqEditors ...RequestEditorFn) (*http.Response, error) - // PostStorageDestinationsWithBody request with any body - PostStorageDestinationsWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // CreateStorageDestinationWithBody request with any body + CreateStorageDestinationWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PostStorageDestinations(ctx context.Context, body PostStorageDestinationsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + CreateStorageDestination(ctx context.Context, body CreateStorageDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // PostStorageDestinationsManagedEnsureWithBody request with any body - PostStorageDestinationsManagedEnsureWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // EnsureManagedStorageDestinationWithBody request with any body + EnsureManagedStorageDestinationWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PostStorageDestinationsManagedEnsure(ctx context.Context, body PostStorageDestinationsManagedEnsureJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + EnsureManagedStorageDestination(ctx context.Context, body EnsureManagedStorageDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // DeleteStorageDestinationsId request - DeleteStorageDestinationsId(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + // DeleteStorageDestination request + DeleteStorageDestination(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetStorageDestinationsId request - GetStorageDestinationsId(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetStorageDestination request + GetStorageDestination(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - // PatchStorageDestinationsIdWithBody request with any body - PatchStorageDestinationsIdWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // UpdateStorageDestinationWithBody request with any body + UpdateStorageDestinationWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PatchStorageDestinationsId(ctx context.Context, id string, body PatchStorageDestinationsIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + UpdateStorageDestination(ctx context.Context, id string, body UpdateStorageDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) } func (c *Client) ListAuditLogs(ctx context.Context, params *ListAuditLogsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { @@ -1655,8 +1655,8 @@ func (c *Client) ListAuditLogActors(ctx context.Context, reqEditors ...RequestEd return c.Client.Do(req) } -func (c *Client) GetBackupPolicies(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetBackupPoliciesRequest(c.Server) +func (c *Client) ListBackupPolicies(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListBackupPoliciesRequest(c.Server) if err != nil { return nil, err } @@ -1667,8 +1667,8 @@ func (c *Client) GetBackupPolicies(ctx context.Context, reqEditors ...RequestEdi return c.Client.Do(req) } -func (c *Client) PostBackupPoliciesWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostBackupPoliciesRequestWithBody(c.Server, contentType, body) +func (c *Client) CreateBackupPolicyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateBackupPolicyRequestWithBody(c.Server, contentType, body) if err != nil { return nil, err } @@ -1679,8 +1679,8 @@ func (c *Client) PostBackupPoliciesWithBody(ctx context.Context, contentType str return c.Client.Do(req) } -func (c *Client) PostBackupPolicies(ctx context.Context, body PostBackupPoliciesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostBackupPoliciesRequest(c.Server, body) +func (c *Client) CreateBackupPolicy(ctx context.Context, body CreateBackupPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateBackupPolicyRequest(c.Server, body) if err != nil { return nil, err } @@ -1691,8 +1691,8 @@ func (c *Client) PostBackupPolicies(ctx context.Context, body PostBackupPolicies return c.Client.Do(req) } -func (c *Client) PatchBackupPoliciesIdWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPatchBackupPoliciesIdRequestWithBody(c.Server, id, contentType, body) +func (c *Client) UpdateBackupPolicyWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateBackupPolicyRequestWithBody(c.Server, id, contentType, body) if err != nil { return nil, err } @@ -1703,8 +1703,8 @@ func (c *Client) PatchBackupPoliciesIdWithBody(ctx context.Context, id string, c return c.Client.Do(req) } -func (c *Client) PatchBackupPoliciesId(ctx context.Context, id string, body PatchBackupPoliciesIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPatchBackupPoliciesIdRequest(c.Server, id, body) +func (c *Client) UpdateBackupPolicy(ctx context.Context, id string, body UpdateBackupPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateBackupPolicyRequest(c.Server, id, body) if err != nil { return nil, err } @@ -1715,8 +1715,8 @@ func (c *Client) PatchBackupPoliciesId(ctx context.Context, id string, body Patc return c.Client.Do(req) } -func (c *Client) GetBackups(ctx context.Context, params *GetBackupsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetBackupsRequest(c.Server, params) +func (c *Client) ListBackups(ctx context.Context, params *ListBackupsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListBackupsRequest(c.Server, params) if err != nil { return nil, err } @@ -1727,8 +1727,8 @@ func (c *Client) GetBackups(ctx context.Context, params *GetBackupsParams, reqEd return c.Client.Do(req) } -func (c *Client) List(ctx context.Context, params *ListParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListRequest(c.Server, params) +func (c *Client) ListDatasources(ctx context.Context, params *ListDatasourcesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListDatasourcesRequest(c.Server, params) if err != nil { return nil, err } @@ -1739,8 +1739,8 @@ func (c *Client) List(ctx context.Context, params *ListParams, reqEditors ...Req return c.Client.Do(req) } -func (c *Client) PostDatasourcesWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostDatasourcesRequestWithBody(c.Server, contentType, body) +func (c *Client) CreateDatasourceWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateDatasourceRequestWithBody(c.Server, contentType, body) if err != nil { return nil, err } @@ -1751,8 +1751,8 @@ func (c *Client) PostDatasourcesWithBody(ctx context.Context, contentType string return c.Client.Do(req) } -func (c *Client) PostDatasources(ctx context.Context, body PostDatasourcesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostDatasourcesRequest(c.Server, body) +func (c *Client) CreateDatasource(ctx context.Context, body CreateDatasourceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateDatasourceRequest(c.Server, body) if err != nil { return nil, err } @@ -1895,8 +1895,8 @@ func (c *Client) ListPolicies(ctx context.Context, datasourceId string, reqEdito return c.Client.Do(req) } -func (c *Client) PostDatasourcesDatasourceIdPoliciesWithBody(ctx context.Context, datasourceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostDatasourcesDatasourceIdPoliciesRequestWithBody(c.Server, datasourceId, contentType, body) +func (c *Client) AttachPolicyWithBody(ctx context.Context, datasourceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewAttachPolicyRequestWithBody(c.Server, datasourceId, contentType, body) if err != nil { return nil, err } @@ -1907,8 +1907,8 @@ func (c *Client) PostDatasourcesDatasourceIdPoliciesWithBody(ctx context.Context return c.Client.Do(req) } -func (c *Client) PostDatasourcesDatasourceIdPolicies(ctx context.Context, datasourceId string, body PostDatasourcesDatasourceIdPoliciesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostDatasourcesDatasourceIdPoliciesRequest(c.Server, datasourceId, body) +func (c *Client) AttachPolicy(ctx context.Context, datasourceId string, body AttachPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewAttachPolicyRequest(c.Server, datasourceId, body) if err != nil { return nil, err } @@ -1919,8 +1919,8 @@ func (c *Client) PostDatasourcesDatasourceIdPolicies(ctx context.Context, dataso return c.Client.Do(req) } -func (c *Client) DeleteDatasourcesDatasourceIdPoliciesPolicyId(ctx context.Context, datasourceId string, policyId string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDatasourcesDatasourceIdPoliciesPolicyIdRequest(c.Server, datasourceId, policyId) +func (c *Client) DetachPolicy(ctx context.Context, datasourceId string, policyId string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDetachPolicyRequest(c.Server, datasourceId, policyId) if err != nil { return nil, err } @@ -1967,8 +1967,8 @@ func (c *Client) GetRestoreCheckHistory(ctx context.Context, datasourceId string return c.Client.Do(req) } -func (c *Client) GetDatasourcesDatasourceIdRestores(ctx context.Context, datasourceId string, params *GetDatasourcesDatasourceIdRestoresParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDatasourcesDatasourceIdRestoresRequest(c.Server, datasourceId, params) +func (c *Client) ListDatasourceRestores(ctx context.Context, datasourceId string, params *ListDatasourceRestoresParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListDatasourceRestoresRequest(c.Server, datasourceId, params) if err != nil { return nil, err } @@ -2003,8 +2003,8 @@ func (c *Client) DeleteDatasource(ctx context.Context, id string, body DeleteDat return c.Client.Do(req) } -func (c *Client) Get(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetRequest(c.Server, id) +func (c *Client) GetDatasource(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetDatasourceRequest(c.Server, id) if err != nil { return nil, err } @@ -2039,8 +2039,8 @@ func (c *Client) UpdateDataSource(ctx context.Context, id string, body UpdateDat return c.Client.Do(req) } -func (c *Client) PutDatasourcesIdCredentialsWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPutDatasourcesIdCredentialsRequestWithBody(c.Server, id, contentType, body) +func (c *Client) SetDatasourceCredentialsWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewSetDatasourceCredentialsRequestWithBody(c.Server, id, contentType, body) if err != nil { return nil, err } @@ -2051,8 +2051,8 @@ func (c *Client) PutDatasourcesIdCredentialsWithBody(ctx context.Context, id str return c.Client.Do(req) } -func (c *Client) PutDatasourcesIdCredentials(ctx context.Context, id string, body PutDatasourcesIdCredentialsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPutDatasourcesIdCredentialsRequest(c.Server, id, body) +func (c *Client) SetDatasourceCredentials(ctx context.Context, id string, body SetDatasourceCredentialsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewSetDatasourceCredentialsRequest(c.Server, id, body) if err != nil { return nil, err } @@ -2159,8 +2159,8 @@ func (c *Client) TestNotifications(ctx context.Context, reqEditors ...RequestEdi return c.Client.Do(req) } -func (c *Client) PostRestoresWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostRestoresRequestWithBody(c.Server, contentType, body) +func (c *Client) CreateRestoreWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateRestoreRequestWithBody(c.Server, contentType, body) if err != nil { return nil, err } @@ -2171,8 +2171,8 @@ func (c *Client) PostRestoresWithBody(ctx context.Context, contentType string, b return c.Client.Do(req) } -func (c *Client) PostRestores(ctx context.Context, body PostRestoresJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostRestoresRequest(c.Server, body) +func (c *Client) CreateRestore(ctx context.Context, body CreateRestoreJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateRestoreRequest(c.Server, body) if err != nil { return nil, err } @@ -2183,8 +2183,8 @@ func (c *Client) PostRestores(ctx context.Context, body PostRestoresJSONRequestB return c.Client.Do(req) } -func (c *Client) PostRestoresTargetProbeWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostRestoresTargetProbeRequestWithBody(c.Server, contentType, body) +func (c *Client) ProbeRestoreTargetWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewProbeRestoreTargetRequestWithBody(c.Server, contentType, body) if err != nil { return nil, err } @@ -2195,8 +2195,8 @@ func (c *Client) PostRestoresTargetProbeWithBody(ctx context.Context, contentTyp return c.Client.Do(req) } -func (c *Client) PostRestoresTargetProbe(ctx context.Context, body PostRestoresTargetProbeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostRestoresTargetProbeRequest(c.Server, body) +func (c *Client) ProbeRestoreTarget(ctx context.Context, body ProbeRestoreTargetJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewProbeRestoreTargetRequest(c.Server, body) if err != nil { return nil, err } @@ -2207,8 +2207,8 @@ func (c *Client) PostRestoresTargetProbe(ctx context.Context, body PostRestoresT return c.Client.Do(req) } -func (c *Client) GetRestoresId(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetRestoresIdRequest(c.Server, id) +func (c *Client) GetRestore(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetRestoreRequest(c.Server, id) if err != nil { return nil, err } @@ -2219,8 +2219,8 @@ func (c *Client) GetRestoresId(ctx context.Context, id string, reqEditors ...Req return c.Client.Do(req) } -func (c *Client) GetRestoresIdLogsPresign(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetRestoresIdLogsPresignRequest(c.Server, id) +func (c *Client) GetRestoreLogsLink(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetRestoreLogsLinkRequest(c.Server, id) if err != nil { return nil, err } @@ -2231,8 +2231,8 @@ func (c *Client) GetRestoresIdLogsPresign(ctx context.Context, id string, reqEdi return c.Client.Do(req) } -func (c *Client) GetStorageDestinations(ctx context.Context, params *GetStorageDestinationsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetStorageDestinationsRequest(c.Server, params) +func (c *Client) ListStorageDestinations(ctx context.Context, params *ListStorageDestinationsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListStorageDestinationsRequest(c.Server, params) if err != nil { return nil, err } @@ -2243,8 +2243,8 @@ func (c *Client) GetStorageDestinations(ctx context.Context, params *GetStorageD return c.Client.Do(req) } -func (c *Client) PostStorageDestinationsWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostStorageDestinationsRequestWithBody(c.Server, contentType, body) +func (c *Client) CreateStorageDestinationWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateStorageDestinationRequestWithBody(c.Server, contentType, body) if err != nil { return nil, err } @@ -2255,8 +2255,8 @@ func (c *Client) PostStorageDestinationsWithBody(ctx context.Context, contentTyp return c.Client.Do(req) } -func (c *Client) PostStorageDestinations(ctx context.Context, body PostStorageDestinationsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostStorageDestinationsRequest(c.Server, body) +func (c *Client) CreateStorageDestination(ctx context.Context, body CreateStorageDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateStorageDestinationRequest(c.Server, body) if err != nil { return nil, err } @@ -2267,8 +2267,8 @@ func (c *Client) PostStorageDestinations(ctx context.Context, body PostStorageDe return c.Client.Do(req) } -func (c *Client) PostStorageDestinationsManagedEnsureWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostStorageDestinationsManagedEnsureRequestWithBody(c.Server, contentType, body) +func (c *Client) EnsureManagedStorageDestinationWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewEnsureManagedStorageDestinationRequestWithBody(c.Server, contentType, body) if err != nil { return nil, err } @@ -2279,8 +2279,8 @@ func (c *Client) PostStorageDestinationsManagedEnsureWithBody(ctx context.Contex return c.Client.Do(req) } -func (c *Client) PostStorageDestinationsManagedEnsure(ctx context.Context, body PostStorageDestinationsManagedEnsureJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostStorageDestinationsManagedEnsureRequest(c.Server, body) +func (c *Client) EnsureManagedStorageDestination(ctx context.Context, body EnsureManagedStorageDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewEnsureManagedStorageDestinationRequest(c.Server, body) if err != nil { return nil, err } @@ -2291,8 +2291,8 @@ func (c *Client) PostStorageDestinationsManagedEnsure(ctx context.Context, body return c.Client.Do(req) } -func (c *Client) DeleteStorageDestinationsId(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteStorageDestinationsIdRequest(c.Server, id) +func (c *Client) DeleteStorageDestination(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeleteStorageDestinationRequest(c.Server, id) if err != nil { return nil, err } @@ -2303,8 +2303,8 @@ func (c *Client) DeleteStorageDestinationsId(ctx context.Context, id string, req return c.Client.Do(req) } -func (c *Client) GetStorageDestinationsId(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetStorageDestinationsIdRequest(c.Server, id) +func (c *Client) GetStorageDestination(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetStorageDestinationRequest(c.Server, id) if err != nil { return nil, err } @@ -2315,8 +2315,8 @@ func (c *Client) GetStorageDestinationsId(ctx context.Context, id string, reqEdi return c.Client.Do(req) } -func (c *Client) PatchStorageDestinationsIdWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPatchStorageDestinationsIdRequestWithBody(c.Server, id, contentType, body) +func (c *Client) UpdateStorageDestinationWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateStorageDestinationRequestWithBody(c.Server, id, contentType, body) if err != nil { return nil, err } @@ -2327,8 +2327,8 @@ func (c *Client) PatchStorageDestinationsIdWithBody(ctx context.Context, id stri return c.Client.Do(req) } -func (c *Client) PatchStorageDestinationsId(ctx context.Context, id string, body PatchStorageDestinationsIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPatchStorageDestinationsIdRequest(c.Server, id, body) +func (c *Client) UpdateStorageDestination(ctx context.Context, id string, body UpdateStorageDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateStorageDestinationRequest(c.Server, id, body) if err != nil { return nil, err } @@ -2516,8 +2516,8 @@ func NewListAuditLogActorsRequest(server string) (*http.Request, error) { return req, nil } -// NewGetBackupPoliciesRequest generates requests for GetBackupPolicies -func NewGetBackupPoliciesRequest(server string) (*http.Request, error) { +// NewListBackupPoliciesRequest generates requests for ListBackupPolicies +func NewListBackupPoliciesRequest(server string) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -2543,19 +2543,19 @@ func NewGetBackupPoliciesRequest(server string) (*http.Request, error) { return req, nil } -// NewPostBackupPoliciesRequest calls the generic PostBackupPolicies builder with application/json body -func NewPostBackupPoliciesRequest(server string, body PostBackupPoliciesJSONRequestBody) (*http.Request, error) { +// NewCreateBackupPolicyRequest calls the generic CreateBackupPolicy builder with application/json body +func NewCreateBackupPolicyRequest(server string, body CreateBackupPolicyJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPostBackupPoliciesRequestWithBody(server, "application/json", bodyReader) + return NewCreateBackupPolicyRequestWithBody(server, "application/json", bodyReader) } -// NewPostBackupPoliciesRequestWithBody generates requests for PostBackupPolicies with any type of body -func NewPostBackupPoliciesRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { +// NewCreateBackupPolicyRequestWithBody generates requests for CreateBackupPolicy with any type of body +func NewCreateBackupPolicyRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -2583,19 +2583,19 @@ func NewPostBackupPoliciesRequestWithBody(server string, contentType string, bod return req, nil } -// NewPatchBackupPoliciesIdRequest calls the generic PatchBackupPoliciesId builder with application/json body -func NewPatchBackupPoliciesIdRequest(server string, id string, body PatchBackupPoliciesIdJSONRequestBody) (*http.Request, error) { +// NewUpdateBackupPolicyRequest calls the generic UpdateBackupPolicy builder with application/json body +func NewUpdateBackupPolicyRequest(server string, id string, body UpdateBackupPolicyJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPatchBackupPoliciesIdRequestWithBody(server, id, "application/json", bodyReader) + return NewUpdateBackupPolicyRequestWithBody(server, id, "application/json", bodyReader) } -// NewPatchBackupPoliciesIdRequestWithBody generates requests for PatchBackupPoliciesId with any type of body -func NewPatchBackupPoliciesIdRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { +// NewUpdateBackupPolicyRequestWithBody generates requests for UpdateBackupPolicy with any type of body +func NewUpdateBackupPolicyRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -2630,8 +2630,8 @@ func NewPatchBackupPoliciesIdRequestWithBody(server string, id string, contentTy return req, nil } -// NewGetBackupsRequest generates requests for GetBackups -func NewGetBackupsRequest(server string, params *GetBackupsParams) (*http.Request, error) { +// NewListBackupsRequest generates requests for ListBackups +func NewListBackupsRequest(server string, params *ListBackupsParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -2708,8 +2708,8 @@ func NewGetBackupsRequest(server string, params *GetBackupsParams) (*http.Reques return req, nil } -// NewListRequest generates requests for List -func NewListRequest(server string, params *ListParams) (*http.Request, error) { +// NewListDatasourcesRequest generates requests for ListDatasources +func NewListDatasourcesRequest(server string, params *ListDatasourcesParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -2774,19 +2774,19 @@ func NewListRequest(server string, params *ListParams) (*http.Request, error) { return req, nil } -// NewPostDatasourcesRequest calls the generic PostDatasources builder with application/json body -func NewPostDatasourcesRequest(server string, body PostDatasourcesJSONRequestBody) (*http.Request, error) { +// NewCreateDatasourceRequest calls the generic CreateDatasource builder with application/json body +func NewCreateDatasourceRequest(server string, body CreateDatasourceJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPostDatasourcesRequestWithBody(server, "application/json", bodyReader) + return NewCreateDatasourceRequestWithBody(server, "application/json", bodyReader) } -// NewPostDatasourcesRequestWithBody generates requests for PostDatasources with any type of body -func NewPostDatasourcesRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { +// NewCreateDatasourceRequestWithBody generates requests for CreateDatasource with any type of body +func NewCreateDatasourceRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -3233,19 +3233,19 @@ func NewListPoliciesRequest(server string, datasourceId string) (*http.Request, return req, nil } -// NewPostDatasourcesDatasourceIdPoliciesRequest calls the generic PostDatasourcesDatasourceIdPolicies builder with application/json body -func NewPostDatasourcesDatasourceIdPoliciesRequest(server string, datasourceId string, body PostDatasourcesDatasourceIdPoliciesJSONRequestBody) (*http.Request, error) { +// NewAttachPolicyRequest calls the generic AttachPolicy builder with application/json body +func NewAttachPolicyRequest(server string, datasourceId string, body AttachPolicyJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPostDatasourcesDatasourceIdPoliciesRequestWithBody(server, datasourceId, "application/json", bodyReader) + return NewAttachPolicyRequestWithBody(server, datasourceId, "application/json", bodyReader) } -// NewPostDatasourcesDatasourceIdPoliciesRequestWithBody generates requests for PostDatasourcesDatasourceIdPolicies with any type of body -func NewPostDatasourcesDatasourceIdPoliciesRequestWithBody(server string, datasourceId string, contentType string, body io.Reader) (*http.Request, error) { +// NewAttachPolicyRequestWithBody generates requests for AttachPolicy with any type of body +func NewAttachPolicyRequestWithBody(server string, datasourceId string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -3280,8 +3280,8 @@ func NewPostDatasourcesDatasourceIdPoliciesRequestWithBody(server string, dataso return req, nil } -// NewDeleteDatasourcesDatasourceIdPoliciesPolicyIdRequest generates requests for DeleteDatasourcesDatasourceIdPoliciesPolicyId -func NewDeleteDatasourcesDatasourceIdPoliciesPolicyIdRequest(server string, datasourceId string, policyId string) (*http.Request, error) { +// NewDetachPolicyRequest generates requests for DetachPolicy +func NewDetachPolicyRequest(server string, datasourceId string, policyId string) (*http.Request, error) { var err error var pathParam0 string @@ -3436,8 +3436,8 @@ func NewGetRestoreCheckHistoryRequest(server string, datasourceId string, params return req, nil } -// NewGetDatasourcesDatasourceIdRestoresRequest generates requests for GetDatasourcesDatasourceIdRestores -func NewGetDatasourcesDatasourceIdRestoresRequest(server string, datasourceId string, params *GetDatasourcesDatasourceIdRestoresParams) (*http.Request, error) { +// NewListDatasourceRestoresRequest generates requests for ListDatasourceRestores +func NewListDatasourceRestoresRequest(server string, datasourceId string, params *ListDatasourceRestoresParams) (*http.Request, error) { var err error var pathParam0 string @@ -3568,8 +3568,8 @@ func NewDeleteDatasourceRequestWithBody(server string, id string, contentType st return req, nil } -// NewGetRequest generates requests for Get -func NewGetRequest(server string, id string) (*http.Request, error) { +// NewGetDatasourceRequest generates requests for GetDatasource +func NewGetDatasourceRequest(server string, id string) (*http.Request, error) { var err error var pathParam0 string @@ -3649,19 +3649,19 @@ func NewUpdateDataSourceRequestWithBody(server string, id string, contentType st return req, nil } -// NewPutDatasourcesIdCredentialsRequest calls the generic PutDatasourcesIdCredentials builder with application/json body -func NewPutDatasourcesIdCredentialsRequest(server string, id string, body PutDatasourcesIdCredentialsJSONRequestBody) (*http.Request, error) { +// NewSetDatasourceCredentialsRequest calls the generic SetDatasourceCredentials builder with application/json body +func NewSetDatasourceCredentialsRequest(server string, id string, body SetDatasourceCredentialsJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPutDatasourcesIdCredentialsRequestWithBody(server, id, "application/json", bodyReader) + return NewSetDatasourceCredentialsRequestWithBody(server, id, "application/json", bodyReader) } -// NewPutDatasourcesIdCredentialsRequestWithBody generates requests for PutDatasourcesIdCredentials with any type of body -func NewPutDatasourcesIdCredentialsRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { +// NewSetDatasourceCredentialsRequestWithBody generates requests for SetDatasourceCredentials with any type of body +func NewSetDatasourceCredentialsRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -3905,19 +3905,19 @@ func NewTestNotificationsRequest(server string) (*http.Request, error) { return req, nil } -// NewPostRestoresRequest calls the generic PostRestores builder with application/json body -func NewPostRestoresRequest(server string, body PostRestoresJSONRequestBody) (*http.Request, error) { +// NewCreateRestoreRequest calls the generic CreateRestore builder with application/json body +func NewCreateRestoreRequest(server string, body CreateRestoreJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPostRestoresRequestWithBody(server, "application/json", bodyReader) + return NewCreateRestoreRequestWithBody(server, "application/json", bodyReader) } -// NewPostRestoresRequestWithBody generates requests for PostRestores with any type of body -func NewPostRestoresRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { +// NewCreateRestoreRequestWithBody generates requests for CreateRestore with any type of body +func NewCreateRestoreRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -3945,19 +3945,19 @@ func NewPostRestoresRequestWithBody(server string, contentType string, body io.R return req, nil } -// NewPostRestoresTargetProbeRequest calls the generic PostRestoresTargetProbe builder with application/json body -func NewPostRestoresTargetProbeRequest(server string, body PostRestoresTargetProbeJSONRequestBody) (*http.Request, error) { +// NewProbeRestoreTargetRequest calls the generic ProbeRestoreTarget builder with application/json body +func NewProbeRestoreTargetRequest(server string, body ProbeRestoreTargetJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPostRestoresTargetProbeRequestWithBody(server, "application/json", bodyReader) + return NewProbeRestoreTargetRequestWithBody(server, "application/json", bodyReader) } -// NewPostRestoresTargetProbeRequestWithBody generates requests for PostRestoresTargetProbe with any type of body -func NewPostRestoresTargetProbeRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { +// NewProbeRestoreTargetRequestWithBody generates requests for ProbeRestoreTarget with any type of body +func NewProbeRestoreTargetRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -3985,8 +3985,8 @@ func NewPostRestoresTargetProbeRequestWithBody(server string, contentType string return req, nil } -// NewGetRestoresIdRequest generates requests for GetRestoresId -func NewGetRestoresIdRequest(server string, id string) (*http.Request, error) { +// NewGetRestoreRequest generates requests for GetRestore +func NewGetRestoreRequest(server string, id string) (*http.Request, error) { var err error var pathParam0 string @@ -4019,8 +4019,8 @@ func NewGetRestoresIdRequest(server string, id string) (*http.Request, error) { return req, nil } -// NewGetRestoresIdLogsPresignRequest generates requests for GetRestoresIdLogsPresign -func NewGetRestoresIdLogsPresignRequest(server string, id string) (*http.Request, error) { +// NewGetRestoreLogsLinkRequest generates requests for GetRestoreLogsLink +func NewGetRestoreLogsLinkRequest(server string, id string) (*http.Request, error) { var err error var pathParam0 string @@ -4053,8 +4053,8 @@ func NewGetRestoresIdLogsPresignRequest(server string, id string) (*http.Request return req, nil } -// NewGetStorageDestinationsRequest generates requests for GetStorageDestinations -func NewGetStorageDestinationsRequest(server string, params *GetStorageDestinationsParams) (*http.Request, error) { +// NewListStorageDestinationsRequest generates requests for ListStorageDestinations +func NewListStorageDestinationsRequest(server string, params *ListStorageDestinationsParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -4131,19 +4131,19 @@ func NewGetStorageDestinationsRequest(server string, params *GetStorageDestinati return req, nil } -// NewPostStorageDestinationsRequest calls the generic PostStorageDestinations builder with application/json body -func NewPostStorageDestinationsRequest(server string, body PostStorageDestinationsJSONRequestBody) (*http.Request, error) { +// NewCreateStorageDestinationRequest calls the generic CreateStorageDestination builder with application/json body +func NewCreateStorageDestinationRequest(server string, body CreateStorageDestinationJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPostStorageDestinationsRequestWithBody(server, "application/json", bodyReader) + return NewCreateStorageDestinationRequestWithBody(server, "application/json", bodyReader) } -// NewPostStorageDestinationsRequestWithBody generates requests for PostStorageDestinations with any type of body -func NewPostStorageDestinationsRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { +// NewCreateStorageDestinationRequestWithBody generates requests for CreateStorageDestination with any type of body +func NewCreateStorageDestinationRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -4171,19 +4171,19 @@ func NewPostStorageDestinationsRequestWithBody(server string, contentType string return req, nil } -// NewPostStorageDestinationsManagedEnsureRequest calls the generic PostStorageDestinationsManagedEnsure builder with application/json body -func NewPostStorageDestinationsManagedEnsureRequest(server string, body PostStorageDestinationsManagedEnsureJSONRequestBody) (*http.Request, error) { +// NewEnsureManagedStorageDestinationRequest calls the generic EnsureManagedStorageDestination builder with application/json body +func NewEnsureManagedStorageDestinationRequest(server string, body EnsureManagedStorageDestinationJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPostStorageDestinationsManagedEnsureRequestWithBody(server, "application/json", bodyReader) + return NewEnsureManagedStorageDestinationRequestWithBody(server, "application/json", bodyReader) } -// NewPostStorageDestinationsManagedEnsureRequestWithBody generates requests for PostStorageDestinationsManagedEnsure with any type of body -func NewPostStorageDestinationsManagedEnsureRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { +// NewEnsureManagedStorageDestinationRequestWithBody generates requests for EnsureManagedStorageDestination with any type of body +func NewEnsureManagedStorageDestinationRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -4211,8 +4211,8 @@ func NewPostStorageDestinationsManagedEnsureRequestWithBody(server string, conte return req, nil } -// NewDeleteStorageDestinationsIdRequest generates requests for DeleteStorageDestinationsId -func NewDeleteStorageDestinationsIdRequest(server string, id string) (*http.Request, error) { +// NewDeleteStorageDestinationRequest generates requests for DeleteStorageDestination +func NewDeleteStorageDestinationRequest(server string, id string) (*http.Request, error) { var err error var pathParam0 string @@ -4245,8 +4245,8 @@ func NewDeleteStorageDestinationsIdRequest(server string, id string) (*http.Requ return req, nil } -// NewGetStorageDestinationsIdRequest generates requests for GetStorageDestinationsId -func NewGetStorageDestinationsIdRequest(server string, id string) (*http.Request, error) { +// NewGetStorageDestinationRequest generates requests for GetStorageDestination +func NewGetStorageDestinationRequest(server string, id string) (*http.Request, error) { var err error var pathParam0 string @@ -4279,19 +4279,19 @@ func NewGetStorageDestinationsIdRequest(server string, id string) (*http.Request return req, nil } -// NewPatchStorageDestinationsIdRequest calls the generic PatchStorageDestinationsId builder with application/json body -func NewPatchStorageDestinationsIdRequest(server string, id string, body PatchStorageDestinationsIdJSONRequestBody) (*http.Request, error) { +// NewUpdateStorageDestinationRequest calls the generic UpdateStorageDestination builder with application/json body +func NewUpdateStorageDestinationRequest(server string, id string, body UpdateStorageDestinationJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPatchStorageDestinationsIdRequestWithBody(server, id, "application/json", bodyReader) + return NewUpdateStorageDestinationRequestWithBody(server, id, "application/json", bodyReader) } -// NewPatchStorageDestinationsIdRequestWithBody generates requests for PatchStorageDestinationsId with any type of body -func NewPatchStorageDestinationsIdRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { +// NewUpdateStorageDestinationRequestWithBody generates requests for UpdateStorageDestination with any type of body +func NewUpdateStorageDestinationRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -4375,29 +4375,29 @@ type ClientWithResponsesInterface interface { // ListAuditLogActorsWithResponse request ListAuditLogActorsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListAuditLogActorsResponse, error) - // GetBackupPoliciesWithResponse request - GetBackupPoliciesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetBackupPoliciesResponse, error) + // ListBackupPoliciesWithResponse request + ListBackupPoliciesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListBackupPoliciesResponse, error) - // PostBackupPoliciesWithBodyWithResponse request with any body - PostBackupPoliciesWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostBackupPoliciesResponse, error) + // CreateBackupPolicyWithBodyWithResponse request with any body + CreateBackupPolicyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateBackupPolicyResponse, error) - PostBackupPoliciesWithResponse(ctx context.Context, body PostBackupPoliciesJSONRequestBody, reqEditors ...RequestEditorFn) (*PostBackupPoliciesResponse, error) + CreateBackupPolicyWithResponse(ctx context.Context, body CreateBackupPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateBackupPolicyResponse, error) - // PatchBackupPoliciesIdWithBodyWithResponse request with any body - PatchBackupPoliciesIdWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PatchBackupPoliciesIdResponse, error) + // UpdateBackupPolicyWithBodyWithResponse request with any body + UpdateBackupPolicyWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateBackupPolicyResponse, error) - PatchBackupPoliciesIdWithResponse(ctx context.Context, id string, body PatchBackupPoliciesIdJSONRequestBody, reqEditors ...RequestEditorFn) (*PatchBackupPoliciesIdResponse, error) + UpdateBackupPolicyWithResponse(ctx context.Context, id string, body UpdateBackupPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateBackupPolicyResponse, error) - // GetBackupsWithResponse request - GetBackupsWithResponse(ctx context.Context, params *GetBackupsParams, reqEditors ...RequestEditorFn) (*GetBackupsResponse, error) + // ListBackupsWithResponse request + ListBackupsWithResponse(ctx context.Context, params *ListBackupsParams, reqEditors ...RequestEditorFn) (*ListBackupsResponse, error) - // ListWithResponse request - ListWithResponse(ctx context.Context, params *ListParams, reqEditors ...RequestEditorFn) (*ListResponse, error) + // ListDatasourcesWithResponse request + ListDatasourcesWithResponse(ctx context.Context, params *ListDatasourcesParams, reqEditors ...RequestEditorFn) (*ListDatasourcesResponse, error) - // PostDatasourcesWithBodyWithResponse request with any body - PostDatasourcesWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostDatasourcesResponse, error) + // CreateDatasourceWithBodyWithResponse request with any body + CreateDatasourceWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDatasourceResponse, error) - PostDatasourcesWithResponse(ctx context.Context, body PostDatasourcesJSONRequestBody, reqEditors ...RequestEditorFn) (*PostDatasourcesResponse, error) + CreateDatasourceWithResponse(ctx context.Context, body CreateDatasourceJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDatasourceResponse, error) // ProtectDatasourceWithBodyWithResponse request with any body ProtectDatasourceWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ProtectDatasourceResponse, error) @@ -4430,13 +4430,13 @@ type ClientWithResponsesInterface interface { // ListPoliciesWithResponse request ListPoliciesWithResponse(ctx context.Context, datasourceId string, reqEditors ...RequestEditorFn) (*ListPoliciesResponse, error) - // PostDatasourcesDatasourceIdPoliciesWithBodyWithResponse request with any body - PostDatasourcesDatasourceIdPoliciesWithBodyWithResponse(ctx context.Context, datasourceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostDatasourcesDatasourceIdPoliciesResponse, error) + // AttachPolicyWithBodyWithResponse request with any body + AttachPolicyWithBodyWithResponse(ctx context.Context, datasourceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AttachPolicyResponse, error) - PostDatasourcesDatasourceIdPoliciesWithResponse(ctx context.Context, datasourceId string, body PostDatasourcesDatasourceIdPoliciesJSONRequestBody, reqEditors ...RequestEditorFn) (*PostDatasourcesDatasourceIdPoliciesResponse, error) + AttachPolicyWithResponse(ctx context.Context, datasourceId string, body AttachPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*AttachPolicyResponse, error) - // DeleteDatasourcesDatasourceIdPoliciesPolicyIdWithResponse request - DeleteDatasourcesDatasourceIdPoliciesPolicyIdWithResponse(ctx context.Context, datasourceId string, policyId string, reqEditors ...RequestEditorFn) (*DeleteDatasourcesDatasourceIdPoliciesPolicyIdResponse, error) + // DetachPolicyWithResponse request + DetachPolicyWithResponse(ctx context.Context, datasourceId string, policyId string, reqEditors ...RequestEditorFn) (*DetachPolicyResponse, error) // UpdatePolicyAttachmentWithBodyWithResponse request with any body UpdatePolicyAttachmentWithBodyWithResponse(ctx context.Context, datasourceId string, policyId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdatePolicyAttachmentResponse, error) @@ -4446,26 +4446,26 @@ type ClientWithResponsesInterface interface { // GetRestoreCheckHistoryWithResponse request GetRestoreCheckHistoryWithResponse(ctx context.Context, datasourceId string, params *GetRestoreCheckHistoryParams, reqEditors ...RequestEditorFn) (*GetRestoreCheckHistoryResponse, error) - // GetDatasourcesDatasourceIdRestoresWithResponse request - GetDatasourcesDatasourceIdRestoresWithResponse(ctx context.Context, datasourceId string, params *GetDatasourcesDatasourceIdRestoresParams, reqEditors ...RequestEditorFn) (*GetDatasourcesDatasourceIdRestoresResponse, error) + // ListDatasourceRestoresWithResponse request + ListDatasourceRestoresWithResponse(ctx context.Context, datasourceId string, params *ListDatasourceRestoresParams, reqEditors ...RequestEditorFn) (*ListDatasourceRestoresResponse, error) // DeleteDatasourceWithBodyWithResponse request with any body DeleteDatasourceWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*DeleteDatasourceResponse, error) DeleteDatasourceWithResponse(ctx context.Context, id string, body DeleteDatasourceJSONRequestBody, reqEditors ...RequestEditorFn) (*DeleteDatasourceResponse, error) - // GetWithResponse request - GetWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetResponse, error) + // GetDatasourceWithResponse request + GetDatasourceWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetDatasourceResponse, error) // UpdateDataSourceWithBodyWithResponse request with any body UpdateDataSourceWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDataSourceResponse, error) UpdateDataSourceWithResponse(ctx context.Context, id string, body UpdateDataSourceJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDataSourceResponse, error) - // PutDatasourcesIdCredentialsWithBodyWithResponse request with any body - PutDatasourcesIdCredentialsWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutDatasourcesIdCredentialsResponse, error) + // SetDatasourceCredentialsWithBodyWithResponse request with any body + SetDatasourceCredentialsWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetDatasourceCredentialsResponse, error) - PutDatasourcesIdCredentialsWithResponse(ctx context.Context, id string, body PutDatasourcesIdCredentialsJSONRequestBody, reqEditors ...RequestEditorFn) (*PutDatasourcesIdCredentialsResponse, error) + SetDatasourceCredentialsWithResponse(ctx context.Context, id string, body SetDatasourceCredentialsJSONRequestBody, reqEditors ...RequestEditorFn) (*SetDatasourceCredentialsResponse, error) // GetRestoreCheckWithResponse request GetRestoreCheckWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetRestoreCheckResponse, error) @@ -4489,45 +4489,45 @@ type ClientWithResponsesInterface interface { // TestNotificationsWithResponse request TestNotificationsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*TestNotificationsResponse, error) - // PostRestoresWithBodyWithResponse request with any body - PostRestoresWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostRestoresResponse, error) + // CreateRestoreWithBodyWithResponse request with any body + CreateRestoreWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateRestoreResponse, error) - PostRestoresWithResponse(ctx context.Context, body PostRestoresJSONRequestBody, reqEditors ...RequestEditorFn) (*PostRestoresResponse, error) + CreateRestoreWithResponse(ctx context.Context, body CreateRestoreJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateRestoreResponse, error) - // PostRestoresTargetProbeWithBodyWithResponse request with any body - PostRestoresTargetProbeWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostRestoresTargetProbeResponse, error) + // ProbeRestoreTargetWithBodyWithResponse request with any body + ProbeRestoreTargetWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ProbeRestoreTargetResponse, error) - PostRestoresTargetProbeWithResponse(ctx context.Context, body PostRestoresTargetProbeJSONRequestBody, reqEditors ...RequestEditorFn) (*PostRestoresTargetProbeResponse, error) + ProbeRestoreTargetWithResponse(ctx context.Context, body ProbeRestoreTargetJSONRequestBody, reqEditors ...RequestEditorFn) (*ProbeRestoreTargetResponse, error) - // GetRestoresIdWithResponse request - GetRestoresIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetRestoresIdResponse, error) + // GetRestoreWithResponse request + GetRestoreWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetRestoreResponse, error) - // GetRestoresIdLogsPresignWithResponse request - GetRestoresIdLogsPresignWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetRestoresIdLogsPresignResponse, error) + // GetRestoreLogsLinkWithResponse request + GetRestoreLogsLinkWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetRestoreLogsLinkResponse, error) - // GetStorageDestinationsWithResponse request - GetStorageDestinationsWithResponse(ctx context.Context, params *GetStorageDestinationsParams, reqEditors ...RequestEditorFn) (*GetStorageDestinationsResponse, error) + // ListStorageDestinationsWithResponse request + ListStorageDestinationsWithResponse(ctx context.Context, params *ListStorageDestinationsParams, reqEditors ...RequestEditorFn) (*ListStorageDestinationsResponse, error) - // PostStorageDestinationsWithBodyWithResponse request with any body - PostStorageDestinationsWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostStorageDestinationsResponse, error) + // CreateStorageDestinationWithBodyWithResponse request with any body + CreateStorageDestinationWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateStorageDestinationResponse, error) - PostStorageDestinationsWithResponse(ctx context.Context, body PostStorageDestinationsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostStorageDestinationsResponse, error) + CreateStorageDestinationWithResponse(ctx context.Context, body CreateStorageDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateStorageDestinationResponse, error) - // PostStorageDestinationsManagedEnsureWithBodyWithResponse request with any body - PostStorageDestinationsManagedEnsureWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostStorageDestinationsManagedEnsureResponse, error) + // EnsureManagedStorageDestinationWithBodyWithResponse request with any body + EnsureManagedStorageDestinationWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*EnsureManagedStorageDestinationResponse, error) - PostStorageDestinationsManagedEnsureWithResponse(ctx context.Context, body PostStorageDestinationsManagedEnsureJSONRequestBody, reqEditors ...RequestEditorFn) (*PostStorageDestinationsManagedEnsureResponse, error) + EnsureManagedStorageDestinationWithResponse(ctx context.Context, body EnsureManagedStorageDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*EnsureManagedStorageDestinationResponse, error) - // DeleteStorageDestinationsIdWithResponse request - DeleteStorageDestinationsIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteStorageDestinationsIdResponse, error) + // DeleteStorageDestinationWithResponse request + DeleteStorageDestinationWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteStorageDestinationResponse, error) - // GetStorageDestinationsIdWithResponse request - GetStorageDestinationsIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetStorageDestinationsIdResponse, error) + // GetStorageDestinationWithResponse request + GetStorageDestinationWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetStorageDestinationResponse, error) - // PatchStorageDestinationsIdWithBodyWithResponse request with any body - PatchStorageDestinationsIdWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PatchStorageDestinationsIdResponse, error) + // UpdateStorageDestinationWithBodyWithResponse request with any body + UpdateStorageDestinationWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateStorageDestinationResponse, error) - PatchStorageDestinationsIdWithResponse(ctx context.Context, id string, body PatchStorageDestinationsIdJSONRequestBody, reqEditors ...RequestEditorFn) (*PatchStorageDestinationsIdResponse, error) + UpdateStorageDestinationWithResponse(ctx context.Context, id string, body UpdateStorageDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateStorageDestinationResponse, error) } type ListAuditLogsResponse struct { @@ -4594,7 +4594,7 @@ func (r ListAuditLogActorsResponse) ContentType() string { return "" } -type GetBackupPoliciesResponse struct { +type ListBackupPoliciesResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { @@ -4607,7 +4607,7 @@ type GetBackupPoliciesResponse struct { } // Status returns HTTPResponse.Status -func (r GetBackupPoliciesResponse) Status() string { +func (r ListBackupPoliciesResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -4615,7 +4615,7 @@ func (r GetBackupPoliciesResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetBackupPoliciesResponse) StatusCode() int { +func (r ListBackupPoliciesResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -4623,14 +4623,14 @@ func (r GetBackupPoliciesResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetBackupPoliciesResponse) ContentType() string { +func (r ListBackupPoliciesResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type PostBackupPoliciesResponse struct { +type CreateBackupPolicyResponse struct { Body []byte HTTPResponse *http.Response JSON201 *PolicyhandlerPayloadCreateResponse @@ -4639,7 +4639,7 @@ type PostBackupPoliciesResponse struct { } // Status returns HTTPResponse.Status -func (r PostBackupPoliciesResponse) Status() string { +func (r CreateBackupPolicyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -4647,7 +4647,7 @@ func (r PostBackupPoliciesResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r PostBackupPoliciesResponse) StatusCode() int { +func (r CreateBackupPolicyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -4655,14 +4655,14 @@ func (r PostBackupPoliciesResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r PostBackupPoliciesResponse) ContentType() string { +func (r CreateBackupPolicyResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type PatchBackupPoliciesIdResponse struct { +type UpdateBackupPolicyResponse struct { Body []byte HTTPResponse *http.Response JSON400 *ResponseAPIError @@ -4672,7 +4672,7 @@ type PatchBackupPoliciesIdResponse struct { } // Status returns HTTPResponse.Status -func (r PatchBackupPoliciesIdResponse) Status() string { +func (r UpdateBackupPolicyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -4680,7 +4680,7 @@ func (r PatchBackupPoliciesIdResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r PatchBackupPoliciesIdResponse) StatusCode() int { +func (r UpdateBackupPolicyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -4688,14 +4688,14 @@ func (r PatchBackupPoliciesIdResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r PatchBackupPoliciesIdResponse) ContentType() string { +func (r UpdateBackupPolicyResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type GetBackupsResponse struct { +type ListBackupsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { @@ -4708,7 +4708,7 @@ type GetBackupsResponse struct { } // Status returns HTTPResponse.Status -func (r GetBackupsResponse) Status() string { +func (r ListBackupsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -4716,7 +4716,7 @@ func (r GetBackupsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetBackupsResponse) StatusCode() int { +func (r ListBackupsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -4724,14 +4724,14 @@ func (r GetBackupsResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetBackupsResponse) ContentType() string { +func (r ListBackupsResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type ListResponse struct { +type ListDatasourcesResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { @@ -4744,7 +4744,7 @@ type ListResponse struct { } // Status returns HTTPResponse.Status -func (r ListResponse) Status() string { +func (r ListDatasourcesResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -4752,7 +4752,7 @@ func (r ListResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ListResponse) StatusCode() int { +func (r ListDatasourcesResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -4760,14 +4760,14 @@ func (r ListResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r ListResponse) ContentType() string { +func (r ListDatasourcesResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type PostDatasourcesResponse struct { +type CreateDatasourceResponse struct { Body []byte HTTPResponse *http.Response JSON201 *DatasourcehandlerPayloadCreateResponse @@ -4777,7 +4777,7 @@ type PostDatasourcesResponse struct { } // Status returns HTTPResponse.Status -func (r PostDatasourcesResponse) Status() string { +func (r CreateDatasourceResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -4785,7 +4785,7 @@ func (r PostDatasourcesResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r PostDatasourcesResponse) StatusCode() int { +func (r CreateDatasourceResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -4793,7 +4793,7 @@ func (r PostDatasourcesResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r PostDatasourcesResponse) ContentType() string { +func (r CreateDatasourceResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } @@ -5100,7 +5100,7 @@ func (r ListPoliciesResponse) ContentType() string { return "" } -type PostDatasourcesDatasourceIdPoliciesResponse struct { +type AttachPolicyResponse struct { Body []byte HTTPResponse *http.Response JSON201 *DatasourcehandlerPayloadDataSourcePolicyAttachResponse @@ -5109,7 +5109,7 @@ type PostDatasourcesDatasourceIdPoliciesResponse struct { } // Status returns HTTPResponse.Status -func (r PostDatasourcesDatasourceIdPoliciesResponse) Status() string { +func (r AttachPolicyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5117,7 +5117,7 @@ func (r PostDatasourcesDatasourceIdPoliciesResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r PostDatasourcesDatasourceIdPoliciesResponse) StatusCode() int { +func (r AttachPolicyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5125,14 +5125,14 @@ func (r PostDatasourcesDatasourceIdPoliciesResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r PostDatasourcesDatasourceIdPoliciesResponse) ContentType() string { +func (r AttachPolicyResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type DeleteDatasourcesDatasourceIdPoliciesPolicyIdResponse struct { +type DetachPolicyResponse struct { Body []byte HTTPResponse *http.Response JSON400 *ResponseAPIError @@ -5140,7 +5140,7 @@ type DeleteDatasourcesDatasourceIdPoliciesPolicyIdResponse struct { } // Status returns HTTPResponse.Status -func (r DeleteDatasourcesDatasourceIdPoliciesPolicyIdResponse) Status() string { +func (r DetachPolicyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5148,7 +5148,7 @@ func (r DeleteDatasourcesDatasourceIdPoliciesPolicyIdResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r DeleteDatasourcesDatasourceIdPoliciesPolicyIdResponse) StatusCode() int { +func (r DetachPolicyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5156,7 +5156,7 @@ func (r DeleteDatasourcesDatasourceIdPoliciesPolicyIdResponse) StatusCode() int } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r DeleteDatasourcesDatasourceIdPoliciesPolicyIdResponse) ContentType() string { +func (r DetachPolicyResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } @@ -5227,7 +5227,7 @@ func (r GetRestoreCheckHistoryResponse) ContentType() string { return "" } -type GetDatasourcesDatasourceIdRestoresResponse struct { +type ListDatasourceRestoresResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { @@ -5240,7 +5240,7 @@ type GetDatasourcesDatasourceIdRestoresResponse struct { } // Status returns HTTPResponse.Status -func (r GetDatasourcesDatasourceIdRestoresResponse) Status() string { +func (r ListDatasourceRestoresResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5248,7 +5248,7 @@ func (r GetDatasourcesDatasourceIdRestoresResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetDatasourcesDatasourceIdRestoresResponse) StatusCode() int { +func (r ListDatasourceRestoresResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5256,7 +5256,7 @@ func (r GetDatasourcesDatasourceIdRestoresResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetDatasourcesDatasourceIdRestoresResponse) ContentType() string { +func (r ListDatasourceRestoresResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } @@ -5297,7 +5297,7 @@ func (r DeleteDatasourceResponse) ContentType() string { return "" } -type GetResponse struct { +type GetDatasourceResponse struct { Body []byte HTTPResponse *http.Response JSON200 *DtoDataSource @@ -5306,7 +5306,7 @@ type GetResponse struct { } // Status returns HTTPResponse.Status -func (r GetResponse) Status() string { +func (r GetDatasourceResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5314,7 +5314,7 @@ func (r GetResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetResponse) StatusCode() int { +func (r GetDatasourceResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5322,7 +5322,7 @@ func (r GetResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetResponse) ContentType() string { +func (r GetDatasourceResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } @@ -5361,7 +5361,7 @@ func (r UpdateDataSourceResponse) ContentType() string { return "" } -type PutDatasourcesIdCredentialsResponse struct { +type SetDatasourceCredentialsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *DatasourcehandlerPayloadSetCredentialsResponse @@ -5370,7 +5370,7 @@ type PutDatasourcesIdCredentialsResponse struct { } // Status returns HTTPResponse.Status -func (r PutDatasourcesIdCredentialsResponse) Status() string { +func (r SetDatasourceCredentialsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5378,7 +5378,7 @@ func (r PutDatasourcesIdCredentialsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r PutDatasourcesIdCredentialsResponse) StatusCode() int { +func (r SetDatasourceCredentialsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5386,7 +5386,7 @@ func (r PutDatasourcesIdCredentialsResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r PutDatasourcesIdCredentialsResponse) ContentType() string { +func (r SetDatasourceCredentialsResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } @@ -5584,7 +5584,7 @@ func (r TestNotificationsResponse) ContentType() string { return "" } -type PostRestoresResponse struct { +type CreateRestoreResponse struct { Body []byte HTTPResponse *http.Response JSON201 *RestorehandlerPayloadCreateResponse @@ -5594,7 +5594,7 @@ type PostRestoresResponse struct { } // Status returns HTTPResponse.Status -func (r PostRestoresResponse) Status() string { +func (r CreateRestoreResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5602,7 +5602,7 @@ func (r PostRestoresResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r PostRestoresResponse) StatusCode() int { +func (r CreateRestoreResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5610,14 +5610,14 @@ func (r PostRestoresResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r PostRestoresResponse) ContentType() string { +func (r CreateRestoreResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type PostRestoresTargetProbeResponse struct { +type ProbeRestoreTargetResponse struct { Body []byte HTTPResponse *http.Response JSON200 *RestorehandlerPayloadProbeTargetResponse @@ -5626,7 +5626,7 @@ type PostRestoresTargetProbeResponse struct { } // Status returns HTTPResponse.Status -func (r PostRestoresTargetProbeResponse) Status() string { +func (r ProbeRestoreTargetResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5634,7 +5634,7 @@ func (r PostRestoresTargetProbeResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r PostRestoresTargetProbeResponse) StatusCode() int { +func (r ProbeRestoreTargetResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5642,14 +5642,14 @@ func (r PostRestoresTargetProbeResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r PostRestoresTargetProbeResponse) ContentType() string { +func (r ProbeRestoreTargetResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type GetRestoresIdResponse struct { +type GetRestoreResponse struct { Body []byte HTTPResponse *http.Response JSON200 *DtoRestoreJob @@ -5659,7 +5659,7 @@ type GetRestoresIdResponse struct { } // Status returns HTTPResponse.Status -func (r GetRestoresIdResponse) Status() string { +func (r GetRestoreResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5667,7 +5667,7 @@ func (r GetRestoresIdResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetRestoresIdResponse) StatusCode() int { +func (r GetRestoreResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5675,14 +5675,14 @@ func (r GetRestoresIdResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetRestoresIdResponse) ContentType() string { +func (r GetRestoreResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type GetRestoresIdLogsPresignResponse struct { +type GetRestoreLogsLinkResponse struct { Body []byte HTTPResponse *http.Response JSON200 *RestorehandlerPayloadLogsPresignResponse @@ -5691,7 +5691,7 @@ type GetRestoresIdLogsPresignResponse struct { } // Status returns HTTPResponse.Status -func (r GetRestoresIdLogsPresignResponse) Status() string { +func (r GetRestoreLogsLinkResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5699,7 +5699,7 @@ func (r GetRestoresIdLogsPresignResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetRestoresIdLogsPresignResponse) StatusCode() int { +func (r GetRestoreLogsLinkResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5707,14 +5707,14 @@ func (r GetRestoresIdLogsPresignResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetRestoresIdLogsPresignResponse) ContentType() string { +func (r GetRestoreLogsLinkResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type GetStorageDestinationsResponse struct { +type ListStorageDestinationsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]PolicyhandlerPayloadStorageDestinationResponse @@ -5723,7 +5723,7 @@ type GetStorageDestinationsResponse struct { } // Status returns HTTPResponse.Status -func (r GetStorageDestinationsResponse) Status() string { +func (r ListStorageDestinationsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5731,7 +5731,7 @@ func (r GetStorageDestinationsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetStorageDestinationsResponse) StatusCode() int { +func (r ListStorageDestinationsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5739,14 +5739,14 @@ func (r GetStorageDestinationsResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetStorageDestinationsResponse) ContentType() string { +func (r ListStorageDestinationsResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type PostStorageDestinationsResponse struct { +type CreateStorageDestinationResponse struct { Body []byte HTTPResponse *http.Response JSON200 *PolicyhandlerPayloadCreateStorageDestinationResponse @@ -5756,7 +5756,7 @@ type PostStorageDestinationsResponse struct { } // Status returns HTTPResponse.Status -func (r PostStorageDestinationsResponse) Status() string { +func (r CreateStorageDestinationResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5764,7 +5764,7 @@ func (r PostStorageDestinationsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r PostStorageDestinationsResponse) StatusCode() int { +func (r CreateStorageDestinationResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5772,14 +5772,14 @@ func (r PostStorageDestinationsResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r PostStorageDestinationsResponse) ContentType() string { +func (r CreateStorageDestinationResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type PostStorageDestinationsManagedEnsureResponse struct { +type EnsureManagedStorageDestinationResponse struct { Body []byte HTTPResponse *http.Response JSON200 *PolicyhandlerPayloadEnsureManagedStorageDestinationResponse @@ -5788,7 +5788,7 @@ type PostStorageDestinationsManagedEnsureResponse struct { } // Status returns HTTPResponse.Status -func (r PostStorageDestinationsManagedEnsureResponse) Status() string { +func (r EnsureManagedStorageDestinationResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5796,7 +5796,7 @@ func (r PostStorageDestinationsManagedEnsureResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r PostStorageDestinationsManagedEnsureResponse) StatusCode() int { +func (r EnsureManagedStorageDestinationResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5804,14 +5804,14 @@ func (r PostStorageDestinationsManagedEnsureResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r PostStorageDestinationsManagedEnsureResponse) ContentType() string { +func (r EnsureManagedStorageDestinationResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type DeleteStorageDestinationsIdResponse struct { +type DeleteStorageDestinationResponse struct { Body []byte HTTPResponse *http.Response JSON400 *ResponseAPIError @@ -5821,7 +5821,7 @@ type DeleteStorageDestinationsIdResponse struct { } // Status returns HTTPResponse.Status -func (r DeleteStorageDestinationsIdResponse) Status() string { +func (r DeleteStorageDestinationResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5829,7 +5829,7 @@ func (r DeleteStorageDestinationsIdResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r DeleteStorageDestinationsIdResponse) StatusCode() int { +func (r DeleteStorageDestinationResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5837,14 +5837,14 @@ func (r DeleteStorageDestinationsIdResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r DeleteStorageDestinationsIdResponse) ContentType() string { +func (r DeleteStorageDestinationResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type GetStorageDestinationsIdResponse struct { +type GetStorageDestinationResponse struct { Body []byte HTTPResponse *http.Response JSON200 *PolicyhandlerPayloadStorageDestinationResponse @@ -5854,7 +5854,7 @@ type GetStorageDestinationsIdResponse struct { } // Status returns HTTPResponse.Status -func (r GetStorageDestinationsIdResponse) Status() string { +func (r GetStorageDestinationResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5862,7 +5862,7 @@ func (r GetStorageDestinationsIdResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetStorageDestinationsIdResponse) StatusCode() int { +func (r GetStorageDestinationResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5870,14 +5870,14 @@ func (r GetStorageDestinationsIdResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetStorageDestinationsIdResponse) ContentType() string { +func (r GetStorageDestinationResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type PatchStorageDestinationsIdResponse struct { +type UpdateStorageDestinationResponse struct { Body []byte HTTPResponse *http.Response JSON200 *PolicyhandlerPayloadStorageDestinationResponse @@ -5888,7 +5888,7 @@ type PatchStorageDestinationsIdResponse struct { } // Status returns HTTPResponse.Status -func (r PatchStorageDestinationsIdResponse) Status() string { +func (r UpdateStorageDestinationResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -5896,7 +5896,7 @@ func (r PatchStorageDestinationsIdResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r PatchStorageDestinationsIdResponse) StatusCode() int { +func (r UpdateStorageDestinationResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -5904,7 +5904,7 @@ func (r PatchStorageDestinationsIdResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r PatchStorageDestinationsIdResponse) ContentType() string { +func (r UpdateStorageDestinationResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } @@ -5929,82 +5929,82 @@ func (c *ClientWithResponses) ListAuditLogActorsWithResponse(ctx context.Context return ParseListAuditLogActorsResponse(rsp) } -// GetBackupPoliciesWithResponse request returning *GetBackupPoliciesResponse -func (c *ClientWithResponses) GetBackupPoliciesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetBackupPoliciesResponse, error) { - rsp, err := c.GetBackupPolicies(ctx, reqEditors...) +// ListBackupPoliciesWithResponse request returning *ListBackupPoliciesResponse +func (c *ClientWithResponses) ListBackupPoliciesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListBackupPoliciesResponse, error) { + rsp, err := c.ListBackupPolicies(ctx, reqEditors...) if err != nil { return nil, err } - return ParseGetBackupPoliciesResponse(rsp) + return ParseListBackupPoliciesResponse(rsp) } -// PostBackupPoliciesWithBodyWithResponse request with arbitrary body returning *PostBackupPoliciesResponse -func (c *ClientWithResponses) PostBackupPoliciesWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostBackupPoliciesResponse, error) { - rsp, err := c.PostBackupPoliciesWithBody(ctx, contentType, body, reqEditors...) +// CreateBackupPolicyWithBodyWithResponse request with arbitrary body returning *CreateBackupPolicyResponse +func (c *ClientWithResponses) CreateBackupPolicyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateBackupPolicyResponse, error) { + rsp, err := c.CreateBackupPolicyWithBody(ctx, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParsePostBackupPoliciesResponse(rsp) + return ParseCreateBackupPolicyResponse(rsp) } -func (c *ClientWithResponses) PostBackupPoliciesWithResponse(ctx context.Context, body PostBackupPoliciesJSONRequestBody, reqEditors ...RequestEditorFn) (*PostBackupPoliciesResponse, error) { - rsp, err := c.PostBackupPolicies(ctx, body, reqEditors...) +func (c *ClientWithResponses) CreateBackupPolicyWithResponse(ctx context.Context, body CreateBackupPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateBackupPolicyResponse, error) { + rsp, err := c.CreateBackupPolicy(ctx, body, reqEditors...) if err != nil { return nil, err } - return ParsePostBackupPoliciesResponse(rsp) + return ParseCreateBackupPolicyResponse(rsp) } -// PatchBackupPoliciesIdWithBodyWithResponse request with arbitrary body returning *PatchBackupPoliciesIdResponse -func (c *ClientWithResponses) PatchBackupPoliciesIdWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PatchBackupPoliciesIdResponse, error) { - rsp, err := c.PatchBackupPoliciesIdWithBody(ctx, id, contentType, body, reqEditors...) +// UpdateBackupPolicyWithBodyWithResponse request with arbitrary body returning *UpdateBackupPolicyResponse +func (c *ClientWithResponses) UpdateBackupPolicyWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateBackupPolicyResponse, error) { + rsp, err := c.UpdateBackupPolicyWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParsePatchBackupPoliciesIdResponse(rsp) + return ParseUpdateBackupPolicyResponse(rsp) } -func (c *ClientWithResponses) PatchBackupPoliciesIdWithResponse(ctx context.Context, id string, body PatchBackupPoliciesIdJSONRequestBody, reqEditors ...RequestEditorFn) (*PatchBackupPoliciesIdResponse, error) { - rsp, err := c.PatchBackupPoliciesId(ctx, id, body, reqEditors...) +func (c *ClientWithResponses) UpdateBackupPolicyWithResponse(ctx context.Context, id string, body UpdateBackupPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateBackupPolicyResponse, error) { + rsp, err := c.UpdateBackupPolicy(ctx, id, body, reqEditors...) if err != nil { return nil, err } - return ParsePatchBackupPoliciesIdResponse(rsp) + return ParseUpdateBackupPolicyResponse(rsp) } -// GetBackupsWithResponse request returning *GetBackupsResponse -func (c *ClientWithResponses) GetBackupsWithResponse(ctx context.Context, params *GetBackupsParams, reqEditors ...RequestEditorFn) (*GetBackupsResponse, error) { - rsp, err := c.GetBackups(ctx, params, reqEditors...) +// ListBackupsWithResponse request returning *ListBackupsResponse +func (c *ClientWithResponses) ListBackupsWithResponse(ctx context.Context, params *ListBackupsParams, reqEditors ...RequestEditorFn) (*ListBackupsResponse, error) { + rsp, err := c.ListBackups(ctx, params, reqEditors...) if err != nil { return nil, err } - return ParseGetBackupsResponse(rsp) + return ParseListBackupsResponse(rsp) } -// ListWithResponse request returning *ListResponse -func (c *ClientWithResponses) ListWithResponse(ctx context.Context, params *ListParams, reqEditors ...RequestEditorFn) (*ListResponse, error) { - rsp, err := c.List(ctx, params, reqEditors...) +// ListDatasourcesWithResponse request returning *ListDatasourcesResponse +func (c *ClientWithResponses) ListDatasourcesWithResponse(ctx context.Context, params *ListDatasourcesParams, reqEditors ...RequestEditorFn) (*ListDatasourcesResponse, error) { + rsp, err := c.ListDatasources(ctx, params, reqEditors...) if err != nil { return nil, err } - return ParseListResponse(rsp) + return ParseListDatasourcesResponse(rsp) } -// PostDatasourcesWithBodyWithResponse request with arbitrary body returning *PostDatasourcesResponse -func (c *ClientWithResponses) PostDatasourcesWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostDatasourcesResponse, error) { - rsp, err := c.PostDatasourcesWithBody(ctx, contentType, body, reqEditors...) +// CreateDatasourceWithBodyWithResponse request with arbitrary body returning *CreateDatasourceResponse +func (c *ClientWithResponses) CreateDatasourceWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDatasourceResponse, error) { + rsp, err := c.CreateDatasourceWithBody(ctx, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParsePostDatasourcesResponse(rsp) + return ParseCreateDatasourceResponse(rsp) } -func (c *ClientWithResponses) PostDatasourcesWithResponse(ctx context.Context, body PostDatasourcesJSONRequestBody, reqEditors ...RequestEditorFn) (*PostDatasourcesResponse, error) { - rsp, err := c.PostDatasources(ctx, body, reqEditors...) +func (c *ClientWithResponses) CreateDatasourceWithResponse(ctx context.Context, body CreateDatasourceJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDatasourceResponse, error) { + rsp, err := c.CreateDatasource(ctx, body, reqEditors...) if err != nil { return nil, err } - return ParsePostDatasourcesResponse(rsp) + return ParseCreateDatasourceResponse(rsp) } // ProtectDatasourceWithBodyWithResponse request with arbitrary body returning *ProtectDatasourceResponse @@ -6104,30 +6104,30 @@ func (c *ClientWithResponses) ListPoliciesWithResponse(ctx context.Context, data return ParseListPoliciesResponse(rsp) } -// PostDatasourcesDatasourceIdPoliciesWithBodyWithResponse request with arbitrary body returning *PostDatasourcesDatasourceIdPoliciesResponse -func (c *ClientWithResponses) PostDatasourcesDatasourceIdPoliciesWithBodyWithResponse(ctx context.Context, datasourceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostDatasourcesDatasourceIdPoliciesResponse, error) { - rsp, err := c.PostDatasourcesDatasourceIdPoliciesWithBody(ctx, datasourceId, contentType, body, reqEditors...) +// AttachPolicyWithBodyWithResponse request with arbitrary body returning *AttachPolicyResponse +func (c *ClientWithResponses) AttachPolicyWithBodyWithResponse(ctx context.Context, datasourceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AttachPolicyResponse, error) { + rsp, err := c.AttachPolicyWithBody(ctx, datasourceId, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParsePostDatasourcesDatasourceIdPoliciesResponse(rsp) + return ParseAttachPolicyResponse(rsp) } -func (c *ClientWithResponses) PostDatasourcesDatasourceIdPoliciesWithResponse(ctx context.Context, datasourceId string, body PostDatasourcesDatasourceIdPoliciesJSONRequestBody, reqEditors ...RequestEditorFn) (*PostDatasourcesDatasourceIdPoliciesResponse, error) { - rsp, err := c.PostDatasourcesDatasourceIdPolicies(ctx, datasourceId, body, reqEditors...) +func (c *ClientWithResponses) AttachPolicyWithResponse(ctx context.Context, datasourceId string, body AttachPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*AttachPolicyResponse, error) { + rsp, err := c.AttachPolicy(ctx, datasourceId, body, reqEditors...) if err != nil { return nil, err } - return ParsePostDatasourcesDatasourceIdPoliciesResponse(rsp) + return ParseAttachPolicyResponse(rsp) } -// DeleteDatasourcesDatasourceIdPoliciesPolicyIdWithResponse request returning *DeleteDatasourcesDatasourceIdPoliciesPolicyIdResponse -func (c *ClientWithResponses) DeleteDatasourcesDatasourceIdPoliciesPolicyIdWithResponse(ctx context.Context, datasourceId string, policyId string, reqEditors ...RequestEditorFn) (*DeleteDatasourcesDatasourceIdPoliciesPolicyIdResponse, error) { - rsp, err := c.DeleteDatasourcesDatasourceIdPoliciesPolicyId(ctx, datasourceId, policyId, reqEditors...) +// DetachPolicyWithResponse request returning *DetachPolicyResponse +func (c *ClientWithResponses) DetachPolicyWithResponse(ctx context.Context, datasourceId string, policyId string, reqEditors ...RequestEditorFn) (*DetachPolicyResponse, error) { + rsp, err := c.DetachPolicy(ctx, datasourceId, policyId, reqEditors...) if err != nil { return nil, err } - return ParseDeleteDatasourcesDatasourceIdPoliciesPolicyIdResponse(rsp) + return ParseDetachPolicyResponse(rsp) } // UpdatePolicyAttachmentWithBodyWithResponse request with arbitrary body returning *UpdatePolicyAttachmentResponse @@ -6156,13 +6156,13 @@ func (c *ClientWithResponses) GetRestoreCheckHistoryWithResponse(ctx context.Con return ParseGetRestoreCheckHistoryResponse(rsp) } -// GetDatasourcesDatasourceIdRestoresWithResponse request returning *GetDatasourcesDatasourceIdRestoresResponse -func (c *ClientWithResponses) GetDatasourcesDatasourceIdRestoresWithResponse(ctx context.Context, datasourceId string, params *GetDatasourcesDatasourceIdRestoresParams, reqEditors ...RequestEditorFn) (*GetDatasourcesDatasourceIdRestoresResponse, error) { - rsp, err := c.GetDatasourcesDatasourceIdRestores(ctx, datasourceId, params, reqEditors...) +// ListDatasourceRestoresWithResponse request returning *ListDatasourceRestoresResponse +func (c *ClientWithResponses) ListDatasourceRestoresWithResponse(ctx context.Context, datasourceId string, params *ListDatasourceRestoresParams, reqEditors ...RequestEditorFn) (*ListDatasourceRestoresResponse, error) { + rsp, err := c.ListDatasourceRestores(ctx, datasourceId, params, reqEditors...) if err != nil { return nil, err } - return ParseGetDatasourcesDatasourceIdRestoresResponse(rsp) + return ParseListDatasourceRestoresResponse(rsp) } // DeleteDatasourceWithBodyWithResponse request with arbitrary body returning *DeleteDatasourceResponse @@ -6182,13 +6182,13 @@ func (c *ClientWithResponses) DeleteDatasourceWithResponse(ctx context.Context, return ParseDeleteDatasourceResponse(rsp) } -// GetWithResponse request returning *GetResponse -func (c *ClientWithResponses) GetWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetResponse, error) { - rsp, err := c.Get(ctx, id, reqEditors...) +// GetDatasourceWithResponse request returning *GetDatasourceResponse +func (c *ClientWithResponses) GetDatasourceWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetDatasourceResponse, error) { + rsp, err := c.GetDatasource(ctx, id, reqEditors...) if err != nil { return nil, err } - return ParseGetResponse(rsp) + return ParseGetDatasourceResponse(rsp) } // UpdateDataSourceWithBodyWithResponse request with arbitrary body returning *UpdateDataSourceResponse @@ -6208,21 +6208,21 @@ func (c *ClientWithResponses) UpdateDataSourceWithResponse(ctx context.Context, return ParseUpdateDataSourceResponse(rsp) } -// PutDatasourcesIdCredentialsWithBodyWithResponse request with arbitrary body returning *PutDatasourcesIdCredentialsResponse -func (c *ClientWithResponses) PutDatasourcesIdCredentialsWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutDatasourcesIdCredentialsResponse, error) { - rsp, err := c.PutDatasourcesIdCredentialsWithBody(ctx, id, contentType, body, reqEditors...) +// SetDatasourceCredentialsWithBodyWithResponse request with arbitrary body returning *SetDatasourceCredentialsResponse +func (c *ClientWithResponses) SetDatasourceCredentialsWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetDatasourceCredentialsResponse, error) { + rsp, err := c.SetDatasourceCredentialsWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParsePutDatasourcesIdCredentialsResponse(rsp) + return ParseSetDatasourceCredentialsResponse(rsp) } -func (c *ClientWithResponses) PutDatasourcesIdCredentialsWithResponse(ctx context.Context, id string, body PutDatasourcesIdCredentialsJSONRequestBody, reqEditors ...RequestEditorFn) (*PutDatasourcesIdCredentialsResponse, error) { - rsp, err := c.PutDatasourcesIdCredentials(ctx, id, body, reqEditors...) +func (c *ClientWithResponses) SetDatasourceCredentialsWithResponse(ctx context.Context, id string, body SetDatasourceCredentialsJSONRequestBody, reqEditors ...RequestEditorFn) (*SetDatasourceCredentialsResponse, error) { + rsp, err := c.SetDatasourceCredentials(ctx, id, body, reqEditors...) if err != nil { return nil, err } - return ParsePutDatasourcesIdCredentialsResponse(rsp) + return ParseSetDatasourceCredentialsResponse(rsp) } // GetRestoreCheckWithResponse request returning *GetRestoreCheckResponse @@ -6295,134 +6295,134 @@ func (c *ClientWithResponses) TestNotificationsWithResponse(ctx context.Context, return ParseTestNotificationsResponse(rsp) } -// PostRestoresWithBodyWithResponse request with arbitrary body returning *PostRestoresResponse -func (c *ClientWithResponses) PostRestoresWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostRestoresResponse, error) { - rsp, err := c.PostRestoresWithBody(ctx, contentType, body, reqEditors...) +// CreateRestoreWithBodyWithResponse request with arbitrary body returning *CreateRestoreResponse +func (c *ClientWithResponses) CreateRestoreWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateRestoreResponse, error) { + rsp, err := c.CreateRestoreWithBody(ctx, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParsePostRestoresResponse(rsp) + return ParseCreateRestoreResponse(rsp) } -func (c *ClientWithResponses) PostRestoresWithResponse(ctx context.Context, body PostRestoresJSONRequestBody, reqEditors ...RequestEditorFn) (*PostRestoresResponse, error) { - rsp, err := c.PostRestores(ctx, body, reqEditors...) +func (c *ClientWithResponses) CreateRestoreWithResponse(ctx context.Context, body CreateRestoreJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateRestoreResponse, error) { + rsp, err := c.CreateRestore(ctx, body, reqEditors...) if err != nil { return nil, err } - return ParsePostRestoresResponse(rsp) + return ParseCreateRestoreResponse(rsp) } -// PostRestoresTargetProbeWithBodyWithResponse request with arbitrary body returning *PostRestoresTargetProbeResponse -func (c *ClientWithResponses) PostRestoresTargetProbeWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostRestoresTargetProbeResponse, error) { - rsp, err := c.PostRestoresTargetProbeWithBody(ctx, contentType, body, reqEditors...) +// ProbeRestoreTargetWithBodyWithResponse request with arbitrary body returning *ProbeRestoreTargetResponse +func (c *ClientWithResponses) ProbeRestoreTargetWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ProbeRestoreTargetResponse, error) { + rsp, err := c.ProbeRestoreTargetWithBody(ctx, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParsePostRestoresTargetProbeResponse(rsp) + return ParseProbeRestoreTargetResponse(rsp) } -func (c *ClientWithResponses) PostRestoresTargetProbeWithResponse(ctx context.Context, body PostRestoresTargetProbeJSONRequestBody, reqEditors ...RequestEditorFn) (*PostRestoresTargetProbeResponse, error) { - rsp, err := c.PostRestoresTargetProbe(ctx, body, reqEditors...) +func (c *ClientWithResponses) ProbeRestoreTargetWithResponse(ctx context.Context, body ProbeRestoreTargetJSONRequestBody, reqEditors ...RequestEditorFn) (*ProbeRestoreTargetResponse, error) { + rsp, err := c.ProbeRestoreTarget(ctx, body, reqEditors...) if err != nil { return nil, err } - return ParsePostRestoresTargetProbeResponse(rsp) + return ParseProbeRestoreTargetResponse(rsp) } -// GetRestoresIdWithResponse request returning *GetRestoresIdResponse -func (c *ClientWithResponses) GetRestoresIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetRestoresIdResponse, error) { - rsp, err := c.GetRestoresId(ctx, id, reqEditors...) +// GetRestoreWithResponse request returning *GetRestoreResponse +func (c *ClientWithResponses) GetRestoreWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetRestoreResponse, error) { + rsp, err := c.GetRestore(ctx, id, reqEditors...) if err != nil { return nil, err } - return ParseGetRestoresIdResponse(rsp) + return ParseGetRestoreResponse(rsp) } -// GetRestoresIdLogsPresignWithResponse request returning *GetRestoresIdLogsPresignResponse -func (c *ClientWithResponses) GetRestoresIdLogsPresignWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetRestoresIdLogsPresignResponse, error) { - rsp, err := c.GetRestoresIdLogsPresign(ctx, id, reqEditors...) +// GetRestoreLogsLinkWithResponse request returning *GetRestoreLogsLinkResponse +func (c *ClientWithResponses) GetRestoreLogsLinkWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetRestoreLogsLinkResponse, error) { + rsp, err := c.GetRestoreLogsLink(ctx, id, reqEditors...) if err != nil { return nil, err } - return ParseGetRestoresIdLogsPresignResponse(rsp) + return ParseGetRestoreLogsLinkResponse(rsp) } -// GetStorageDestinationsWithResponse request returning *GetStorageDestinationsResponse -func (c *ClientWithResponses) GetStorageDestinationsWithResponse(ctx context.Context, params *GetStorageDestinationsParams, reqEditors ...RequestEditorFn) (*GetStorageDestinationsResponse, error) { - rsp, err := c.GetStorageDestinations(ctx, params, reqEditors...) +// ListStorageDestinationsWithResponse request returning *ListStorageDestinationsResponse +func (c *ClientWithResponses) ListStorageDestinationsWithResponse(ctx context.Context, params *ListStorageDestinationsParams, reqEditors ...RequestEditorFn) (*ListStorageDestinationsResponse, error) { + rsp, err := c.ListStorageDestinations(ctx, params, reqEditors...) if err != nil { return nil, err } - return ParseGetStorageDestinationsResponse(rsp) + return ParseListStorageDestinationsResponse(rsp) } -// PostStorageDestinationsWithBodyWithResponse request with arbitrary body returning *PostStorageDestinationsResponse -func (c *ClientWithResponses) PostStorageDestinationsWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostStorageDestinationsResponse, error) { - rsp, err := c.PostStorageDestinationsWithBody(ctx, contentType, body, reqEditors...) +// CreateStorageDestinationWithBodyWithResponse request with arbitrary body returning *CreateStorageDestinationResponse +func (c *ClientWithResponses) CreateStorageDestinationWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateStorageDestinationResponse, error) { + rsp, err := c.CreateStorageDestinationWithBody(ctx, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParsePostStorageDestinationsResponse(rsp) + return ParseCreateStorageDestinationResponse(rsp) } -func (c *ClientWithResponses) PostStorageDestinationsWithResponse(ctx context.Context, body PostStorageDestinationsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostStorageDestinationsResponse, error) { - rsp, err := c.PostStorageDestinations(ctx, body, reqEditors...) +func (c *ClientWithResponses) CreateStorageDestinationWithResponse(ctx context.Context, body CreateStorageDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateStorageDestinationResponse, error) { + rsp, err := c.CreateStorageDestination(ctx, body, reqEditors...) if err != nil { return nil, err } - return ParsePostStorageDestinationsResponse(rsp) + return ParseCreateStorageDestinationResponse(rsp) } -// PostStorageDestinationsManagedEnsureWithBodyWithResponse request with arbitrary body returning *PostStorageDestinationsManagedEnsureResponse -func (c *ClientWithResponses) PostStorageDestinationsManagedEnsureWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostStorageDestinationsManagedEnsureResponse, error) { - rsp, err := c.PostStorageDestinationsManagedEnsureWithBody(ctx, contentType, body, reqEditors...) +// EnsureManagedStorageDestinationWithBodyWithResponse request with arbitrary body returning *EnsureManagedStorageDestinationResponse +func (c *ClientWithResponses) EnsureManagedStorageDestinationWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*EnsureManagedStorageDestinationResponse, error) { + rsp, err := c.EnsureManagedStorageDestinationWithBody(ctx, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParsePostStorageDestinationsManagedEnsureResponse(rsp) + return ParseEnsureManagedStorageDestinationResponse(rsp) } -func (c *ClientWithResponses) PostStorageDestinationsManagedEnsureWithResponse(ctx context.Context, body PostStorageDestinationsManagedEnsureJSONRequestBody, reqEditors ...RequestEditorFn) (*PostStorageDestinationsManagedEnsureResponse, error) { - rsp, err := c.PostStorageDestinationsManagedEnsure(ctx, body, reqEditors...) +func (c *ClientWithResponses) EnsureManagedStorageDestinationWithResponse(ctx context.Context, body EnsureManagedStorageDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*EnsureManagedStorageDestinationResponse, error) { + rsp, err := c.EnsureManagedStorageDestination(ctx, body, reqEditors...) if err != nil { return nil, err } - return ParsePostStorageDestinationsManagedEnsureResponse(rsp) + return ParseEnsureManagedStorageDestinationResponse(rsp) } -// DeleteStorageDestinationsIdWithResponse request returning *DeleteStorageDestinationsIdResponse -func (c *ClientWithResponses) DeleteStorageDestinationsIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteStorageDestinationsIdResponse, error) { - rsp, err := c.DeleteStorageDestinationsId(ctx, id, reqEditors...) +// DeleteStorageDestinationWithResponse request returning *DeleteStorageDestinationResponse +func (c *ClientWithResponses) DeleteStorageDestinationWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteStorageDestinationResponse, error) { + rsp, err := c.DeleteStorageDestination(ctx, id, reqEditors...) if err != nil { return nil, err } - return ParseDeleteStorageDestinationsIdResponse(rsp) + return ParseDeleteStorageDestinationResponse(rsp) } -// GetStorageDestinationsIdWithResponse request returning *GetStorageDestinationsIdResponse -func (c *ClientWithResponses) GetStorageDestinationsIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetStorageDestinationsIdResponse, error) { - rsp, err := c.GetStorageDestinationsId(ctx, id, reqEditors...) +// GetStorageDestinationWithResponse request returning *GetStorageDestinationResponse +func (c *ClientWithResponses) GetStorageDestinationWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetStorageDestinationResponse, error) { + rsp, err := c.GetStorageDestination(ctx, id, reqEditors...) if err != nil { return nil, err } - return ParseGetStorageDestinationsIdResponse(rsp) + return ParseGetStorageDestinationResponse(rsp) } -// PatchStorageDestinationsIdWithBodyWithResponse request with arbitrary body returning *PatchStorageDestinationsIdResponse -func (c *ClientWithResponses) PatchStorageDestinationsIdWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PatchStorageDestinationsIdResponse, error) { - rsp, err := c.PatchStorageDestinationsIdWithBody(ctx, id, contentType, body, reqEditors...) +// UpdateStorageDestinationWithBodyWithResponse request with arbitrary body returning *UpdateStorageDestinationResponse +func (c *ClientWithResponses) UpdateStorageDestinationWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateStorageDestinationResponse, error) { + rsp, err := c.UpdateStorageDestinationWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParsePatchStorageDestinationsIdResponse(rsp) + return ParseUpdateStorageDestinationResponse(rsp) } -func (c *ClientWithResponses) PatchStorageDestinationsIdWithResponse(ctx context.Context, id string, body PatchStorageDestinationsIdJSONRequestBody, reqEditors ...RequestEditorFn) (*PatchStorageDestinationsIdResponse, error) { - rsp, err := c.PatchStorageDestinationsId(ctx, id, body, reqEditors...) +func (c *ClientWithResponses) UpdateStorageDestinationWithResponse(ctx context.Context, id string, body UpdateStorageDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateStorageDestinationResponse, error) { + rsp, err := c.UpdateStorageDestination(ctx, id, body, reqEditors...) if err != nil { return nil, err } - return ParsePatchStorageDestinationsIdResponse(rsp) + return ParseUpdateStorageDestinationResponse(rsp) } // ParseListAuditLogsResponse parses an HTTP response from a ListAuditLogsWithResponse call @@ -6505,15 +6505,15 @@ func ParseListAuditLogActorsResponse(rsp *http.Response) (*ListAuditLogActorsRes return response, nil } -// ParseGetBackupPoliciesResponse parses an HTTP response from a GetBackupPoliciesWithResponse call -func ParseGetBackupPoliciesResponse(rsp *http.Response) (*GetBackupPoliciesResponse, error) { +// ParseListBackupPoliciesResponse parses an HTTP response from a ListBackupPoliciesWithResponse call +func ParseListBackupPoliciesResponse(rsp *http.Response) (*ListBackupPoliciesResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetBackupPoliciesResponse{ + response := &ListBackupPoliciesResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -6549,15 +6549,15 @@ func ParseGetBackupPoliciesResponse(rsp *http.Response) (*GetBackupPoliciesRespo return response, nil } -// ParsePostBackupPoliciesResponse parses an HTTP response from a PostBackupPoliciesWithResponse call -func ParsePostBackupPoliciesResponse(rsp *http.Response) (*PostBackupPoliciesResponse, error) { +// ParseCreateBackupPolicyResponse parses an HTTP response from a CreateBackupPolicyWithResponse call +func ParseCreateBackupPolicyResponse(rsp *http.Response) (*CreateBackupPolicyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PostBackupPoliciesResponse{ + response := &CreateBackupPolicyResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -6589,15 +6589,15 @@ func ParsePostBackupPoliciesResponse(rsp *http.Response) (*PostBackupPoliciesRes return response, nil } -// ParsePatchBackupPoliciesIdResponse parses an HTTP response from a PatchBackupPoliciesIdWithResponse call -func ParsePatchBackupPoliciesIdResponse(rsp *http.Response) (*PatchBackupPoliciesIdResponse, error) { +// ParseUpdateBackupPolicyResponse parses an HTTP response from a UpdateBackupPolicyWithResponse call +func ParseUpdateBackupPolicyResponse(rsp *http.Response) (*UpdateBackupPolicyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PatchBackupPoliciesIdResponse{ + response := &UpdateBackupPolicyResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -6636,15 +6636,15 @@ func ParsePatchBackupPoliciesIdResponse(rsp *http.Response) (*PatchBackupPolicie return response, nil } -// ParseGetBackupsResponse parses an HTTP response from a GetBackupsWithResponse call -func ParseGetBackupsResponse(rsp *http.Response) (*GetBackupsResponse, error) { +// ParseListBackupsResponse parses an HTTP response from a ListBackupsWithResponse call +func ParseListBackupsResponse(rsp *http.Response) (*ListBackupsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetBackupsResponse{ + response := &ListBackupsResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -6680,15 +6680,15 @@ func ParseGetBackupsResponse(rsp *http.Response) (*GetBackupsResponse, error) { return response, nil } -// ParseListResponse parses an HTTP response from a ListWithResponse call -func ParseListResponse(rsp *http.Response) (*ListResponse, error) { +// ParseListDatasourcesResponse parses an HTTP response from a ListDatasourcesWithResponse call +func ParseListDatasourcesResponse(rsp *http.Response) (*ListDatasourcesResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ListResponse{ + response := &ListDatasourcesResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -6724,15 +6724,15 @@ func ParseListResponse(rsp *http.Response) (*ListResponse, error) { return response, nil } -// ParsePostDatasourcesResponse parses an HTTP response from a PostDatasourcesWithResponse call -func ParsePostDatasourcesResponse(rsp *http.Response) (*PostDatasourcesResponse, error) { +// ParseCreateDatasourceResponse parses an HTTP response from a CreateDatasourceWithResponse call +func ParseCreateDatasourceResponse(rsp *http.Response) (*CreateDatasourceResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PostDatasourcesResponse{ + response := &CreateDatasourceResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -7191,15 +7191,15 @@ func ParseListPoliciesResponse(rsp *http.Response) (*ListPoliciesResponse, error return response, nil } -// ParsePostDatasourcesDatasourceIdPoliciesResponse parses an HTTP response from a PostDatasourcesDatasourceIdPoliciesWithResponse call -func ParsePostDatasourcesDatasourceIdPoliciesResponse(rsp *http.Response) (*PostDatasourcesDatasourceIdPoliciesResponse, error) { +// ParseAttachPolicyResponse parses an HTTP response from a AttachPolicyWithResponse call +func ParseAttachPolicyResponse(rsp *http.Response) (*AttachPolicyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PostDatasourcesDatasourceIdPoliciesResponse{ + response := &AttachPolicyResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -7231,15 +7231,15 @@ func ParsePostDatasourcesDatasourceIdPoliciesResponse(rsp *http.Response) (*Post return response, nil } -// ParseDeleteDatasourcesDatasourceIdPoliciesPolicyIdResponse parses an HTTP response from a DeleteDatasourcesDatasourceIdPoliciesPolicyIdWithResponse call -func ParseDeleteDatasourcesDatasourceIdPoliciesPolicyIdResponse(rsp *http.Response) (*DeleteDatasourcesDatasourceIdPoliciesPolicyIdResponse, error) { +// ParseDetachPolicyResponse parses an HTTP response from a DetachPolicyWithResponse call +func ParseDetachPolicyResponse(rsp *http.Response) (*DetachPolicyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &DeleteDatasourcesDatasourceIdPoliciesPolicyIdResponse{ + response := &DetachPolicyResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -7344,15 +7344,15 @@ func ParseGetRestoreCheckHistoryResponse(rsp *http.Response) (*GetRestoreCheckHi return response, nil } -// ParseGetDatasourcesDatasourceIdRestoresResponse parses an HTTP response from a GetDatasourcesDatasourceIdRestoresWithResponse call -func ParseGetDatasourcesDatasourceIdRestoresResponse(rsp *http.Response) (*GetDatasourcesDatasourceIdRestoresResponse, error) { +// ParseListDatasourceRestoresResponse parses an HTTP response from a ListDatasourceRestoresWithResponse call +func ParseListDatasourceRestoresResponse(rsp *http.Response) (*ListDatasourceRestoresResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetDatasourcesDatasourceIdRestoresResponse{ + response := &ListDatasourceRestoresResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -7442,15 +7442,15 @@ func ParseDeleteDatasourceResponse(rsp *http.Response) (*DeleteDatasourceRespons return response, nil } -// ParseGetResponse parses an HTTP response from a GetWithResponse call -func ParseGetResponse(rsp *http.Response) (*GetResponse, error) { +// ParseGetDatasourceResponse parses an HTTP response from a GetDatasourceWithResponse call +func ParseGetDatasourceResponse(rsp *http.Response) (*GetDatasourceResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetResponse{ + response := &GetDatasourceResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -7522,15 +7522,15 @@ func ParseUpdateDataSourceResponse(rsp *http.Response) (*UpdateDataSourceRespons return response, nil } -// ParsePutDatasourcesIdCredentialsResponse parses an HTTP response from a PutDatasourcesIdCredentialsWithResponse call -func ParsePutDatasourcesIdCredentialsResponse(rsp *http.Response) (*PutDatasourcesIdCredentialsResponse, error) { +// ParseSetDatasourceCredentialsResponse parses an HTTP response from a SetDatasourceCredentialsWithResponse call +func ParseSetDatasourceCredentialsResponse(rsp *http.Response) (*SetDatasourceCredentialsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PutDatasourcesIdCredentialsResponse{ + response := &SetDatasourceCredentialsResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -7795,15 +7795,15 @@ func ParseTestNotificationsResponse(rsp *http.Response) (*TestNotificationsRespo return response, nil } -// ParsePostRestoresResponse parses an HTTP response from a PostRestoresWithResponse call -func ParsePostRestoresResponse(rsp *http.Response) (*PostRestoresResponse, error) { +// ParseCreateRestoreResponse parses an HTTP response from a CreateRestoreWithResponse call +func ParseCreateRestoreResponse(rsp *http.Response) (*CreateRestoreResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PostRestoresResponse{ + response := &CreateRestoreResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -7842,15 +7842,15 @@ func ParsePostRestoresResponse(rsp *http.Response) (*PostRestoresResponse, error return response, nil } -// ParsePostRestoresTargetProbeResponse parses an HTTP response from a PostRestoresTargetProbeWithResponse call -func ParsePostRestoresTargetProbeResponse(rsp *http.Response) (*PostRestoresTargetProbeResponse, error) { +// ParseProbeRestoreTargetResponse parses an HTTP response from a ProbeRestoreTargetWithResponse call +func ParseProbeRestoreTargetResponse(rsp *http.Response) (*ProbeRestoreTargetResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PostRestoresTargetProbeResponse{ + response := &ProbeRestoreTargetResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -7882,15 +7882,15 @@ func ParsePostRestoresTargetProbeResponse(rsp *http.Response) (*PostRestoresTarg return response, nil } -// ParseGetRestoresIdResponse parses an HTTP response from a GetRestoresIdWithResponse call -func ParseGetRestoresIdResponse(rsp *http.Response) (*GetRestoresIdResponse, error) { +// ParseGetRestoreResponse parses an HTTP response from a GetRestoreWithResponse call +func ParseGetRestoreResponse(rsp *http.Response) (*GetRestoreResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetRestoresIdResponse{ + response := &GetRestoreResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -7929,15 +7929,15 @@ func ParseGetRestoresIdResponse(rsp *http.Response) (*GetRestoresIdResponse, err return response, nil } -// ParseGetRestoresIdLogsPresignResponse parses an HTTP response from a GetRestoresIdLogsPresignWithResponse call -func ParseGetRestoresIdLogsPresignResponse(rsp *http.Response) (*GetRestoresIdLogsPresignResponse, error) { +// ParseGetRestoreLogsLinkResponse parses an HTTP response from a GetRestoreLogsLinkWithResponse call +func ParseGetRestoreLogsLinkResponse(rsp *http.Response) (*GetRestoreLogsLinkResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetRestoresIdLogsPresignResponse{ + response := &GetRestoreLogsLinkResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -7969,15 +7969,15 @@ func ParseGetRestoresIdLogsPresignResponse(rsp *http.Response) (*GetRestoresIdLo return response, nil } -// ParseGetStorageDestinationsResponse parses an HTTP response from a GetStorageDestinationsWithResponse call -func ParseGetStorageDestinationsResponse(rsp *http.Response) (*GetStorageDestinationsResponse, error) { +// ParseListStorageDestinationsResponse parses an HTTP response from a ListStorageDestinationsWithResponse call +func ParseListStorageDestinationsResponse(rsp *http.Response) (*ListStorageDestinationsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetStorageDestinationsResponse{ + response := &ListStorageDestinationsResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -8009,15 +8009,15 @@ func ParseGetStorageDestinationsResponse(rsp *http.Response) (*GetStorageDestina return response, nil } -// ParsePostStorageDestinationsResponse parses an HTTP response from a PostStorageDestinationsWithResponse call -func ParsePostStorageDestinationsResponse(rsp *http.Response) (*PostStorageDestinationsResponse, error) { +// ParseCreateStorageDestinationResponse parses an HTTP response from a CreateStorageDestinationWithResponse call +func ParseCreateStorageDestinationResponse(rsp *http.Response) (*CreateStorageDestinationResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PostStorageDestinationsResponse{ + response := &CreateStorageDestinationResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -8056,15 +8056,15 @@ func ParsePostStorageDestinationsResponse(rsp *http.Response) (*PostStorageDesti return response, nil } -// ParsePostStorageDestinationsManagedEnsureResponse parses an HTTP response from a PostStorageDestinationsManagedEnsureWithResponse call -func ParsePostStorageDestinationsManagedEnsureResponse(rsp *http.Response) (*PostStorageDestinationsManagedEnsureResponse, error) { +// ParseEnsureManagedStorageDestinationResponse parses an HTTP response from a EnsureManagedStorageDestinationWithResponse call +func ParseEnsureManagedStorageDestinationResponse(rsp *http.Response) (*EnsureManagedStorageDestinationResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PostStorageDestinationsManagedEnsureResponse{ + response := &EnsureManagedStorageDestinationResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -8096,15 +8096,15 @@ func ParsePostStorageDestinationsManagedEnsureResponse(rsp *http.Response) (*Pos return response, nil } -// ParseDeleteStorageDestinationsIdResponse parses an HTTP response from a DeleteStorageDestinationsIdWithResponse call -func ParseDeleteStorageDestinationsIdResponse(rsp *http.Response) (*DeleteStorageDestinationsIdResponse, error) { +// ParseDeleteStorageDestinationResponse parses an HTTP response from a DeleteStorageDestinationWithResponse call +func ParseDeleteStorageDestinationResponse(rsp *http.Response) (*DeleteStorageDestinationResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &DeleteStorageDestinationsIdResponse{ + response := &DeleteStorageDestinationResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -8143,15 +8143,15 @@ func ParseDeleteStorageDestinationsIdResponse(rsp *http.Response) (*DeleteStorag return response, nil } -// ParseGetStorageDestinationsIdResponse parses an HTTP response from a GetStorageDestinationsIdWithResponse call -func ParseGetStorageDestinationsIdResponse(rsp *http.Response) (*GetStorageDestinationsIdResponse, error) { +// ParseGetStorageDestinationResponse parses an HTTP response from a GetStorageDestinationWithResponse call +func ParseGetStorageDestinationResponse(rsp *http.Response) (*GetStorageDestinationResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetStorageDestinationsIdResponse{ + response := &GetStorageDestinationResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -8190,15 +8190,15 @@ func ParseGetStorageDestinationsIdResponse(rsp *http.Response) (*GetStorageDesti return response, nil } -// ParsePatchStorageDestinationsIdResponse parses an HTTP response from a PatchStorageDestinationsIdWithResponse call -func ParsePatchStorageDestinationsIdResponse(rsp *http.Response) (*PatchStorageDestinationsIdResponse, error) { +// ParseUpdateStorageDestinationResponse parses an HTTP response from a UpdateStorageDestinationWithResponse call +func ParseUpdateStorageDestinationResponse(rsp *http.Response) (*UpdateStorageDestinationResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PatchStorageDestinationsIdResponse{ + response := &UpdateStorageDestinationResponse{ Body: bodyBytes, HTTPResponse: rsp, } diff --git a/internal/cli/backup/backup.go b/internal/cli/backup/backup.go index f3a2331..ced3472 100644 --- a/internal/cli/backup/backup.go +++ b/internal/cli/backup/backup.go @@ -54,7 +54,7 @@ and prints the next cursor to stderr if there are more results. Use return err } page, err := cmdutil.Paginate(cmd.Context(), pages, func(ctx context.Context, cursor string, size int) ([]snapdb.DtoBackupJob, string, error) { - params := &snapdb.GetBackupsParams{Limit: &size} + params := &snapdb.ListBackupsParams{Limit: &size} if cursor != "" { params.Cursor = &cursor } @@ -62,7 +62,7 @@ and prints the next cursor to stderr if there are more results. Use ids := append([]string(nil), datasourceIDs...) params.DatasourceIDs = &ids } - res, err := c.API.GetBackupsWithResponse(ctx, params) + res, err := c.API.ListBackupsWithResponse(ctx, params) if err != nil { return nil, "", err } diff --git a/internal/cli/backup/completion.go b/internal/cli/backup/completion.go index c985744..300e119 100644 --- a/internal/cli/backup/completion.go +++ b/internal/cli/backup/completion.go @@ -45,7 +45,7 @@ func (d deps) datasourceCandidates(cmd *cobra.Command) ([]cobra.Completion, erro if err != nil { return nil, err } - res, err := c.API.ListWithResponse(cmd.Context(), &snapdb.ListParams{}) + res, err := c.API.ListDatasourcesWithResponse(cmd.Context(), &snapdb.ListDatasourcesParams{}) if err != nil { return nil, err } @@ -66,7 +66,7 @@ func (d deps) jobCandidates(cmd *cobra.Command) ([]cobra.Completion, error) { return nil, err } limit := 50 - res, err := c.API.GetBackupsWithResponse(cmd.Context(), &snapdb.GetBackupsParams{Limit: &limit}) + res, err := c.API.ListBackupsWithResponse(cmd.Context(), &snapdb.ListBackupsParams{Limit: &limit}) if err != nil { return nil, err } diff --git a/internal/cli/backup/datasource.go b/internal/cli/backup/datasource.go index c240731..719350d 100644 --- a/internal/cli/backup/datasource.go +++ b/internal/cli/backup/datasource.go @@ -120,14 +120,14 @@ func newDataSourceListCmd(d deps) *cobra.Command { return err } page, err := cmdutil.Paginate(cmd.Context(), pages, func(ctx context.Context, cursor string, _ int) ([]snapdb.DtoDataSource, string, error) { - params := &snapdb.ListParams{} + params := &snapdb.ListDatasourcesParams{} if search != "" { params.Query = &search } if cursor != "" { params.Cursor = &cursor } - res, err := c.API.ListWithResponse(ctx, params) + res, err := c.API.ListDatasourcesWithResponse(ctx, params) if err != nil { return nil, "", err } @@ -179,7 +179,7 @@ func newDataSourceGetCmd(d deps) *cobra.Command { if err != nil { return err } - res, err := c.API.GetWithResponse(cmd.Context(), args[0]) + res, err := c.API.GetDatasourceWithResponse(cmd.Context(), args[0]) if err != nil { return err } diff --git a/internal/cli/backup/datasource_write.go b/internal/cli/backup/datasource_write.go index e4be7e5..fcfa65d 100644 --- a/internal/cli/backup/datasource_write.go +++ b/internal/cli/backup/datasource_write.go @@ -51,7 +51,7 @@ func readConnectionURI(cmd *cobra.Command, file string) (string, error) { // setCredentials stores a data source's connection string. func setCredentials(ctx context.Context, c *snapdbContext, id, uri string) error { - res, err := c.API.PutDatasourcesIdCredentialsWithResponse(ctx, id, snapdb.PutDatasourcesIdCredentialsJSONRequestBody{ + res, err := c.API.SetDatasourceCredentialsWithResponse(ctx, id, snapdb.SetDatasourceCredentialsJSONRequestBody{ Mode: snapdb.CredentialModeURI, Uri: &uri, }) if err != nil { @@ -100,7 +100,7 @@ Nothing is backed up until a policy is attached if err != nil { return nil, err } - res, err := c.API.PostDatasourcesWithResponse(cmd.Context(), snapdb.PostDatasourcesJSONRequestBody{ + res, err := c.API.CreateDatasourceWithResponse(cmd.Context(), snapdb.CreateDatasourceJSONRequestBody{ Name: name, Engine: snapdb.ConstantsDatasourceEngine(engine), Environment: snapdb.ConstantsDatasourceEnvironment(env), Region: snapdb.ConstantsDatasourceRegion(region), }) diff --git a/internal/cli/backup/health.go b/internal/cli/backup/health.go index 4b9a3dc..dbbfeff 100644 --- a/internal/cli/backup/health.go +++ b/internal/cli/backup/health.go @@ -39,7 +39,7 @@ dash; enable restore testing in the dashboard or run one now with return err } - res, err := c.API.ListWithResponse(cmd.Context(), &snapdb.ListParams{}) + res, err := c.API.ListDatasourcesWithResponse(cmd.Context(), &snapdb.ListDatasourcesParams{}) if err != nil { return err } diff --git a/internal/cli/backup/interactive.go b/internal/cli/backup/interactive.go index e9fd94e..56f5fe2 100644 --- a/internal/cli/backup/interactive.go +++ b/internal/cli/backup/interactive.go @@ -19,7 +19,7 @@ import ( // accept an optional positional argument — when the caller passes an id // we run directly; when they don't and stdin is interactive, we pick. func pickDataSource(ctx context.Context, c *snapdbContext, title string) (*snapdb.DtoDataSource, error) { - res, err := c.API.ListWithResponse(ctx, &snapdb.ListParams{}) + res, err := c.API.ListDatasourcesWithResponse(ctx, &snapdb.ListDatasourcesParams{}) if err != nil { return nil, err } diff --git a/internal/cli/backup/policy.go b/internal/cli/backup/policy.go index 076f8a4..3355bc1 100644 --- a/internal/cli/backup/policy.go +++ b/internal/cli/backup/policy.go @@ -191,7 +191,7 @@ attachment was a mistake or is permanently obsolete.`, return nil } - res, err := c.API.DeleteDatasourcesDatasourceIdPoliciesPolicyIdWithResponse( + res, err := c.API.DetachPolicyWithResponse( cmd.Context(), datasourceID, policyID, ) if err != nil { diff --git a/internal/cli/backup/policydefs.go b/internal/cli/backup/policydefs.go index cdb99e7..cd246d5 100644 --- a/internal/cli/backup/policydefs.go +++ b/internal/cli/backup/policydefs.go @@ -26,7 +26,7 @@ var ( ) func listPolicyDefinitions(cmd *cobra.Command, c *snapdbContext) error { - res, err := c.API.GetBackupPoliciesWithResponse(cmd.Context()) + res, err := c.API.ListBackupPoliciesWithResponse(cmd.Context()) if err != nil { return err } @@ -108,7 +108,7 @@ with ` + "`norcube backup destinations list`" + `.`, if err := f.validate(cmd); err != nil { return nil, err } - body := snapdb.PostBackupPoliciesJSONRequestBody{ + body := snapdb.CreateBackupPolicyJSONRequestBody{ Name: strings.TrimSpace(f.name), ScheduleCron: strings.TrimSpace(f.schedule), Timezone: strings.TrimSpace(f.timezone), RetentionDays: f.retentionDays, KeepLastN: f.keepLast, DestinationId: strings.TrimSpace(destination), } @@ -122,7 +122,7 @@ with ` + "`norcube backup destinations list`" + `.`, if err != nil { return nil, err } - res, err := c.API.PostBackupPoliciesWithResponse(cmd.Context(), body) + res, err := c.API.CreateBackupPolicyWithResponse(cmd.Context(), body) if err != nil { return nil, err } @@ -161,7 +161,7 @@ attached to follows the new settings from its next run.`, return nil, err } changed := cmd.Flags().Changed - var body snapdb.PatchBackupPoliciesIdJSONRequestBody + var body snapdb.UpdateBackupPolicyJSONRequestBody str := func(flag, v string) *string { if !changed(flag) { return nil @@ -177,7 +177,7 @@ attached to follows the new settings from its next run.`, if changed("keep-last") { body.KeepLastN = &f.keepLast } - if body == (snapdb.PatchBackupPoliciesIdJSONRequestBody{}) { + if body == (snapdb.UpdateBackupPolicyJSONRequestBody{}) { return nil, clierr.Usage(errors.New("nothing to update: pass at least one of --name, --schedule, --timezone, --retention-days, --keep-last, --method, --compression")) } c, err := d.client(cmd) @@ -185,7 +185,7 @@ attached to follows the new settings from its next run.`, return nil, err } id := strings.TrimSpace(args[0]) - res, err := c.API.PatchBackupPoliciesIdWithResponse(cmd.Context(), id, body) + res, err := c.API.UpdateBackupPolicyWithResponse(cmd.Context(), id, body) if err != nil { return nil, err } @@ -221,7 +221,7 @@ the highest-priority enabled one unless told otherwise.`, norcube backup policies attach --datasource 9f8e7d6c-… --policy 1a2b3c4d-… --priority 2 --paused`, Args: cobra.NoArgs, RunE: cmdutil.Run(func(cmd *cobra.Command, _ []string) (any, error) { - body := snapdb.PostDatasourcesDatasourceIdPoliciesJSONRequestBody{PolicyId: policyID, Enabled: !paused} + body := snapdb.AttachPolicyJSONRequestBody{PolicyId: policyID, Enabled: !paused} if cmd.Flags().Changed("priority") { body.Priority = &priority } @@ -229,7 +229,7 @@ the highest-priority enabled one unless told otherwise.`, if err != nil { return nil, err } - res, err := c.API.PostDatasourcesDatasourceIdPoliciesWithResponse(cmd.Context(), datasourceID, body) + res, err := c.API.AttachPolicyWithResponse(cmd.Context(), datasourceID, body) if err != nil { return nil, err } @@ -278,7 +278,7 @@ and buckets of your own. A backup policy names one with --destination.`, norcube backup destinations list --managed -o json --query "[0].id"`, Args: cobra.NoArgs, RunE: cmdutil.Run(func(cmd *cobra.Command, _ []string) (any, error) { - params := &snapdb.GetStorageDestinationsParams{} + params := &snapdb.ListStorageDestinationsParams{} switch { case managed: o := snapdb.Managed @@ -291,7 +291,7 @@ and buckets of your own. A backup policy names one with --destination.`, if err != nil { return nil, err } - res, err := c.API.GetStorageDestinationsWithResponse(cmd.Context(), params) + res, err := c.API.ListStorageDestinationsWithResponse(cmd.Context(), params) if err != nil { return nil, err } diff --git a/internal/cli/backup/restores.go b/internal/cli/backup/restores.go index 940d7d7..fb286f2 100644 --- a/internal/cli/backup/restores.go +++ b/internal/cli/backup/restores.go @@ -109,7 +109,7 @@ func restoreObject(r snapdb.DtoRestoreJob) output.Object { } func getRestore(ctx context.Context, c *snapdbContext, id string) (snapdb.DtoRestoreJob, error) { - res, err := c.API.GetRestoresIdWithResponse(ctx, id) + res, err := c.API.GetRestoreWithResponse(ctx, id) if err != nil { return snapdb.DtoRestoreJob{}, err } @@ -139,11 +139,11 @@ func restoreFailed(what string, r snapdb.DtoRestoreJob) error { // listRestores pages through a data source's restores of one trigger. func listRestores(cmd *cobra.Command, c *snapdbContext, pages cmdutil.PageFlags, datasourceID, trigger string) (cmdutil.Page[snapdb.DtoRestoreJob], error) { return cmdutil.Paginate(cmd.Context(), pages, func(ctx context.Context, cursor string, size int) ([]snapdb.DtoRestoreJob, string, error) { - params := &snapdb.GetDatasourcesDatasourceIdRestoresParams{Limit: &size, Trigger: &trigger} + params := &snapdb.ListDatasourceRestoresParams{Limit: &size, Trigger: &trigger} if cursor != "" { params.Cursor = &cursor } - res, err := c.API.GetDatasourcesDatasourceIdRestoresWithResponse(ctx, datasourceID, params) + res, err := c.API.ListDatasourceRestoresWithResponse(ctx, datasourceID, params) if err != nil { return nil, "", err } @@ -295,7 +295,7 @@ for the restore to finish and exits 1 (code job_failed) when it failed.`, if err := req.validate(); err != nil { return nil, err } - body := snapdb.PostRestoresJSONRequestBody{ + body := snapdb.CreateRestoreJSONRequestBody{ DataSourceId: req.datasourceID, SourceBackupId: req.backupID, Mode: req.mode, } if req.targetURIFile != "" { @@ -324,7 +324,7 @@ for the restore to finish and exits 1 (code job_failed) when it failed.`, if err != nil { return nil, err } - res, err := c.API.PostRestoresWithResponse(cmd.Context(), body) + res, err := c.API.CreateRestoreWithResponse(cmd.Context(), body) if err != nil { return nil, err } diff --git a/specs/snapdb.openapi.json b/specs/snapdb.openapi.json index f517a73..ece6c9e 100644 --- a/specs/snapdb.openapi.json +++ b/specs/snapdb.openapi.json @@ -2348,6 +2348,7 @@ "/backup-policies": { "get": { "description": "List all backup policies for the organization.", + "operationId": "listBackupPolicies", "responses": { "200": { "content": { @@ -2398,10 +2399,18 @@ "summary": "List Policies", "tags": [ "Policies" + ], + "x-norcube-effect": "read", + "x-norcube-scopes": [ + "backup.read", + "backup.write", + "backup.verify", + "backup.assist.read" ] }, "post": { "description": "Create a new backup policy for the organization.", + "operationId": "createBackupPolicy", "requestBody": { "content": { "application/json": { @@ -2455,6 +2464,7 @@ "/backup-policies/{id}": { "patch": { "description": "Partially update a backup policy. Omitted fields are left unchanged.", + "operationId": "updateBackupPolicy", "parameters": [ { "description": "Policy ID", @@ -2532,6 +2542,7 @@ "/backups": { "get": { "description": "Cross-datasource listing of backup jobs in the calling user's organization, sorted by created_at descending. Pass datasourceIds[] to filter to a subset of data sources. Org scoping is enforced at the SQL level — datasource ids belonging to other organizations are silently ignored.", + "operationId": "listBackups", "parameters": [ { "in": "query", @@ -2608,13 +2619,20 @@ "summary": "List backups across the organization", "tags": [ "Backups" + ], + "x-norcube-effect": "read", + "x-norcube-scopes": [ + "backup.read", + "backup.write", + "backup.verify", + "backup.assist.read" ] } }, "/datasources": { "get": { "description": "Retrieve a paginated list of data sources for the organization.", - "operationId": "list", + "operationId": "listDatasources", "parameters": [ { "description": "Pagination cursor", @@ -2683,10 +2701,18 @@ "summary": "List Data Sources", "tags": [ "Data Sources" + ], + "x-norcube-effect": "read", + "x-norcube-scopes": [ + "backup.read", + "backup.write", + "backup.verify", + "backup.assist.read" ] }, "post": { "description": "Create a new data source for the organization.", + "operationId": "createDatasource", "requestBody": { "content": { "application/json": { @@ -2868,6 +2894,13 @@ "summary": "Backup history time series", "tags": [ "Data Sources" + ], + "x-norcube-effect": "read", + "x-norcube-scopes": [ + "backup.read", + "backup.write", + "backup.verify", + "backup.assist.read" ] } }, @@ -2950,6 +2983,13 @@ "summary": "List Backup Jobs", "tags": [ "Data Sources" + ], + "x-norcube-effect": "read", + "x-norcube-scopes": [ + "backup.read", + "backup.write", + "backup.verify", + "backup.assist.read" ] } }, @@ -3186,6 +3226,13 @@ "summary": "Get one backup job", "tags": [ "Data Sources" + ], + "x-norcube-effect": "read", + "x-norcube-scopes": [ + "backup.read", + "backup.write", + "backup.verify", + "backup.assist.read" ] } }, @@ -3386,10 +3433,18 @@ "summary": "List policies of data source", "tags": [ "Data Sources" + ], + "x-norcube-effect": "read", + "x-norcube-scopes": [ + "backup.read", + "backup.write", + "backup.verify", + "backup.assist.read" ] }, "post": { "description": "Attach a backup policy to a data source with a specific storage destination.", + "operationId": "attachPolicy", "parameters": [ { "description": "Data Source ID", @@ -3454,6 +3509,7 @@ "/datasources/{datasourceId}/policies/{policyId}": { "delete": { "description": "Detach a backup policy from a specific data source.", + "operationId": "detachPolicy", "parameters": [ { "description": "Data Source ID", @@ -3637,12 +3693,20 @@ "summary": "Restore-check history", "tags": [ "Data Sources" + ], + "x-norcube-effect": "read", + "x-norcube-scopes": [ + "backup.read", + "backup.write", + "backup.verify", + "backup.assist.read" ] } }, "/datasources/{datasourceId}/restores": { "get": { "description": "Restore jobs for one datasource, newest first, cursor-paginated. Org + datasource scoping is enforced at the SQL level (and by the datasource-access middleware on the route).", + "operationId": "listDatasourceRestores", "parameters": [ { "description": "Datasource ID", @@ -3726,6 +3790,13 @@ "summary": "List a datasource's restore jobs", "tags": [ "Restores" + ], + "x-norcube-effect": "read", + "x-norcube-scopes": [ + "backup.read", + "backup.write", + "backup.verify", + "backup.assist.read" ] } }, @@ -3815,7 +3886,7 @@ }, "get": { "description": "Retrieve details of a specific data source by its ID.", - "operationId": "get", + "operationId": "getDatasource", "parameters": [ { "description": "Data Source ID", @@ -3862,6 +3933,13 @@ "summary": "Get Data Source", "tags": [ "Data Sources" + ], + "x-norcube-effect": "read", + "x-norcube-scopes": [ + "backup.read", + "backup.write", + "backup.verify", + "backup.assist.read" ] }, "patch": { @@ -3934,6 +4012,7 @@ "/datasources/{id}/credentials": { "put": { "description": "Set or update the credentials for a specific data source. Supports two types of credentials: username/password and connection URI.", + "operationId": "setDatasourceCredentials", "parameters": [ { "description": "Data Source ID", @@ -4045,6 +4124,13 @@ "summary": "Get restore-check config", "tags": [ "Data Sources" + ], + "x-norcube-effect": "read", + "x-norcube-scopes": [ + "backup.read", + "backup.write", + "backup.verify", + "backup.assist.read" ] }, "put": { @@ -4293,6 +4379,7 @@ "/restores": { "post": { "description": "Creates a restore job from a successful backup and dispatches it to a restore worker. Modes: `new_database` (create a fresh DB on a server you point at — targetUri needs create-database rights, targetDatabase is the name to create), `overwrite` (restore over the datasource's existing database using its stored credentials — requires confirmOverwrite=true and a write-capable role), `new_server` (restore into the database named in targetUri). Probe the target first via POST /restores/target-probe. Restores are deliberately not billing-gated.", + "operationId": "createRestore", "requestBody": { "content": { "application/json": { @@ -4356,6 +4443,7 @@ "/restores/target-probe": { "post": { "description": "The restore wizard's pre-flight. For `overwrite` it checks the datasource's stored credentials can actually write (creates + drops a throwaway norcube_write_test table/collection) — backup roles are usually read-only, so this catches the failure before anything runs. For `new_database` it checks the supplied targetUri can create databases and that targetDatabase doesn't exist yet; for `new_server` it write-probes the database named in targetUri. Domain failures come back as errorCode/errorMessage with HTTP 200.", + "operationId": "probeRestoreTarget", "requestBody": { "content": { "application/json": { @@ -4409,6 +4497,7 @@ "/restores/{id}": { "get": { "description": "Full detail of a restore job, including status, byte counters, the redacted target, and whether a log is available.", + "operationId": "getRestore", "parameters": [ { "description": "Restore job ID", @@ -4465,12 +4554,20 @@ "summary": "Get one restore job", "tags": [ "Restores" + ], + "x-norcube-effect": "read", + "x-norcube-scopes": [ + "backup.read", + "backup.write", + "backup.verify", + "backup.assist.read" ] } }, "/restores/{id}/logs.presign": { "get": { "description": "Returns a short-lived presigned URL for the restore run's output log (the redacted pg_restore / mongorestore output the worker uploaded). Available for both successful and failed restores once the worker has reported; `errorCode: no_log` until then.", + "operationId": "getRestoreLogsLink", "parameters": [ { "description": "Restore job ID", @@ -4523,6 +4620,7 @@ "/storage-destinations": { "get": { "description": "Returns every storage destination an organization can attach to a backup policy — both Norcube-managed buckets and BYO (customer-owned) S3-compatible destinations. Credential fields are never included in the response; the agent dispatcher fetches them via a separate decrypt path when starting a job. Supports server-side filtering by search substring (matched against name / bucket / endpoint / type), ownership (`all` / `managed` / `byo`), and unverifiedOnly (BYO rows whose verify rotted).", + "operationId": "listStorageDestinations", "parameters": [ { "description": "Substring search across name, bucket, endpoint URL, and type", @@ -4596,6 +4694,7 @@ }, "post": { "description": "Registers a customer-owned S3-compatible storage destination (AWS S3 outside our account, Cloudflare R2, Backblaze B2, Wasabi, MinIO, etc.). The supplied credentials are verified end-to-end (PutObject → HeadObject → DeleteObject of a tiny probe object) BEFORE the row is persisted — if any step fails the request returns 400 and nothing is saved. Credentials are KMS-wrapped (envelope-encrypted with the same {org_id, destination_id} context we use for datasource credentials) before persistence and never leave the encrypted path again until the agent dispatcher unseals them at job-start time.", + "operationId": "createStorageDestination", "requestBody": { "content": { "application/json": { @@ -4659,6 +4758,7 @@ "/storage-destinations/managed/ensure": { "post": { "description": "Ensure that a managed storage destination exists for the given region. If it does not exist, it will be created.", + "operationId": "ensureManagedStorageDestination", "requestBody": { "content": { "application/json": { @@ -4712,6 +4812,7 @@ "/storage-destinations/{id}": { "delete": { "description": "Soft-deletes a customer-owned (BYO) storage destination (sets is_active=false and wipes the credential blob). Refuses with 409 if any data_source_policy still references this destination — the customer must detach those policies first. Managed destinations cannot be deleted through this endpoint.", + "operationId": "deleteStorageDestination", "parameters": [ { "description": "Storage destination ID", @@ -4775,6 +4876,7 @@ }, "get": { "description": "Returns a single storage destination by id, scoped to the calling organization.", + "operationId": "getStorageDestination", "parameters": [ { "description": "Storage destination ID", @@ -4835,6 +4937,7 @@ }, "patch": { "description": "Updates a customer-owned (BYO) storage destination. Two paths: metadata-only (name / storageClass / encryptionMode) writes immediately. Any connection-knob change (region / endpointUrl / forcePathStyle) OR credential change requires accessKeyId + secretAccessKey to be supplied together — the new combination is re-verified end-to-end (PutObject → HeadObject → DeleteObject) before the row is updated. Managed destinations cannot be edited through this endpoint.", + "operationId": "updateStorageDestination", "parameters": [ { "description": "Storage destination ID", From 09e59acbb3b3f4315010544fc77bef057b1f8989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0v=C3=A1b=C3=ADk?= Date: Thu, 19 Nov 2026 14:45:23 +0100 Subject: [PATCH 2/7] feat(cms): validate with cms-schema 0.2.0 (language versions) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `nrc cms validate` now checks how a collection links its language versions (`translations.by`) and reports two pages of one language that share a translation key. Moves from cms-schema 0.1.1 to 0.2.0, which also brings 0.1.2's fix for collections sharing a directory. Signed-off-by: Jan Švábík --- go.mod | 2 +- go.sum | 4 ++-- internal/cli/cms/validate.go | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 18558e2..2fa4770 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/gofrs/flock v0.13.0 github.com/google/uuid v1.6.0 github.com/jmespath-community/go-jmespath v1.1.1 - github.com/norcubeplatform/cms-schema v0.1.1 + github.com/norcubeplatform/cms-schema v0.2.0 github.com/oapi-codegen/runtime v1.4.0 github.com/pelletier/go-toml/v2 v2.3.1 github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c diff --git a/go.sum b/go.sum index 2cb619c..915eb2c 100644 --- a/go.sum +++ b/go.sum @@ -129,8 +129,8 @@ github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELU github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= -github.com/norcubeplatform/cms-schema v0.1.1 h1:19HHWyqDrTGG2THK54TvzngCdhUNxWFywsuUrhLzAbU= -github.com/norcubeplatform/cms-schema v0.1.1/go.mod h1:fY05NpvoygKgMBZjj3+R6KI1vko9CSJPJKS02n6WRh0= +github.com/norcubeplatform/cms-schema v0.2.0 h1:5eb6ujIpeiq5ACs5FwZkN4NAcYiXvwiVVQh3ZfxKI18= +github.com/norcubeplatform/cms-schema v0.2.0/go.mod h1:fY05NpvoygKgMBZjj3+R6KI1vko9CSJPJKS02n6WRh0= github.com/oapi-codegen/runtime v1.4.0 h1:KLOSFOp7UzkbS7Cs1ms6NBEKYr0WmH2wZG0KKbd2er4= github.com/oapi-codegen/runtime v1.4.0/go.mod h1:5sw5fxCDmnOzKNYmkVNF8d34kyUeejJEY8HNT2WaPec= github.com/oasdiff/yaml v0.1.1 h1:6nHx+pn9gBRM6YpBlFZFQGCCd1nuvqOBtTD3KKTgGxY= diff --git a/internal/cli/cms/validate.go b/internal/cli/cms/validate.go index e44c09d..8a19907 100644 --- a/internal/cli/cms/validate.go +++ b/internal/cli/cms/validate.go @@ -72,12 +72,14 @@ the command needs no sign-in. Three groups of checks run, selectable with --only: schema .norcube/cms/ loads: YAML, $ref, field types and knobs, select - options, bounds, regexes, visibleIf paths, storages, preview + options, bounds, regexes, visibleIf paths, storages, preview, + how a collection links its language versions (translations.by) content every content file against its collection: required, value shapes, array item kinds and bounds, regex, length, uniqueness, custom validators, out-of-schema keys links the site as a whole: two files at one URL, links no page - produces, missing images and files, dangling references + produces, missing images and files, dangling references, two + pages of one language sharing a translation key Each finding names the file, the field path inside it, a severity and a rule id (schema.unresolved_ref, content.required, links.missing_asset…). From 8d522abcd16afa3481848eecdc13811388f99969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0v=C3=A1b=C3=ADk?= Date: Mon, 23 Nov 2026 15:28:42 +0100 Subject: [PATCH 3/7] feat(cms): validate with cms-schema 0.10.0, --quality and --git MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moves `nrc cms validate` from cms-schema 0.2.0 to 0.10.0 and adds the module's content quality checks: - `--quality` adds validate.ScopeQuality with the checkout's media files and root files, so the search, accessibility, language and media rules run. Quality findings are warnings and notices, never errors; notices never fail a run. - `--strict-quality` turns quality warnings into errors. - `--git` (only with --quality) reads when each file last changed from the git history with a deadline, so quality.translation_outdated runs. A git failure ends the run with usage_error, timeout or error instead of silently skipping the check. `-o json` gains summary.notices and a `quality` summary; the table shows the language after the path for per-language findings and names the rules quality skipped or guessed about on stderr. Signed-off-by: Jan Švábík --- CHANGELOG.md | 25 +++ README.md | 26 +++ docs/DESIGN.md | 3 +- go.mod | 2 +- go.sum | 4 +- internal/cli/cms/cmd.go | 8 +- internal/cli/cms/validate.go | 191 ++++++++++++++++-- internal/cli/cms/validate_test.go | 153 ++++++++++++++ internal/cli/cms_test.go | 111 ++++++++++ .../.norcube/cms/collections/pages.yml | 10 + .../.norcube/cms/collections/works.yml | 16 ++ .../cms-site-quality/.norcube/cms/config.yml | 5 + .../src/content/pages/cs/about.md | 4 + .../src/content/pages/en/about.md | 4 + .../src/content/works/first.md | 6 + .../src/content/works/second.md | 6 + .../cli/testdata/golden/cms-validate.json | 3 +- .../cli/testdata/golden/cms-validate.yaml | 1 + 18 files changed, 552 insertions(+), 26 deletions(-) create mode 100644 internal/cli/cms/validate_test.go create mode 100644 internal/cli/testdata/cms-site-quality/.norcube/cms/collections/pages.yml create mode 100644 internal/cli/testdata/cms-site-quality/.norcube/cms/collections/works.yml create mode 100644 internal/cli/testdata/cms-site-quality/.norcube/cms/config.yml create mode 100644 internal/cli/testdata/cms-site-quality/src/content/pages/cs/about.md create mode 100644 internal/cli/testdata/cms-site-quality/src/content/pages/en/about.md create mode 100644 internal/cli/testdata/cms-site-quality/src/content/works/first.md create mode 100644 internal/cli/testdata/cms-site-quality/src/content/works/second.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c495a6..917080e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,23 @@ this file collects what users and scripts need to know. code. The checks come from the public [cms-schema](https://github.com/norcubeplatform/cms-schema) module, so a site's CI runs exactly what the editor runs. +- `norcube cms validate --quality` also runs the content quality checks: + search (titles, descriptions, share images, noindex), accessibility (alt + text, heading levels, link text), languages (missing and incomplete + translations) and media (heavy images, unused files). Quality findings + are warnings (high and medium impact) or notices (low impact and + information only); they are never errors, and notices never fail a run. + `--strict-quality` turns quality warnings into errors. `--git` reads when + each file last changed from the checkout's git history, so a translation + left behind its newer language version is found + (`quality.translation_outdated`); it needs `--quality`, and a git failure + stops the run with a clear error. The table names what the quality checks + skipped or guessed, and shows the language of a finding about one + language of a page that holds every language (`title.en [en]`). +- `cms validate` uses cms-schema 0.10.0: field roles (`role:`, `whenEmpty`, + `titleTemplate`), image alt text (`alt:`, `decorative`), languages held in + one file (`localized: true`), `translations.locales` and the new schema + rules that check them. ### Changes @@ -34,6 +51,14 @@ this file collects what users and scripts need to know. summary{files, schemaFiles, errors, warnings}}`; each finding has `file`, `path`, `severity`, `rule`, `message` and optionally `hint`. Rule ids are frozen in the cms-schema module. +- `cms validate -o json`: `summary.notices` counts notices, and with + `--quality` the report has a `quality` object (per rule how many + instances were checked, the rules turned off, skipped or guessed about). + A finding's `severity` may be `notice`; quality findings also carry + `impact`, `value`, `measure`, `basis` and `locale`. +- `cms validate -o text`: a finding about one language of a page that holds + every language shows the language after its path in the third column + (`title.en [en]`). Only quality findings have a language. ## 0.26.0 (2026-11-07) diff --git a/README.md b/README.md index 6ffef3f..5776c28 100644 --- a/README.md +++ b/README.md @@ -232,6 +232,32 @@ On a machine without a browser, `norcube login --device` signs you in with a code you approve on your phone or laptop. See [CI and automation](https://docs.norcube.com/platform/cli#ci-and-automation). +## Checking a Norcube CMS site + +`norcube cms validate` reads a checkout of the site's repository and runs +the checks the Norcube CMS editor runs, offline and without a sign-in. It +exits 1 when a finding is an error (`--fail-on warning` or `none` changes +that), so it can guard a site's CI. + +```bash +norcube cms validate ./site # schema, content and links +norcube cms validate ./site --quality # plus content quality +norcube cms validate ./site --quality --git --strict-quality # in CI +``` + +- `--quality` adds the content quality checks: titles and descriptions for + search, alt text, headings and link text, missing and incomplete + translations, heavy images and unused files. Their findings are warnings + or notices, never errors, and notices never fail a run. +- `--strict-quality` (with `--quality`) turns quality warnings into errors. +- `--git` (with `--quality`) reads when each file last changed from the + checkout's git history, so a translation left behind its newer language + version is found. It needs git and a clone of the repository; if git + cannot read the history, the command stops with an error. + +`-o json` prints every finding with its rule id, and with `--quality` a +`quality` summary of what was checked, skipped and guessed. + ## Documentation - [CLI guide](https://docs.norcube.com/platform/cli): login, profiles, diff --git a/docs/DESIGN.md b/docs/DESIGN.md index d24b0ce..1da3c15 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -732,7 +732,7 @@ flag; [CHANGELOG.md](../CHANGELOG.md) says when each arrived. | `billing` | `status`; `subscriptions list`; `usage estimate | metrics`; `invoices list | download`; `budget get | set` | | `monitor` | `status` (`--fail-on`); `monitors list | get | create | update | delete | pause | resume | run` (`--wait`), `monitors bulk pause | resume | delete`, `monitors results list`, `monitors status-changes list`, `monitors stats get`, `monitors availability get`, `monitors certificate get`, `monitors alerts get | set`; `incidents list | get | acknowledge | summary`; `channels list | get | create | update | delete | test | verify`, `channels deliveries list`; `status-pages list | get | create | update | delete | publish | unpublish | preview-link`, `status-pages layout get | set`, `status-pages incidents list | get | create | update`, `status-pages incidents updates create`, `status-pages subscribers list | delete`; `maintenance list | get | create | update | cancel | finish` | | PromptHub | No command group; `nrc api prompthub ...` | -| `cms` | `validate` (`--only schema|content|links`, `--collection`, `--fail-on`), offline on a site checkout; the CMS has no public API, so there are no resource commands | +| `cms` | `validate` (`--only schema|content|links`, `--collection`, `--fail-on`, `--quality`, `--strict-quality`, `--git`), offline on a site checkout; the CMS has no public API, so there are no resource commands | CI token scopes, as defined by Norcube Auth and listed by `nrc auth ci-token scopes`: `backup.read`, `backup.write` (run backups @@ -801,6 +801,7 @@ changelog, and the owner's decisions in the planning sessions of | 2026-11-06 | `-o id` prints only the result's id. Deploy scripts capture what they create with `id=$(... -o id)`, and `-o text` prints the state as well, so it would need `cut`. It is a global output value rather than a flag of one command, so it means the same everywhere (P1, P13) | Named in the owner's maintenance windows plan. Rejected: `--query id -o text` as the documented form, which still works but is too long for the one thing every script needs | owner | | 2026-11-05 | `--auto-post` is the one page setting `create` doesn't require: the flag came after 0.23.0, so requiring it would break scripts that create pages, and the API keeps it off unless asked. `--notify` is sent only when given, and exists only on writes that add an update | Compatibility rule P10; owner's brief | owner | | 2026-11-15 | `cms validate`: a `cms` group whose first command works on a site checkout, offline, with no sign-in. The checks live in the public `github.com/norcubeplatform/cms-schema` module, which the CMS service and the dashboard's fixtures share, so the CLI is a thin wrapper and cannot drift from the editor. `--fail-on` defaults to `error` (unlike `monitor status`, whose default is `none`) because a validator that exits 0 on errors would be useless in CI; findings keep their severity whatever `--fail-on` says. A failed run uses the new code `invalid`, not `unhealthy`: `unhealthy` describes a service's state, `invalid` what the command checked. The report is printed before the error so CI keeps it. The path argument completes directories only | Owner's brief: validate a whole site against every page, locally and in CI, with the rules the editor runs. Rejected: putting the checks in the CLI module (the private backend would then depend on the CLI's releases and dependency graph); a `--strict` flag (the tree already has `--fail-on` for this); naming the command `cms schema validate` (content and links are checked too) | owner | +| 2026-11-23 | `cms validate --quality` (cms-schema 0.10.0): the content quality checks run only when asked for, as in the module, because their findings are advice rather than breakage; they are warnings and notices, never errors, and notices never fail a run whatever `--fail-on` says. `--strict-quality` fails on quality warnings alone (unlike `--fail-on warning`, which also fails on correctness warnings). `--git` reads when each file last changed from `git log` with a deadline; it needs `--quality`, and a git failure ends the run with its own code (`usage_error` outside a checkout, `timeout`, `error`) instead of silently skipping the outdated-translation check the person asked for. Quality is a flag, not an `--only` value, so `--only` keeps meaning the correctness checks. A finding about one language of a page that holds every language shows the language after its path in the PATH column (`title.en [en]`); `-o json` has it as `locale` | Owner's brief: run the module's quality checks from the CLI, mirroring `cms-schema-validate`. Rejected: a LOCALE column (mostly empty, and placed after MESSAGE in `-o text`); skipping the outdated check when git fails (the person asked for it) | owner | --- diff --git a/go.mod b/go.mod index 2fa4770..84123dc 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/gofrs/flock v0.13.0 github.com/google/uuid v1.6.0 github.com/jmespath-community/go-jmespath v1.1.1 - github.com/norcubeplatform/cms-schema v0.2.0 + github.com/norcubeplatform/cms-schema v0.10.0 github.com/oapi-codegen/runtime v1.4.0 github.com/pelletier/go-toml/v2 v2.3.1 github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c diff --git a/go.sum b/go.sum index 915eb2c..38a292c 100644 --- a/go.sum +++ b/go.sum @@ -129,8 +129,8 @@ github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELU github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= -github.com/norcubeplatform/cms-schema v0.2.0 h1:5eb6ujIpeiq5ACs5FwZkN4NAcYiXvwiVVQh3ZfxKI18= -github.com/norcubeplatform/cms-schema v0.2.0/go.mod h1:fY05NpvoygKgMBZjj3+R6KI1vko9CSJPJKS02n6WRh0= +github.com/norcubeplatform/cms-schema v0.10.0 h1:1T/WH/ij1oCoAX1rBT/qzjK9tsMvyhxqCdBOlwonfGM= +github.com/norcubeplatform/cms-schema v0.10.0/go.mod h1:fY05NpvoygKgMBZjj3+R6KI1vko9CSJPJKS02n6WRh0= github.com/oapi-codegen/runtime v1.4.0 h1:KLOSFOp7UzkbS7Cs1ms6NBEKYr0WmH2wZG0KKbd2er4= github.com/oapi-codegen/runtime v1.4.0/go.mod h1:5sw5fxCDmnOzKNYmkVNF8d34kyUeejJEY8HNT2WaPec= github.com/oasdiff/yaml v0.1.1 h1:6nHx+pn9gBRM6YpBlFZFQGCCd1nuvqOBtTD3KKTgGxY= diff --git a/internal/cli/cms/cmd.go b/internal/cli/cms/cmd.go index 4dc2394..2f8c8f1 100644 --- a/internal/cli/cms/cmd.go +++ b/internal/cli/cms/cmd.go @@ -6,7 +6,11 @@ // opens cleanly in the CMS. package cms -import "github.com/spf13/cobra" +import ( + "github.com/spf13/cobra" + + "github.com/norcubeplatform/cms-schema/gitlog" +) // NewCmd returns the `cms` parent command with all subcommands. func NewCmd() *cobra.Command { @@ -18,6 +22,6 @@ site's own repository. These commands read a checkout of that repository and need no sign-in: run them on your machine before you push, or in the site's CI to block a change that breaks the content model.`, } - cmd.AddCommand(newValidateCmd()) + cmd.AddCommand(newValidateCmd(validateDeps{lastChanged: gitlog.LastChanged})) return cmd } diff --git a/internal/cli/cms/validate.go b/internal/cli/cms/validate.go index 8a19907..b4de4a5 100644 --- a/internal/cli/cms/validate.go +++ b/internal/cli/cms/validate.go @@ -1,14 +1,20 @@ package cms import ( + "context" "errors" "fmt" + "io" "os" + "slices" "strings" + "time" "github.com/spf13/cobra" + "github.com/norcubeplatform/cms-schema/gitlog" "github.com/norcubeplatform/cms-schema/load" + "github.com/norcubeplatform/cms-schema/quality" "github.com/norcubeplatform/cms-schema/report" "github.com/norcubeplatform/cms-schema/validate" @@ -26,8 +32,10 @@ const ( failOnNone = "none" ) -// validateScopes are the values of --only, in the order the checks run. -var validateScopes = []string{validate.ScopeSchema, validate.ScopeContent, validate.ScopeLinks} +// validateScopes are the values of --only, in the order the checks run: +// every scope of the module except content quality, which --quality adds +// because it never runs unless asked for. +var validateScopes = slices.DeleteFunc(validate.Scopes(), func(s string) bool { return s == validate.ScopeQuality }) // validateReportVersion is the version of the `cms validate -o json` // document. Within a version changes are additive only. @@ -42,6 +50,9 @@ type validateReport struct { // from the frozen list in the cms-schema module. Findings []report.Finding `json:"findings" yaml:"findings"` Summary validateSummary `json:"summary" yaml:"summary"` + // Quality says what the content quality checks looked at, skipped and + // assumed; present only with --quality. + Quality *quality.Summary `json:"quality,omitempty" yaml:"quality,omitempty"` } // validateSummary counts what the run looked at and found. @@ -52,13 +63,29 @@ type validateSummary struct { SchemaFiles int `json:"schemaFiles" yaml:"schemaFiles"` Errors int `json:"errors" yaml:"errors"` Warnings int `json:"warnings" yaml:"warnings"` + // Notices are low-impact or information-only quality findings; they + // never fail a run. + Notices int `json:"notices" yaml:"notices"` } -func newValidateCmd() *cobra.Command { +// gitDates reads when each file of a checkout last changed +// (gitlog.LastChanged); a parameter so tests need no git. +type gitDates func(ctx context.Context, dir string, opts gitlog.Options) (map[string]time.Time, error) + +// validateDeps are what `cms validate` reaches outside the site's files. +type validateDeps struct { + // lastChanged runs for --git only. + lastChanged gitDates +} + +func newValidateCmd(deps validateDeps) *cobra.Command { var ( - only []string - collection string - failOn string + only []string + collection string + failOn string + withQuality bool + strictQuality bool + withGit bool ) cmd := &cobra.Command{ Use: "validate [path]", @@ -73,7 +100,8 @@ the command needs no sign-in. Three groups of checks run, selectable with --only: schema .norcube/cms/ loads: YAML, $ref, field types and knobs, select options, bounds, regexes, visibleIf paths, storages, preview, - how a collection links its language versions (translations.by) + how a collection links its language versions (translations.by), + field roles and image alt text content every content file against its collection: required, value shapes, array item kinds and bounds, regex, length, uniqueness, custom validators, out-of-schema keys @@ -81,17 +109,33 @@ Three groups of checks run, selectable with --only: produces, missing images and files, dangling references, two pages of one language sharing a translation key +--quality adds the content quality checks, which run only when asked +for: search (titles, descriptions, share images, noindex), accessibility +(alt text, heading levels, link text), languages (missing, incomplete and, +with --git, outdated translations) and media (heavy images, unused +files). Quality findings are never errors: high and medium impact ones are +warnings, low impact and information-only ones notices. --strict-quality +turns quality warnings into errors. --git reads when each file last +changed from the checkout's git history (git must be installed), so a +translation left behind its newer language version is found. + Each finding names the file, the field path inside it, a severity and a -rule id (schema.unresolved_ref, content.required, links.missing_asset…). -Rule ids are stable; match on them in scripts. +rule id (schema.unresolved_ref, content.required, quality.title_missing…). +A finding about one language of a page that holds every language shows +the language after its path, as in "title.en [en]". Rule ids are stable; +match on them in scripts. The exit code follows --fail-on: with "error" (the default) the command -exits 1 when any finding is an error, with "warning" when any finding -exists, with "none" it always exits 0 and only reports. A path that is -not a CMS site exits 3.`, +exits 1 when any finding is an error, with "warning" when any finding is +a warning or an error, with "none" it always exits 0 and only reports. +Notices never fail a run. A path that is not a CMS site exits 3.`, Example: ` norcube cms validate norcube cms validate ./site --fail-on warning norcube cms validate --only schema + # Also check titles, descriptions, alt text, languages and media + norcube cms validate --quality + # In CI: fail on high and medium impact quality findings, with outdated translations + norcube cms validate --quality --git --strict-quality # In CI, keep the report as an artifact norcube cms validate -o json > cms-validate.json norcube cms validate -o json --query "findings[?rule=='links.missing_asset'].file"`, @@ -108,6 +152,12 @@ not a CMS site exits 3.`, if err := oneOf("--fail-on", failOn, validateFailOn); err != nil { return nil, err } + if withGit && !withQuality { + return nil, clierr.Usage(errors.New("--git needs --quality: the dates are for the content quality checks")) + } + if strictQuality && !withQuality { + return nil, clierr.Usage(errors.New("--strict-quality needs --quality")) + } path := "." if len(args) == 1 { path = args[0] @@ -122,7 +172,25 @@ not a CMS site exits 3.`, return nil, clierr.Usage(fmt.Errorf("%s is a file; pass the site's directory", path)) } - res, err := validate.Site(os.DirFS(path), validate.Options{Only: only, Collection: collection}) + site := os.DirFS(path) + opts := validate.Options{Only: only, Collection: collection} + if withQuality { + if len(opts.Only) == 0 { + opts.Only = slices.Clone(validateScopes) + } + opts.Only = append(opts.Only, validate.ScopeQuality) + opts.StrictQuality = strictQuality + opts.Quality = quality.Options{ListMedia: quality.FSMedia(site), RootFiles: quality.FSRootFiles(site)} + if withGit { + dates, err := readGitDates(cmd.Context(), path, deps.lastChanged) + if err != nil { + return nil, err + } + opts.Quality.LastChanged = dates + } + } + + res, err := validate.Site(site, opts) if errors.Is(err, load.ErrNotASite) { return nil, &clierr.Error{ Code: clierr.CodeNotFound, @@ -139,7 +207,11 @@ not a CMS site exits 3.`, SchemaVersion: validateReportVersion, Path: path, Findings: res.Findings, - Summary: validateSummary{Files: res.Files, SchemaFiles: res.SchemaFiles, Errors: res.Errors, Warnings: res.Warnings}, + Summary: validateSummary{ + Files: res.Files, SchemaFiles: res.SchemaFiles, + Errors: res.Errors, Warnings: res.Warnings, Notices: res.Notices, + }, + Quality: res.Quality, } if rep.Findings == nil { rep.Findings = []report.Finding{} @@ -149,14 +221,21 @@ not a CMS site exits 3.`, Table: output.Table[report.Finding]{ Headers: []string{"SEVERITY", "FILE", "PATH", "RULE", "MESSAGE"}, Rows: func(f report.Finding) []string { - return []string{string(f.Severity), f.File, f.Path, string(f.Rule), f.Message} + return []string{string(f.Severity), f.File, findingPath(f), string(f.Rule), f.Message} }, Items: rep.Findings, }, } - fmt.Fprintf(cmd.ErrOrStderr(), "%d content %s, %d schema %s: %d %s, %d %s\n", - res.Files, plural(res.Files, "file"), res.SchemaFiles, plural(res.SchemaFiles, "file"), - res.Errors, plural(res.Errors, "error"), res.Warnings, plural(res.Warnings, "warning")) + stderr := cmd.ErrOrStderr() + counts := fmt.Sprintf("%d %s, %d %s", res.Errors, plural(res.Errors, "error"), res.Warnings, plural(res.Warnings, "warning")) + if withQuality || res.Notices > 0 { + counts += fmt.Sprintf(", %d %s", res.Notices, plural(res.Notices, "notice")) + } + fmt.Fprintf(stderr, "%d content %s, %d schema %s: %s\n", + res.Files, plural(res.Files, "file"), res.SchemaFiles, plural(res.SchemaFiles, "file"), counts) + if res.Quality != nil && cmdutil.Human(cmd) { + printQualityNotes(stderr, res.Quality, withGit) + } fail := (failOn == failOnError && res.Errors > 0) || (failOn == failOnWarning && (res.Errors > 0 || res.Warnings > 0)) @@ -175,13 +254,87 @@ not a CMS site exits 3.`, }), } cmd.Flags().StringSliceVar(&only, "only", nil, "Run only these checks: schema, content, links (repeatable or comma-separated; default all)") - cmd.Flags().StringVar(&collection, "collection", "", "Check the content and links of one collection only, by its key") + cmd.Flags().StringVar(&collection, "collection", "", "Check the content, links and quality of one collection only, by its key") cmd.Flags().StringVar(&failOn, "fail-on", failOnError, "Exit 1 on findings of this severity or worse: warning, error or none") + cmd.Flags().BoolVar(&withQuality, "quality", false, "Also run the content quality checks (search, accessibility, languages, media); their findings are warnings and notices") + cmd.Flags().BoolVar(&strictQuality, "strict-quality", false, "With --quality, treat content quality warnings as errors; notices stay notices") + cmd.Flags().BoolVar(&withGit, "git", false, "With --quality, read when each file last changed from the checkout's git history, so outdated translations are found") cmdutil.FlagEnum(cmd, "only", validateScopes...) cmdutil.FlagEnum(cmd, "fail-on", validateFailOn...) return cmd } +// readGitDates runs read on the checkout at path with a deadline +// (gitlog.DefaultTimeout) and turns its failures into errors a person can +// act on. --git asked for the dates, so a failure ends the run rather than +// silently skipping the check that needs them. +func readGitDates(ctx context.Context, path string, read gitDates) (map[string]time.Time, error) { + ctx, cancel := context.WithTimeout(ctx, gitlog.DefaultTimeout) + defer cancel() + dates, err := read(ctx, path, gitlog.Options{}) + switch { + case err == nil: + return dates, nil + case errors.Is(err, context.Canceled): + // Interrupted: the root reports it as such. + return nil, err + case errors.Is(err, gitlog.ErrNotARepository): + return nil, &clierr.Error{ + Code: clierr.CodeUsage, + Message: fmt.Sprintf("--git: %s is not in a git checkout, or git is not installed", path), + Hint: "Run it on a clone of the site's repository with git on the PATH, or drop --git.", + Err: err, + } + case errors.Is(err, context.DeadlineExceeded): + return nil, &clierr.Error{ + Code: clierr.CodeTimeout, + Message: fmt.Sprintf("--git: reading the git history of %s took longer than %s", path, gitlog.DefaultTimeout), + Hint: "Drop --git to check without the dates; outdated translations are then not looked for.", + Err: err, + } + default: + return nil, &clierr.Error{ + Code: clierr.CodeError, + Message: fmt.Sprintf("--git: reading the git history of %s: %v", path, err), + Hint: "Drop --git to check without the dates; outdated translations are then not looked for.", + Err: err, + } + } +} + +// findingPath is the PATH cell: the field path, followed by the language +// when the finding is about one language of a page that holds every +// language, so per-language findings tell apart. +func findingPath(f report.Finding) string { + if f.Locale == "" { + return f.Path + } + if f.Path == "" { + return "[" + f.Locale + "]" + } + return f.Path + " [" + f.Locale + "]" +} + +// printQualityNotes tells a person what the quality checks could not do +// and what they assumed, for the table output only (-o json carries the +// same in "quality"). +func printQualityNotes(w io.Writer, s *quality.Summary, withGit bool) { + for _, sk := range s.Skipped { + note := sk.Reason + if sk.Rule == report.RuleQualityTranslationOutdated && !withGit { + note += "; pass --git to read the dates from the git history" + } + fmt.Fprintf(w, "skipped %s: %s\n", sk.Rule, note) + } + for _, g := range s.Guessed { + fmt.Fprintf(w, "guessed %s: %t for %s (storage %s, %s site); set it on the storage to confirm\n", + g.Kind, g.Value, g.Path, g.Storage, g.Framework) + } + if s.Drafts > 0 { + fmt.Fprintf(w, "%d draft %s not checked for search and accessibility\n", s.Drafts, plural(s.Drafts, "page")) + } +} + // oneOf rejects a flag value outside its allowed list before any work. func oneOf(flag, v string, allowed []string) error { for _, a := range allowed { diff --git a/internal/cli/cms/validate_test.go b/internal/cli/cms/validate_test.go new file mode 100644 index 0000000..cc3d686 --- /dev/null +++ b/internal/cli/cms/validate_test.go @@ -0,0 +1,153 @@ +package cms + +import ( + "bytes" + "context" + "errors" + "strings" + "testing" + "time" + + "github.com/norcubeplatform/cms-schema/gitlog" + "github.com/norcubeplatform/cms-schema/report" + + "github.com/norcubeplatform/cli/internal/clierr" +) + +// qualitySite holds pages in two languages linked by path and works that +// hold both languages in one file. +const qualitySite = "../testdata/cms-site-quality" + +// execValidate runs `validate` built with deps, as the root would. +func execValidate(t *testing.T, deps validateDeps, args ...string) (string, string, error) { + t.Helper() + cmd := newValidateCmd(deps) + var stdout, stderr bytes.Buffer + cmd.SetOut(&stdout) + cmd.SetErr(&stderr) + cmd.SetArgs(args) + cmd.SilenceUsage, cmd.SilenceErrors = true, true + ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) + defer cancel() + err := cmd.ExecuteContext(ctx) + return stdout.String(), stderr.String(), err +} + +func TestValidateGitDatesReachQuality(t *testing.T) { + now := time.Now() + calls := 0 + deps := validateDeps{lastChanged: func(_ context.Context, dir string, _ gitlog.Options) (map[string]time.Time, error) { + calls++ + if dir != qualitySite { + t.Errorf("git read %q, want the site's path", dir) + } + return map[string]time.Time{ + "src/content/pages/en/about.md": now, + "src/content/pages/cs/about.md": now.Add(-30 * 24 * time.Hour), + }, nil + }} + + out, stderr, err := execValidate(t, deps, qualitySite, "--quality") + if err != nil { + t.Fatal(err) + } + if calls != 0 { + t.Fatalf("git ran without --git") + } + if strings.Contains(out, string(report.RuleQualityTranslationOutdated)) { + t.Fatalf("outdated translations reported without dates:\n%s", out) + } + if !strings.Contains(stderr, "skipped quality.translation_outdated") || !strings.Contains(stderr, "--git") { + t.Errorf("the skipped rule is not explained: %q", stderr) + } + + out, stderr, err = execValidate(t, deps, qualitySite, "--quality", "--git") + if err != nil { + t.Fatal(err) + } + if calls != 1 { + t.Fatalf("git ran %d times", calls) + } + var outdated string + for _, line := range strings.Split(out, "\n") { + if strings.Contains(line, string(report.RuleQualityTranslationOutdated)) { + outdated = line + } + } + if !strings.Contains(outdated, "src/content/pages/cs/about.md") { + t.Fatalf("the older language version is not reported as outdated:\n%s", out) + } + if strings.Contains(stderr, "skipped quality.translation_outdated") { + t.Errorf("the rule is still skipped with --git: %q", stderr) + } +} + +func TestReadGitDates(t *testing.T) { + t.Run("a deadline and the path", func(t *testing.T) { + want := map[string]time.Time{"a.md": time.Unix(1, 0)} + got, err := readGitDates(context.Background(), "site", func(ctx context.Context, dir string, _ gitlog.Options) (map[string]time.Time, error) { + deadline, ok := ctx.Deadline() + if !ok || time.Until(deadline) > gitlog.DefaultTimeout { + t.Errorf("no deadline of at most %s: %v %v", gitlog.DefaultTimeout, deadline, ok) + } + if dir != "site" { + t.Errorf("dir %q", dir) + } + return want, nil + }) + if err != nil || len(got) != 1 || !got["a.md"].Equal(want["a.md"]) { + t.Fatalf("got %v, %v", got, err) + } + }) + + cases := []struct { + name string + err error + code string + }{ + {"not a checkout is a usage error", gitlog.ErrNotARepository, clierr.CodeUsage}, + {"too slow is a timeout", context.DeadlineExceeded, clierr.CodeTimeout}, + {"anything else is an error", errors.New("git log: exit status 128"), clierr.CodeError}, + } + for _, c := range cases { + t.Run(c.name, func(t *testing.T) { + dates, err := readGitDates(context.Background(), "site", func(context.Context, string, gitlog.Options) (map[string]time.Time, error) { + return nil, c.err + }) + var ce *clierr.Error + if dates != nil || !errors.As(err, &ce) || ce.Code != c.code || !errors.Is(err, c.err) { + t.Fatalf("got %v, %v", dates, err) + } + if !strings.Contains(ce.Message, "--git") || ce.Hint == "" { + t.Errorf("message %q hint %q", ce.Message, ce.Hint) + } + }) + } + + t.Run("an interrupt stays an interrupt", func(t *testing.T) { + _, err := readGitDates(context.Background(), "site", func(context.Context, string, gitlog.Options) (map[string]time.Time, error) { + return nil, context.Canceled + }) + var ce *clierr.Error + if !errors.Is(err, context.Canceled) || errors.As(err, &ce) { + t.Fatalf("got %v", err) + } + }) +} + +func TestFindingPathShowsTheLanguage(t *testing.T) { + cases := []struct { + f report.Finding + want string + }{ + {report.Finding{Path: "title"}, "title"}, + {report.Finding{Path: "title.cs", Locale: "cs"}, "title.cs [cs]"}, + {report.Finding{Locale: "en"}, "[en]"}, + {report.Finding{}, ""}, + } + for _, c := range cases { + if got := findingPath(c.f); got != c.want { + t.Errorf("findingPath(%+v) = %q, want %q", c.f, got, c.want) + } + } +} diff --git a/internal/cli/cms_test.go b/internal/cli/cms_test.go index 95ea5db..6fdd174 100644 --- a/internal/cli/cms_test.go +++ b/internal/cli/cms_test.go @@ -84,6 +84,9 @@ func TestCmsValidateRejectsBadInvocations(t *testing.T) { {"unknown scope", []string{"cms", "validate", "testdata/cms-site", "--only", "everything"}, clierr.CodeUsage, clierr.ExitUsage}, {"unknown fail-on", []string{"cms", "validate", "testdata/cms-site", "--fail-on", "sometimes"}, clierr.CodeUsage, clierr.ExitUsage}, {"two paths", []string{"cms", "validate", "a", "b"}, clierr.CodeUsage, clierr.ExitUsage}, + {"git without quality", []string{"cms", "validate", "testdata/cms-site", "--git"}, clierr.CodeUsage, clierr.ExitUsage}, + {"strict-quality without quality", []string{"cms", "validate", "testdata/cms-site", "--strict-quality"}, clierr.CodeUsage, clierr.ExitUsage}, + {"quality is not an --only scope", []string{"cms", "validate", "testdata/cms-site", "--only", "quality"}, clierr.CodeUsage, clierr.ExitUsage}, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { @@ -138,3 +141,111 @@ func TestCmsValidateIsLocal(t *testing.T) { t.Fatalf("got %v", err) } } + +// cmsQualityReport is the part of `cms validate -o json` the quality tests +// read. +type cmsQualityReport struct { + Findings []struct { + File, Path, Rule, Severity, Impact, Locale string + } + Summary struct{ Errors, Warnings, Notices int } + Quality *struct { + Checked map[string]int + Skipped []struct{ Rule, Reason string } + } +} + +func decodeCmsReport(t *testing.T, out string) cmsQualityReport { + t.Helper() + var rep cmsQualityReport + if err := json.Unmarshal([]byte(out), &rep); err != nil { + t.Fatalf("stdout is not the JSON report: %v\n%s", err, out) + } + return rep +} + +func TestCmsValidateQualityRunsOnlyWhenAsked(t *testing.T) { + cmsEnv(t) + out, _, err := run(t, "cms", "validate", "testdata/cms-site-quality", "-o", "json") + if err != nil { + t.Fatal(err) + } + if strings.Contains(out, `"quality"`) { + t.Fatalf("quality summary without --quality:\n%s", out) + } + for _, f := range decodeCmsReport(t, out).Findings { + if strings.HasPrefix(f.Rule, "quality.") { + t.Fatalf("quality finding without --quality: %+v", f) + } + } + + out, stderr, err := run(t, "cms", "validate", "testdata/cms-site-quality", "--quality", "-o", "json") + if err != nil { + t.Fatalf("quality warnings failed the run: %v", err) + } + rep := decodeCmsReport(t, out) + if rep.Quality == nil || rep.Quality.Checked["quality.title_duplicate"] == 0 { + t.Fatalf("no quality summary: %s", out) + } + var dupEn, incompleteCs bool + for _, f := range rep.Findings { + switch { + case f.Rule == "quality.title_duplicate" && f.Locale == "en" && f.Severity == "warning" && f.Impact == "medium": + dupEn = true + case f.Rule == "quality.translation_incomplete" && f.Locale == "cs" && f.Severity == "notice": + incompleteCs = true + } + } + if !dupEn || !incompleteCs || rep.Summary.Errors != 0 || rep.Summary.Warnings != 2 || rep.Summary.Notices != 1 { + t.Fatalf("report: %+v", rep) + } + skipped := false + for _, s := range rep.Quality.Skipped { + skipped = skipped || s.Rule == "quality.translation_outdated" + } + if !skipped { + t.Errorf("translation_outdated should be skipped without --git: %+v", rep.Quality.Skipped) + } + if !strings.Contains(stderr, "2 warnings, 1 notice") { + t.Errorf("summary on stderr: %q", stderr) + } +} + +func TestCmsValidateStrictQuality(t *testing.T) { + cmsEnv(t) + out, _, err := run(t, "cms", "validate", "testdata/cms-site-quality", "--quality", "--strict-quality", "-o", "json") + e := Describe(err) + if e == nil || e.Code != clierr.CodeInvalid || e.ExitCode() != clierr.ExitError { + t.Fatalf("got %v", err) + } + rep := decodeCmsReport(t, out) + // Quality warnings become errors; notices stay notices. + if rep.Summary.Errors != 2 || rep.Summary.Warnings != 0 || rep.Summary.Notices != 1 { + t.Fatalf("summary: %+v", rep.Summary) + } +} + +func TestCmsValidateQualityTable(t *testing.T) { + cmsEnv(t) + out, stderr, err := run(t, "cms", "validate", "testdata/cms-site-quality", "--quality", "-o", "table", "--no-pager") + if err != nil { + t.Fatal(err) + } + // One file, one field, two languages: the language tells the rows apart. + for _, want := range []string{"title.cs [cs]", "title.en [en]", "notice", "quality.translation_incomplete"} { + if !strings.Contains(out, want) { + t.Errorf("table lacks %q:\n%s", want, out) + } + } + if !strings.Contains(stderr, "skipped quality.translation_outdated") { + t.Errorf("the skipped rule is not named: %q", stderr) + } + // Notes for people stay out of the scripts' formats. + _, stderr, err = run(t, "cms", "validate", "testdata/cms-site-quality", "--quality", "-o", "json") + if err != nil { + t.Fatal(err) + } + if strings.Contains(stderr, "skipped") { + t.Errorf("table notes printed with -o json: %q", stderr) + } +} diff --git a/internal/cli/testdata/cms-site-quality/.norcube/cms/collections/pages.yml b/internal/cli/testdata/cms-site-quality/.norcube/cms/collections/pages.yml new file mode 100644 index 0000000..e89d9e5 --- /dev/null +++ b/internal/cli/testdata/cms-site-quality/.norcube/cms/collections/pages.yml @@ -0,0 +1,10 @@ +label: Pages +path: src/content/pages +match: '**/*.md' +previewPath: '/{locale}/{slug}/' +localeFrom: path +translations: + by: path +fields: + - {key: title, type: text, label: Title, required: true, role: seoTitle} + - {key: slug, type: text, label: Slug} diff --git a/internal/cli/testdata/cms-site-quality/.norcube/cms/collections/works.yml b/internal/cli/testdata/cms-site-quality/.norcube/cms/collections/works.yml new file mode 100644 index 0000000..c92b394 --- /dev/null +++ b/internal/cli/testdata/cms-site-quality/.norcube/cms/collections/works.yml @@ -0,0 +1,16 @@ +label: Works +path: src/content/works +match: '*.md' +previewPath: '/{locale}/works/{slug}/' +localeFrom: none +fields: + - key: title + type: group + label: Title + localized: true + fallback: en + role: seoTitle + fields: + - {key: en, type: text, label: English} + - {key: cs, type: text, label: Czech} + - {key: slug, type: text, label: Slug} diff --git a/internal/cli/testdata/cms-site-quality/.norcube/cms/config.yml b/internal/cli/testdata/cms-site-quality/.norcube/cms/config.yml new file mode 100644 index 0000000..1889cb4 --- /dev/null +++ b/internal/cli/testdata/cms-site-quality/.norcube/cms/config.yml @@ -0,0 +1,5 @@ +pagesDir: src/content +preview: + defaultLocale: en + locales: [en, cs] + prefixDefaultLocale: true diff --git a/internal/cli/testdata/cms-site-quality/src/content/pages/cs/about.md b/internal/cli/testdata/cms-site-quality/src/content/pages/cs/about.md new file mode 100644 index 0000000..c58b946 --- /dev/null +++ b/internal/cli/testdata/cms-site-quality/src/content/pages/cs/about.md @@ -0,0 +1,4 @@ +--- +title: O ateliéru a lidech, kteří v něm pracují +slug: about +--- diff --git a/internal/cli/testdata/cms-site-quality/src/content/pages/en/about.md b/internal/cli/testdata/cms-site-quality/src/content/pages/en/about.md new file mode 100644 index 0000000..762279c --- /dev/null +++ b/internal/cli/testdata/cms-site-quality/src/content/pages/en/about.md @@ -0,0 +1,4 @@ +--- +title: About the studio and the people who work in it +slug: about +--- diff --git a/internal/cli/testdata/cms-site-quality/src/content/works/first.md b/internal/cli/testdata/cms-site-quality/src/content/works/first.md new file mode 100644 index 0000000..0886759 --- /dev/null +++ b/internal/cli/testdata/cms-site-quality/src/content/works/first.md @@ -0,0 +1,6 @@ +--- +title: + en: Oil on canvas, a study of the river at dawn + cs: '' +slug: first +--- diff --git a/internal/cli/testdata/cms-site-quality/src/content/works/second.md b/internal/cli/testdata/cms-site-quality/src/content/works/second.md new file mode 100644 index 0000000..7b6b090 --- /dev/null +++ b/internal/cli/testdata/cms-site-quality/src/content/works/second.md @@ -0,0 +1,6 @@ +--- +title: + en: Oil on canvas, a study of the river at dawn + cs: Olej na plátně, studie řeky za úsvitu +slug: second +--- diff --git a/internal/cli/testdata/golden/cms-validate.json b/internal/cli/testdata/golden/cms-validate.json index 5e18fe1..c1073ae 100644 --- a/internal/cli/testdata/golden/cms-validate.json +++ b/internal/cli/testdata/golden/cms-validate.json @@ -22,6 +22,7 @@ "files": 2, "schemaFiles": 2, "errors": 0, - "warnings": 2 + "warnings": 2, + "notices": 0 } } diff --git a/internal/cli/testdata/golden/cms-validate.yaml b/internal/cli/testdata/golden/cms-validate.yaml index 63761de..abc56a8 100644 --- a/internal/cli/testdata/golden/cms-validate.yaml +++ b/internal/cli/testdata/golden/cms-validate.yaml @@ -15,5 +15,6 @@ schemaVersion: 1 summary: errors: 0 files: 2 + notices: 0 schemaFiles: 2 warnings: 2 From a9ad299812896a139b714a91395cc157e70868ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0v=C3=A1b=C3=ADk?= Date: Wed, 25 Nov 2026 07:58:58 +0100 Subject: [PATCH 4/7] feat(cms): validate names the site folder of a monorepo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Švábík --- CHANGELOG.md | 5 +++ internal/cli/cms/validate.go | 57 +++++++++++++++++++++++- internal/cli/cms/validate_folder_test.go | 46 +++++++++++++++++++ 3 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 internal/cli/cms/validate_folder_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 917080e..85ae816 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,11 @@ this file collects what users and scripts need to know. `titleTemplate`), image alt text (`alt:`, `decorative`), languages held in one file (`localized: true`), `translations.locales` and the new schema rules that check them. +- `cms validate` on a repository whose site lives in a folder (a monorepo + with the site in `website/`) names that folder when the path holds no + site: "The site is in website/: run nrc cms validate website". Passing + the folder validates it, `--git` included (the history is read for the + folder's files). ### Changes diff --git a/internal/cli/cms/validate.go b/internal/cli/cms/validate.go index b4de4a5..add8949 100644 --- a/internal/cli/cms/validate.go +++ b/internal/cli/cms/validate.go @@ -5,7 +5,9 @@ import ( "errors" "fmt" "io" + "io/fs" "os" + "path/filepath" "slices" "strings" "time" @@ -195,7 +197,7 @@ Notices never fail a run. A path that is not a CMS site exits 3.`, return nil, &clierr.Error{ Code: clierr.CodeNotFound, Message: fmt.Sprintf("%s holds no Norcube CMS site: no %s and no %s", path, load.ConfigFile, load.LegacyConfigFile), - Hint: "Run the command from the site's root, or pass its path.", + Hint: notASiteHint(path, siteFoldersBelow(site, siteFolderDepth)), Err: err, } } @@ -351,3 +353,56 @@ func plural(n int, word string) string { } return word + "s" } + +// siteFolderDepth is how deep below the path a site is looked for when +// the path holds none: a monorepo keeps its site in a folder (website/) +// or a folder of a folder (apps/web/). +const siteFolderDepth = 2 + +// siteFoldersBelow lists the folders of fsys, at most depth levels deep, +// that hold a Norcube CMS site (load.ConfigFile or load.LegacyConfigFile), +// in name order. Hidden folders and node_modules are not entered. +func siteFoldersBelow(fsys fs.FS, depth int) []string { + var out []string + var visit func(dir string, level int) + visit = func(dir string, level int) { + entries, err := fs.ReadDir(fsys, dir) + if err != nil { + return + } + for _, e := range entries { + name := e.Name() + if !e.IsDir() || strings.HasPrefix(name, ".") || name == "node_modules" { + continue + } + child := name + if dir != "." { + child = dir + "/" + name + } + for _, marker := range []string{load.ConfigFile, load.LegacyConfigFile} { + if info, err := fs.Stat(fsys, child+"/"+marker); err == nil && !info.IsDir() { + out = append(out, child) + break + } + } + if level < depth { + visit(child, level+1) + } + } + } + visit(".", 1) + return out +} + +// notASiteHint tells where a site is when the path holds none but a folder +// below it does (a site in a subfolder of a monorepo). +func notASiteHint(path string, folders []string) string { + if len(folders) == 0 { + return "Run the command from the site's root, or pass its path." + } + where := filepath.ToSlash(filepath.Join(path, folders[0])) + if len(folders) == 1 { + return fmt.Sprintf("The site is in %s/: run nrc cms validate %s", folders[0], where) + } + return fmt.Sprintf("Sites are in %s/: pass one, for example nrc cms validate %s", strings.Join(folders, "/, "), where) +} diff --git a/internal/cli/cms/validate_folder_test.go b/internal/cli/cms/validate_folder_test.go new file mode 100644 index 0000000..05834de --- /dev/null +++ b/internal/cli/cms/validate_folder_test.go @@ -0,0 +1,46 @@ +package cms + +import ( + "errors" + "os" + "strings" + "testing" + "testing/fstest" + + "github.com/norcubeplatform/cli/internal/clierr" +) + +// A repository whose site lives in a folder (a monorepo) is not a site at +// its root, and the refusal names the folder to pass. +func TestValidateNamesTheSiteFolder(t *testing.T) { + repo := t.TempDir() + if err := os.CopyFS(repo+"/website", os.DirFS(qualitySite)); err != nil { + t.Fatal(err) + } + _, _, err := execValidate(t, validateDeps{}, repo) + var cerr *clierr.Error + if !errors.As(err, &cerr) || cerr.Code != clierr.CodeNotFound { + t.Fatalf("err = %v", err) + } + if !strings.Contains(cerr.Hint, "website/") || !strings.Contains(cerr.Hint, "nrc cms validate "+repo+"/website") { + t.Fatalf("hint = %q", cerr.Hint) + } +} + +func TestSiteFoldersBelow(t *testing.T) { + fsys := fstest.MapFS{ + "website/.norcube/cms/config.yml": {}, + "apps/docs/norcube-cms.config.yml": {}, + "a/b/c/.norcube/cms/config.yml": {}, // too deep + "node_modules/x/.norcube/cms/config.yml": {}, + ".hidden/.norcube/cms/config.yml": {}, + "backend/main.go": {}, + } + got := strings.Join(siteFoldersBelow(fsys, siteFolderDepth), ",") + if got != "apps/docs,website" { + t.Fatalf("siteFoldersBelow = %q", got) + } + if h := notASiteHint(".", nil); !strings.Contains(h, "site's root") { + t.Fatalf("hint without a folder = %q", h) + } +} From 7323885fc9756bfa364b849e5b2b0753769e8db6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0v=C3=A1b=C3=ADk?= Date: Wed, 25 Nov 2026 13:46:31 +0100 Subject: [PATCH 5/7] feat(cms): validate --git judges changed texts (cms-schema 0.11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cms-schema 0.11.0 judges quality.translation_outdated by the translatable texts the source changed since the translation was last current with it, not by file dates. --git now hands validate.Site a reader of the source's earlier versions (gitlog.SourceBases) under the same deadline; a read failure still ends the run with usage_error, timeout, error or an interrupt, and the deadline or the interrupt decides the code before what git printed. Tests pin the contract on a real repository: a changed link is no change, a changed title makes the translation outdated, a translation edited in the working tree is current, and outside a checkout --git is a usage error. The changelog gets the 0.27.0 heading the release left out. Signed-off-by: Jan Švábík --- CHANGELOG.md | 79 ++++++++----- README.md | 9 +- docs/DESIGN.md | 1 + go.mod | 2 +- go.sum | 4 +- internal/cli/cms/cmd.go | 2 +- internal/cli/cms/validate.go | 91 +++++++++------ internal/cli/cms/validate_git_test.go | 148 +++++++++++++++++++++++ internal/cli/cms/validate_test.go | 161 ++++++++++++++++++-------- 9 files changed, 370 insertions(+), 127 deletions(-) create mode 100644 internal/cli/cms/validate_git_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 85ae816..b6c2dd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,55 @@ this file collects what users and scripts need to know. ### New +- `norcube cms validate --quality` also runs the content quality checks: + search (titles, descriptions, share images, noindex), accessibility (alt + text, heading levels, link text), languages (missing and incomplete + translations) and media (heavy images, unused files). Quality findings + are warnings (high and medium impact) or notices (low impact and + information only); they are never errors, and notices never fail a run. + `--strict-quality` turns quality warnings into errors. The table names + what the quality checks skipped or guessed, and shows the language of a + finding about one language of a page that holds every language + (`title.en [en]`). +- `cms validate --quality --git` reads the checkout's git history to find + outdated translations (`quality.translation_outdated`): a language + version whose source, the page in the site's default language, changed + a text since the version last changed or was marked current. Changed + links, images, numbers, select values and white space are not texts to + translate and never count, and a version whose history can't be read + (a shallow clone, a file git doesn't know) is not judged. `--git` needs + `--quality`; if git cannot read the history, the run stops with an error + (`usage_error` outside a checkout, `timeout`, `error`). +- `cms validate` uses cms-schema 0.11.0: language versions + (`translations.by`), field roles (`role:`, `whenEmpty`, + `titleTemplate`), image alt text (`alt:`, `decorative`), languages held + in one file (`localized: true`), `translations.locales`, translation + marks and the schema rules that check them. +- `cms validate` on a repository whose site lives in a folder (a monorepo + with the site in `website/`) names that folder when the path holds no + site: "The site is in website/: run nrc cms validate website". Passing + the folder validates it, `--git` included (the history is read for the + folder's files). + +### Changes for scripts + +- `cms validate -o json`: `summary.notices` counts notices, and with + `--quality` the report has a `quality` object (per rule how many + instances were checked, the rules turned off, skipped or guessed about). + A finding's `severity` may be `notice`; quality findings also carry + `impact`, `value`, `measure`, `basis` and `locale`. A + `quality.translation_outdated` finding sits at the path of the first + changed text, its `measure` counts the changed texts (unit + `changedTexts`) and its `value` is the source's path and blob id + (`@`). +- `cms validate -o text`: a finding about one language of a page that holds + every language shows the language after its path in the third column + (`title.en [en]`). Only quality findings have a language. + +## 0.27.0 (2026-11-15) + +### New + - `norcube cms validate [path]` checks a Norcube CMS site from its repository, offline and without a sign-in: the schema in `.norcube/cms/` (YAML, `$ref`, field types and knobs, options, bounds, regexes, @@ -20,28 +69,6 @@ this file collects what users and scripts need to know. code. The checks come from the public [cms-schema](https://github.com/norcubeplatform/cms-schema) module, so a site's CI runs exactly what the editor runs. -- `norcube cms validate --quality` also runs the content quality checks: - search (titles, descriptions, share images, noindex), accessibility (alt - text, heading levels, link text), languages (missing and incomplete - translations) and media (heavy images, unused files). Quality findings - are warnings (high and medium impact) or notices (low impact and - information only); they are never errors, and notices never fail a run. - `--strict-quality` turns quality warnings into errors. `--git` reads when - each file last changed from the checkout's git history, so a translation - left behind its newer language version is found - (`quality.translation_outdated`); it needs `--quality`, and a git failure - stops the run with a clear error. The table names what the quality checks - skipped or guessed, and shows the language of a finding about one - language of a page that holds every language (`title.en [en]`). -- `cms validate` uses cms-schema 0.10.0: field roles (`role:`, `whenEmpty`, - `titleTemplate`), image alt text (`alt:`, `decorative`), languages held in - one file (`localized: true`), `translations.locales` and the new schema - rules that check them. -- `cms validate` on a repository whose site lives in a folder (a monorepo - with the site in `website/`) names that folder when the path holds no - site: "The site is in website/: run nrc cms validate website". Passing - the folder validates it, `--git` included (the history is read for the - folder's files). ### Changes @@ -56,14 +83,6 @@ this file collects what users and scripts need to know. summary{files, schemaFiles, errors, warnings}}`; each finding has `file`, `path`, `severity`, `rule`, `message` and optionally `hint`. Rule ids are frozen in the cms-schema module. -- `cms validate -o json`: `summary.notices` counts notices, and with - `--quality` the report has a `quality` object (per rule how many - instances were checked, the rules turned off, skipped or guessed about). - A finding's `severity` may be `notice`; quality findings also carry - `impact`, `value`, `measure`, `basis` and `locale`. -- `cms validate -o text`: a finding about one language of a page that holds - every language shows the language after its path in the third column - (`title.en [en]`). Only quality findings have a language. ## 0.26.0 (2026-11-07) diff --git a/README.md b/README.md index 5776c28..0afac35 100644 --- a/README.md +++ b/README.md @@ -250,10 +250,11 @@ norcube cms validate ./site --quality --git --strict-quality # in CI translations, heavy images and unused files. Their findings are warnings or notices, never errors, and notices never fail a run. - `--strict-quality` (with `--quality`) turns quality warnings into errors. -- `--git` (with `--quality`) reads when each file last changed from the - checkout's git history, so a translation left behind its newer language - version is found. It needs git and a clone of the repository; if git - cannot read the history, the command stops with an error. +- `--git` (with `--quality`) reads the checkout's git history, so a + translation whose source changed a text since the translation last + changed is found; changed links, images and numbers don't count. It + needs git and a clone of the repository; if git cannot read the + history, the command stops with an error. `-o json` prints every finding with its rule id, and with `--quality` a `quality` summary of what was checked, skipped and guessed. diff --git a/docs/DESIGN.md b/docs/DESIGN.md index 1da3c15..1f527fb 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -802,6 +802,7 @@ changelog, and the owner's decisions in the planning sessions of | 2026-11-05 | `--auto-post` is the one page setting `create` doesn't require: the flag came after 0.23.0, so requiring it would break scripts that create pages, and the API keeps it off unless asked. `--notify` is sent only when given, and exists only on writes that add an update | Compatibility rule P10; owner's brief | owner | | 2026-11-15 | `cms validate`: a `cms` group whose first command works on a site checkout, offline, with no sign-in. The checks live in the public `github.com/norcubeplatform/cms-schema` module, which the CMS service and the dashboard's fixtures share, so the CLI is a thin wrapper and cannot drift from the editor. `--fail-on` defaults to `error` (unlike `monitor status`, whose default is `none`) because a validator that exits 0 on errors would be useless in CI; findings keep their severity whatever `--fail-on` says. A failed run uses the new code `invalid`, not `unhealthy`: `unhealthy` describes a service's state, `invalid` what the command checked. The report is printed before the error so CI keeps it. The path argument completes directories only | Owner's brief: validate a whole site against every page, locally and in CI, with the rules the editor runs. Rejected: putting the checks in the CLI module (the private backend would then depend on the CLI's releases and dependency graph); a `--strict` flag (the tree already has `--fail-on` for this); naming the command `cms schema validate` (content and links are checked too) | owner | | 2026-11-23 | `cms validate --quality` (cms-schema 0.10.0): the content quality checks run only when asked for, as in the module, because their findings are advice rather than breakage; they are warnings and notices, never errors, and notices never fail a run whatever `--fail-on` says. `--strict-quality` fails on quality warnings alone (unlike `--fail-on warning`, which also fails on correctness warnings). `--git` reads when each file last changed from `git log` with a deadline; it needs `--quality`, and a git failure ends the run with its own code (`usage_error` outside a checkout, `timeout`, `error`) instead of silently skipping the outdated-translation check the person asked for. Quality is a flag, not an `--only` value, so `--only` keeps meaning the correctness checks. A finding about one language of a page that holds every language shows the language after its path in the PATH column (`title.en [en]`); `-o json` has it as `locale` | Owner's brief: run the module's quality checks from the CLI, mirroring `cms-schema-validate`. Rejected: a LOCALE column (mostly empty, and placed after MESSAGE in `-o text`); skipping the outdated check when git fails (the person asked for it) | owner | +| 2026-11-25 | `cms validate --git` with cms-schema 0.11.0: an outdated translation is one whose source changed a translatable text since the translation last changed or was marked current, so `--git` hands the module a reader of the source's earlier versions (`gitlog.SourceBases`) instead of file dates. The history is read only when the checks have language versions to judge, under the same deadline; a read failure still ends the run with the same codes, and the deadline or an interrupt decides the code before what git printed (a killed `git rev-parse` reads as "not a repository") | A date says nothing about what changed: a changed link or a commit in another folder made a translation "outdated". Rejected: reading the history up front to fail early on a site without language versions (twice the git work for a check with nothing to judge) | owner | --- diff --git a/go.mod b/go.mod index 84123dc..26bb53a 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/gofrs/flock v0.13.0 github.com/google/uuid v1.6.0 github.com/jmespath-community/go-jmespath v1.1.1 - github.com/norcubeplatform/cms-schema v0.10.0 + github.com/norcubeplatform/cms-schema v0.11.0 github.com/oapi-codegen/runtime v1.4.0 github.com/pelletier/go-toml/v2 v2.3.1 github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c diff --git a/go.sum b/go.sum index 38a292c..e188146 100644 --- a/go.sum +++ b/go.sum @@ -129,8 +129,8 @@ github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELU github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= -github.com/norcubeplatform/cms-schema v0.10.0 h1:1T/WH/ij1oCoAX1rBT/qzjK9tsMvyhxqCdBOlwonfGM= -github.com/norcubeplatform/cms-schema v0.10.0/go.mod h1:fY05NpvoygKgMBZjj3+R6KI1vko9CSJPJKS02n6WRh0= +github.com/norcubeplatform/cms-schema v0.11.0 h1:tCe5qh4qyKJqmrdtGe4LbQ9yIxDySotwEZpNiQxCjJM= +github.com/norcubeplatform/cms-schema v0.11.0/go.mod h1:fY05NpvoygKgMBZjj3+R6KI1vko9CSJPJKS02n6WRh0= github.com/oapi-codegen/runtime v1.4.0 h1:KLOSFOp7UzkbS7Cs1ms6NBEKYr0WmH2wZG0KKbd2er4= github.com/oapi-codegen/runtime v1.4.0/go.mod h1:5sw5fxCDmnOzKNYmkVNF8d34kyUeejJEY8HNT2WaPec= github.com/oasdiff/yaml v0.1.1 h1:6nHx+pn9gBRM6YpBlFZFQGCCd1nuvqOBtTD3KKTgGxY= diff --git a/internal/cli/cms/cmd.go b/internal/cli/cms/cmd.go index 2f8c8f1..1a63c1d 100644 --- a/internal/cli/cms/cmd.go +++ b/internal/cli/cms/cmd.go @@ -22,6 +22,6 @@ site's own repository. These commands read a checkout of that repository and need no sign-in: run them on your machine before you push, or in the site's CI to block a change that breaks the content model.`, } - cmd.AddCommand(newValidateCmd(validateDeps{lastChanged: gitlog.LastChanged})) + cmd.AddCommand(newValidateCmd(validateDeps{sourceBases: gitlog.SourceBases})) return cmd } diff --git a/internal/cli/cms/validate.go b/internal/cli/cms/validate.go index add8949..2c66dd8 100644 --- a/internal/cli/cms/validate.go +++ b/internal/cli/cms/validate.go @@ -10,7 +10,6 @@ import ( "path/filepath" "slices" "strings" - "time" "github.com/spf13/cobra" @@ -70,14 +69,16 @@ type validateSummary struct { Notices int `json:"notices" yaml:"notices"` } -// gitDates reads when each file of a checkout last changed -// (gitlog.LastChanged); a parameter so tests need no git. -type gitDates func(ctx context.Context, dir string, opts gitlog.Options) (map[string]time.Time, error) +// sourceBasesFunc opens a reader of what the source of each language +// version said when the version was last current with it, from the git +// checkout at dir (gitlog.SourceBases); a parameter so tests need no git. +// The reader must be called before cancel. +type sourceBasesFunc func(ctx context.Context, dir string, opts gitlog.Options) (reader quality.BaseReader, cancel func()) // validateDeps are what `cms validate` reaches outside the site's files. type validateDeps struct { - // lastChanged runs for --git only. - lastChanged gitDates + // sourceBases runs for --git only. + sourceBases sourceBasesFunc } func newValidateCmd(deps validateDeps) *cobra.Command { @@ -117,9 +118,12 @@ for: search (titles, descriptions, share images, noindex), accessibility with --git, outdated translations) and media (heavy images, unused files). Quality findings are never errors: high and medium impact ones are warnings, low impact and information-only ones notices. --strict-quality -turns quality warnings into errors. --git reads when each file last -changed from the checkout's git history (git must be installed), so a -translation left behind its newer language version is found. +turns quality warnings into errors. --git reads the checkout's git +history (git must be installed) to find a translation whose source, the +page in the site's default language, changed a text since the +translation last changed or was marked as current. Changed links, +images, numbers and white space are not texts to translate and never +count. Each finding names the file, the field path inside it, a severity and a rule id (schema.unresolved_ref, content.required, quality.title_missing…). @@ -155,7 +159,7 @@ Notices never fail a run. A path that is not a CMS site exits 3.`, return nil, err } if withGit && !withQuality { - return nil, clierr.Usage(errors.New("--git needs --quality: the dates are for the content quality checks")) + return nil, clierr.Usage(errors.New("--git needs --quality: the history is for the content quality checks")) } if strictQuality && !withQuality { return nil, clierr.Usage(errors.New("--strict-quality needs --quality")) @@ -183,12 +187,24 @@ Notices never fail a run. A path that is not a CMS site exits 3.`, opts.Only = append(opts.Only, validate.ScopeQuality) opts.StrictQuality = strictQuality opts.Quality = quality.Options{ListMedia: quality.FSMedia(site), RootFiles: quality.FSRootFiles(site)} - if withGit { - dates, err := readGitDates(cmd.Context(), path, deps.lastChanged) + } + // The history is read only when the checks have language + // versions to judge, during validate.Site; its error is kept + // and ends the run after it. + var historyErr error + historyCtx := cmd.Context() + if withGit { + var cancel context.CancelFunc + historyCtx, cancel = context.WithTimeout(historyCtx, gitlog.DefaultTimeout) + defer cancel() + read, stop := deps.sourceBases(historyCtx, path, gitlog.Options{}) + defer stop() + opts.Quality.SourceBases = func(q []quality.BaseQuery) ([]quality.SourceBase, error) { + out, err := read(q) if err != nil { - return nil, err + historyErr = err } - opts.Quality.LastChanged = dates + return out, err } } @@ -204,6 +220,9 @@ Notices never fail a run. A path that is not a CMS site exits 3.`, if err != nil { return nil, err } + if historyErr != nil { + return nil, gitHistoryError(historyCtx, path, historyErr) + } rep := validateReport{ SchemaVersion: validateReportVersion, @@ -260,45 +279,41 @@ Notices never fail a run. A path that is not a CMS site exits 3.`, cmd.Flags().StringVar(&failOn, "fail-on", failOnError, "Exit 1 on findings of this severity or worse: warning, error or none") cmd.Flags().BoolVar(&withQuality, "quality", false, "Also run the content quality checks (search, accessibility, languages, media); their findings are warnings and notices") cmd.Flags().BoolVar(&strictQuality, "strict-quality", false, "With --quality, treat content quality warnings as errors; notices stay notices") - cmd.Flags().BoolVar(&withGit, "git", false, "With --quality, read when each file last changed from the checkout's git history, so outdated translations are found") + cmd.Flags().BoolVar(&withGit, "git", false, "With --quality, read the checkout's git history, so translations whose source changed a text are found") cmdutil.FlagEnum(cmd, "only", validateScopes...) cmdutil.FlagEnum(cmd, "fail-on", validateFailOn...) return cmd } -// readGitDates runs read on the checkout at path with a deadline -// (gitlog.DefaultTimeout) and turns its failures into errors a person can -// act on. --git asked for the dates, so a failure ends the run rather than -// silently skipping the check that needs them. -func readGitDates(ctx context.Context, path string, read gitDates) (map[string]time.Time, error) { - ctx, cancel := context.WithTimeout(ctx, gitlog.DefaultTimeout) - defer cancel() - dates, err := read(ctx, path, gitlog.Options{}) +// gitHistoryError turns a failure to read the git history (ctx is the +// one the history was read under) into an error a person can act on. +// --git asked for the history, so a failure ends the run rather than +// silently skipping the check that needs it. The context decides first: +// git stopped by the deadline or an interrupt may fail in any way. +func gitHistoryError(ctx context.Context, path string, err error) error { switch { - case err == nil: - return dates, nil - case errors.Is(err, context.Canceled): + case errors.Is(ctx.Err(), context.Canceled), errors.Is(err, context.Canceled): // Interrupted: the root reports it as such. - return nil, err + return errors.Join(context.Canceled, err) + case errors.Is(ctx.Err(), context.DeadlineExceeded), errors.Is(err, context.DeadlineExceeded): + return &clierr.Error{ + Code: clierr.CodeTimeout, + Message: fmt.Sprintf("--git: reading the git history of %s took longer than %s", path, gitlog.DefaultTimeout), + Hint: "Drop --git to check without the history; outdated translations are then not looked for.", + Err: errors.Join(context.DeadlineExceeded, err), + } case errors.Is(err, gitlog.ErrNotARepository): - return nil, &clierr.Error{ + return &clierr.Error{ Code: clierr.CodeUsage, Message: fmt.Sprintf("--git: %s is not in a git checkout, or git is not installed", path), Hint: "Run it on a clone of the site's repository with git on the PATH, or drop --git.", Err: err, } - case errors.Is(err, context.DeadlineExceeded): - return nil, &clierr.Error{ - Code: clierr.CodeTimeout, - Message: fmt.Sprintf("--git: reading the git history of %s took longer than %s", path, gitlog.DefaultTimeout), - Hint: "Drop --git to check without the dates; outdated translations are then not looked for.", - Err: err, - } default: - return nil, &clierr.Error{ + return &clierr.Error{ Code: clierr.CodeError, Message: fmt.Sprintf("--git: reading the git history of %s: %v", path, err), - Hint: "Drop --git to check without the dates; outdated translations are then not looked for.", + Hint: "Drop --git to check without the history; outdated translations are then not looked for.", Err: err, } } @@ -324,7 +339,7 @@ func printQualityNotes(w io.Writer, s *quality.Summary, withGit bool) { for _, sk := range s.Skipped { note := sk.Reason if sk.Rule == report.RuleQualityTranslationOutdated && !withGit { - note += "; pass --git to read the dates from the git history" + note += "; pass --git to read the git history" } fmt.Fprintf(w, "skipped %s: %s\n", sk.Rule, note) } diff --git a/internal/cli/cms/validate_git_test.go b/internal/cli/cms/validate_git_test.go new file mode 100644 index 0000000..8cdc508 --- /dev/null +++ b/internal/cli/cms/validate_git_test.go @@ -0,0 +1,148 @@ +package cms + +import ( + "errors" + "os" + "os/exec" + "path/filepath" + "strconv" + "strings" + "testing" + + "github.com/norcubeplatform/cms-schema/gitlog" + + "github.com/norcubeplatform/cli/internal/clierr" +) + +// gitPages is the pages collection of qualitySite with a link to judge: +// a changed link is nothing to translate. +const gitPages = `label: Pages +path: src/content/pages +match: '**/*.md' +previewPath: '/{locale}/{slug}/' +localeFrom: path +translations: + by: path +fields: + - {key: title, type: text, label: Title, required: true, role: seoTitle} + - {key: slug, type: text, label: Slug} + - {key: more, type: link, label: Read more} +` + +func gitPage(title, more string) string { + return "---\ntitle: " + title + "\nslug: about\nmore: " + more + "\n---\n" +} + +// gitRepo is a repository holding qualitySite in website/, as a monorepo +// holds its site. +type gitRepo struct { + t *testing.T + root string + secs int64 +} + +func newGitRepo(t *testing.T) *gitRepo { + t.Helper() + if _, err := exec.LookPath("git"); err != nil { + t.Skip("git is not installed") + } + root := t.TempDir() + // git must not find a repository above the temporary directory, nor + // read the machine's configuration (signing, hooks). + t.Setenv("GIT_CEILING_DIRECTORIES", filepath.Dir(root)) + t.Setenv("GIT_CONFIG_GLOBAL", os.DevNull) + t.Setenv("GIT_CONFIG_NOSYSTEM", "1") + if err := os.CopyFS(filepath.Join(root, "website"), os.DirFS(qualitySite)); err != nil { + t.Fatal(err) + } + return &gitRepo{t: t, root: root, secs: 1_000_000_000} +} + +func (r *gitRepo) site() string { return filepath.Join(r.root, "website") } + +func (r *gitRepo) git(args ...string) { + r.t.Helper() + cmd := exec.Command("git", append([]string{"-C", r.root}, args...)...) // #nosec G204 -- fixed git arguments of this test + date := "@" + strconv.FormatInt(r.secs, 10) + " +0000" + cmd.Env = append(os.Environ(), "GIT_AUTHOR_NAME=t", "GIT_AUTHOR_EMAIL=t@example.com", + "GIT_COMMITTER_NAME=t", "GIT_COMMITTER_EMAIL=t@example.com", + "GIT_AUTHOR_DATE="+date, "GIT_COMMITTER_DATE="+date) + if out, err := cmd.CombinedOutput(); err != nil { + r.t.Fatalf("git %v: %v\n%s", args, err, out) + } +} + +// write writes files of the site, paths relative to website/. +func (r *gitRepo) write(files map[string]string) { + r.t.Helper() + for p, body := range files { + if err := os.WriteFile(filepath.Join(r.site(), filepath.FromSlash(p)), []byte(body), 0o600); err != nil { + r.t.Fatal(err) + } + } +} + +// commit writes and commits files months after the previous commit: the +// dates must never matter, only what changed. +func (r *gitRepo) commit(files map[string]string) { + r.t.Helper() + r.write(files) + r.secs += 200 * 24 * 3600 + r.git("add", ".") + r.git("commit", "-q", "-m", "change") +} + +// outdated runs `validate --quality --git` on the site and returns the +// translation_outdated rows. +func (r *gitRepo) outdated() []string { + r.t.Helper() + out, _, err := execValidate(r.t, validateDeps{sourceBases: gitlog.SourceBases}, r.site(), "--quality", "--git", "--fail-on", "none") + if err != nil { + r.t.Fatal(err) + } + return outdatedLines(out) +} + +func TestValidateGitJudgesChangedTexts(t *testing.T) { + r := newGitRepo(t) + r.git("init", "-q") + r.commit(map[string]string{ + ".norcube/cms/collections/pages.yml": gitPages, + qualityEnPage: gitPage("About the studio", "/cs/about/"), + qualityCsPage: gitPage("O ateliéru", "/en/about/"), + }) + if got := r.outdated(); len(got) != 0 { + t.Fatalf("both languages in one commit: %v", got) + } + + // The source's link changes months later: nothing to translate. + r.commit(map[string]string{qualityEnPage: gitPage("About the studio", "/cs/about/#team")}) + if got := r.outdated(); len(got) != 0 { + t.Fatalf("a link change made the translation outdated: %v", got) + } + + // The source's title changes: the translation is behind. + r.commit(map[string]string{qualityEnPage: gitPage("About the studio and its people", "/cs/about/#team")}) + got := r.outdated() + if len(got) != 1 || !strings.Contains(got[0], qualityCsPage) || !strings.Contains(got[0], "title") { + t.Fatalf("a title change: %v", got) + } + + // The translation is being updated in the working tree: it is current. + r.write(map[string]string{qualityCsPage: gitPage("O ateliéru a lidech", "/en/about/")}) + if got := r.outdated(); len(got) != 0 { + t.Fatalf("a translation changed in the working tree: %v", got) + } +} + +func TestValidateGitOutsideACheckout(t *testing.T) { + r := newGitRepo(t) + _, _, err := execValidate(t, validateDeps{sourceBases: gitlog.SourceBases}, r.site(), "--quality", "--git") + var ce *clierr.Error + if !errors.As(err, &ce) || ce.Code != clierr.CodeUsage || !errors.Is(err, gitlog.ErrNotARepository) { + t.Fatalf("got %v", err) + } + if !strings.Contains(ce.Hint, "clone") { + t.Errorf("hint %q", ce.Hint) + } +} diff --git a/internal/cli/cms/validate_test.go b/internal/cli/cms/validate_test.go index cc3d686..37996db 100644 --- a/internal/cli/cms/validate_test.go +++ b/internal/cli/cms/validate_test.go @@ -4,11 +4,13 @@ import ( "bytes" "context" "errors" + "fmt" "strings" "testing" "time" "github.com/norcubeplatform/cms-schema/gitlog" + "github.com/norcubeplatform/cms-schema/quality" "github.com/norcubeplatform/cms-schema/report" "github.com/norcubeplatform/cli/internal/clierr" @@ -33,29 +35,76 @@ func execValidate(t *testing.T, deps validateDeps, args ...string) (string, stri return stdout.String(), stderr.String(), err } -func TestValidateGitDatesReachQuality(t *testing.T) { - now := time.Now() - calls := 0 - deps := validateDeps{lastChanged: func(_ context.Context, dir string, _ gitlog.Options) (map[string]time.Time, error) { - calls++ - if dir != qualitySite { - t.Errorf("git read %q, want the site's path", dir) +// The pages of qualitySite: English is the default language, so the +// English page is the source of the Czech one. +const ( + qualityEnPage = "src/content/pages/en/about.md" + qualityCsPage = "src/content/pages/cs/about.md" +) + +// fakeSourceBases answers every query with base, and counts the readers +// opened and the calls made. +type fakeSourceBases struct { + t *testing.T + base func(q quality.BaseQuery) quality.SourceBase + err error + opened int + read int + queries []quality.BaseQuery +} + +func (f *fakeSourceBases) open(ctx context.Context, dir string, _ gitlog.Options) (quality.BaseReader, func()) { + f.opened++ + if dir != qualitySite { + f.t.Errorf("git read %q, want the site's path", dir) + } + if deadline, ok := ctx.Deadline(); !ok || time.Until(deadline) > gitlog.DefaultTimeout { + f.t.Errorf("no deadline of at most %s: %v %v", gitlog.DefaultTimeout, deadline, ok) + } + return func(q []quality.BaseQuery) ([]quality.SourceBase, error) { + f.read++ + f.queries = append(f.queries, q...) + if f.err != nil { + return nil, f.err } - return map[string]time.Time{ - "src/content/pages/en/about.md": now, - "src/content/pages/cs/about.md": now.Add(-30 * 24 * time.Hour), - }, nil + out := make([]quality.SourceBase, len(q)) + for i := range q { + out[i] = f.base(q[i]) + } + return out, nil + }, func() {} +} + +// outdatedLines are the table rows of quality.translation_outdated. +func outdatedLines(out string) []string { + var lines []string + for _, line := range strings.Split(out, "\n") { + if strings.Contains(line, string(report.RuleQualityTranslationOutdated)) { + lines = append(lines, line) + } + } + return lines +} + +func TestValidateGitHistoryReachesQuality(t *testing.T) { + fake := &fakeSourceBases{t: t, base: func(q quality.BaseQuery) quality.SourceBase { + if q.Translation != qualityCsPage || q.Source != qualityEnPage { + return quality.SourceBase{} + } + // The English title was different when the Czech page last changed. + return quality.SourceBase{Known: true, Content: []byte("---\ntitle: About us\nslug: about\n---\n")} }} + deps := validateDeps{sourceBases: fake.open} out, stderr, err := execValidate(t, deps, qualitySite, "--quality") if err != nil { t.Fatal(err) } - if calls != 0 { + if fake.opened != 0 { t.Fatalf("git ran without --git") } - if strings.Contains(out, string(report.RuleQualityTranslationOutdated)) { - t.Fatalf("outdated translations reported without dates:\n%s", out) + if got := outdatedLines(out); len(got) != 0 { + t.Fatalf("outdated translations reported without the history:\n%s", out) } if !strings.Contains(stderr, "skipped quality.translation_outdated") || !strings.Contains(stderr, "--git") { t.Errorf("the skipped rule is not explained: %q", stderr) @@ -65,74 +114,84 @@ func TestValidateGitDatesReachQuality(t *testing.T) { if err != nil { t.Fatal(err) } - if calls != 1 { - t.Fatalf("git ran %d times", calls) + if fake.opened != 1 || fake.read != 1 { + t.Fatalf("history opened %d times, read %d times", fake.opened, fake.read) } - var outdated string - for _, line := range strings.Split(out, "\n") { - if strings.Contains(line, string(report.RuleQualityTranslationOutdated)) { - outdated = line - } - } - if !strings.Contains(outdated, "src/content/pages/cs/about.md") { - t.Fatalf("the older language version is not reported as outdated:\n%s", out) + got := outdatedLines(out) + if len(got) != 1 || !strings.Contains(got[0], qualityCsPage) || !strings.Contains(got[0], "title") { + t.Fatalf("the Czech page whose source changed its title is not reported once:\n%s", out) } if strings.Contains(stderr, "skipped quality.translation_outdated") { t.Errorf("the rule is still skipped with --git: %q", stderr) } -} -func TestReadGitDates(t *testing.T) { - t.Run("a deadline and the path", func(t *testing.T) { - want := map[string]time.Time{"a.md": time.Unix(1, 0)} - got, err := readGitDates(context.Background(), "site", func(ctx context.Context, dir string, _ gitlog.Options) (map[string]time.Time, error) { - deadline, ok := ctx.Deadline() - if !ok || time.Until(deadline) > gitlog.DefaultTimeout { - t.Errorf("no deadline of at most %s: %v %v", gitlog.DefaultTimeout, deadline, ok) - } - if dir != "site" { - t.Errorf("dir %q", dir) - } - return want, nil - }) - if err != nil || len(got) != 1 || !got["a.md"].Equal(want["a.md"]) { - t.Fatalf("got %v, %v", got, err) - } - }) + // A base that says the source is the same: nothing to translate. + fake.base = func(quality.BaseQuery) quality.SourceBase { return quality.SourceBase{Known: true, Same: true} } + out, _, err = execValidate(t, deps, qualitySite, "--quality", "--git") + if err != nil { + t.Fatal(err) + } + if got := outdatedLines(out); len(got) != 0 { + t.Fatalf("an unchanged source made a translation outdated:\n%s", out) + } +} +// A history that can't be read ends the run with an error that says why: +// --git asked for it, so the check is not silently skipped. +func TestValidateGitHistoryFailures(t *testing.T) { cases := []struct { name string err error code string }{ {"not a checkout is a usage error", gitlog.ErrNotARepository, clierr.CodeUsage}, - {"too slow is a timeout", context.DeadlineExceeded, clierr.CodeTimeout}, + {"too slow is a timeout", fmt.Errorf("git log: %w", context.DeadlineExceeded), clierr.CodeTimeout}, {"anything else is an error", errors.New("git log: exit status 128"), clierr.CodeError}, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { - dates, err := readGitDates(context.Background(), "site", func(context.Context, string, gitlog.Options) (map[string]time.Time, error) { - return nil, c.err - }) + fake := &fakeSourceBases{t: t, err: c.err} + out, _, err := execValidate(t, validateDeps{sourceBases: fake.open}, qualitySite, "--quality", "--git") var ce *clierr.Error - if dates != nil || !errors.As(err, &ce) || ce.Code != c.code || !errors.Is(err, c.err) { - t.Fatalf("got %v, %v", dates, err) + if !errors.As(err, &ce) || ce.Code != c.code || !errors.Is(err, c.err) { + t.Fatalf("got %v", err) } if !strings.Contains(ce.Message, "--git") || ce.Hint == "" { t.Errorf("message %q hint %q", ce.Message, ce.Hint) } + if out != "" { + t.Errorf("a report was printed: %q", out) + } }) } t.Run("an interrupt stays an interrupt", func(t *testing.T) { - _, err := readGitDates(context.Background(), "site", func(context.Context, string, gitlog.Options) (map[string]time.Time, error) { - return nil, context.Canceled - }) + fake := &fakeSourceBases{t: t, err: fmt.Errorf("git log: %w", context.Canceled)} + _, _, err := execValidate(t, validateDeps{sourceBases: fake.open}, qualitySite, "--quality", "--git") var ce *clierr.Error if !errors.Is(err, context.Canceled) || errors.As(err, &ce) { t.Fatalf("got %v", err) } }) + + // git killed by the deadline fails in any way (a killed + // `git rev-parse` reads as "not a repository"): the context decides. + t.Run("a passed deadline is a timeout whatever git said", func(t *testing.T) { + ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(-time.Second)) + defer cancel() + var ce *clierr.Error + if err := gitHistoryError(ctx, "site", gitlog.ErrNotARepository); !errors.As(err, &ce) || ce.Code != clierr.CodeTimeout { + t.Fatalf("got %v", err) + } + }) + t.Run("an interrupt is an interrupt whatever git said", func(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + cancel() + var ce *clierr.Error + if err := gitHistoryError(ctx, "site", errors.New("signal: killed")); !errors.Is(err, context.Canceled) || errors.As(err, &ce) { + t.Fatalf("got %v", err) + } + }) } func TestFindingPathShowsTheLanguage(t *testing.T) { From 302d98d705d2437ee1548f6b284596ce3bdffba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0v=C3=A1b=C3=ADk?= Date: Wed, 25 Nov 2026 13:51:17 +0100 Subject: [PATCH 6/7] fix(cms): validate --git refuses a shallow clone (cms-schema 0.11.1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A clone made with --depth, the default of actions/checkout, lists every file as added by its oldest commit, so every translation looked current and --git passed in CI without a word. cms-schema 0.11.1 returns gitlog.ErrShallowHistory for it; the CLI maps it to usage_error with a hint to fetch the full history (git fetch --unshallow, or fetch-depth: 0) or drop --git. Help, README and changelog say CI needs the full history. Signed-off-by: Jan Švábík --- CHANGELOG.md | 12 ++++++--- README.md | 12 +++++++-- docs/DESIGN.md | 2 +- go.mod | 2 +- go.sum | 4 +-- internal/cli/cms/validate.go | 12 ++++++++- internal/cli/cms/validate_git_test.go | 35 +++++++++++++++++++++++++++ internal/cli/cms/validate_test.go | 1 + 8 files changed, 69 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6c2dd1..30e65a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,10 +23,14 @@ this file collects what users and scripts need to know. a text since the version last changed or was marked current. Changed links, images, numbers, select values and white space are not texts to translate and never count, and a version whose history can't be read - (a shallow clone, a file git doesn't know) is not judged. `--git` needs - `--quality`; if git cannot read the history, the run stops with an error - (`usage_error` outside a checkout, `timeout`, `error`). -- `cms validate` uses cms-schema 0.11.0: language versions + (a file git doesn't know, or older than the history read) is not + judged. `--git` needs `--quality`; if git cannot read the history, the + run stops with an error (`usage_error` outside a checkout, `timeout`, + `error`). A shallow clone is refused with `usage_error`, because its + history would make every translation look current: in CI, check out + with `fetch-depth: 0` (`actions/checkout`) or run `git fetch + --unshallow` first. +- `cms validate` uses cms-schema 0.11.1: language versions (`translations.by`), field roles (`role:`, `whenEmpty`, `titleTemplate`), image alt text (`alt:`, `decorative`), languages held in one file (`localized: true`), `translations.locales`, translation diff --git a/README.md b/README.md index 0afac35..8c89201 100644 --- a/README.md +++ b/README.md @@ -253,8 +253,16 @@ norcube cms validate ./site --quality --git --strict-quality # in CI - `--git` (with `--quality`) reads the checkout's git history, so a translation whose source changed a text since the translation last changed is found; changed links, images and numbers don't count. It - needs git and a clone of the repository; if git cannot read the - history, the command stops with an error. + needs git and a full clone of the repository; if git cannot read the + history, the command stops with an error. A shallow clone is refused, + so in CI check out with `fetch-depth: 0`: + + ```yaml + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # cms validate --git reads the whole history + - run: norcube cms validate --quality --git --strict-quality + ``` `-o json` prints every finding with its rule id, and with `--quality` a `quality` summary of what was checked, skipped and guessed. diff --git a/docs/DESIGN.md b/docs/DESIGN.md index 1f527fb..d3e3e5c 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -802,7 +802,7 @@ changelog, and the owner's decisions in the planning sessions of | 2026-11-05 | `--auto-post` is the one page setting `create` doesn't require: the flag came after 0.23.0, so requiring it would break scripts that create pages, and the API keeps it off unless asked. `--notify` is sent only when given, and exists only on writes that add an update | Compatibility rule P10; owner's brief | owner | | 2026-11-15 | `cms validate`: a `cms` group whose first command works on a site checkout, offline, with no sign-in. The checks live in the public `github.com/norcubeplatform/cms-schema` module, which the CMS service and the dashboard's fixtures share, so the CLI is a thin wrapper and cannot drift from the editor. `--fail-on` defaults to `error` (unlike `monitor status`, whose default is `none`) because a validator that exits 0 on errors would be useless in CI; findings keep their severity whatever `--fail-on` says. A failed run uses the new code `invalid`, not `unhealthy`: `unhealthy` describes a service's state, `invalid` what the command checked. The report is printed before the error so CI keeps it. The path argument completes directories only | Owner's brief: validate a whole site against every page, locally and in CI, with the rules the editor runs. Rejected: putting the checks in the CLI module (the private backend would then depend on the CLI's releases and dependency graph); a `--strict` flag (the tree already has `--fail-on` for this); naming the command `cms schema validate` (content and links are checked too) | owner | | 2026-11-23 | `cms validate --quality` (cms-schema 0.10.0): the content quality checks run only when asked for, as in the module, because their findings are advice rather than breakage; they are warnings and notices, never errors, and notices never fail a run whatever `--fail-on` says. `--strict-quality` fails on quality warnings alone (unlike `--fail-on warning`, which also fails on correctness warnings). `--git` reads when each file last changed from `git log` with a deadline; it needs `--quality`, and a git failure ends the run with its own code (`usage_error` outside a checkout, `timeout`, `error`) instead of silently skipping the outdated-translation check the person asked for. Quality is a flag, not an `--only` value, so `--only` keeps meaning the correctness checks. A finding about one language of a page that holds every language shows the language after its path in the PATH column (`title.en [en]`); `-o json` has it as `locale` | Owner's brief: run the module's quality checks from the CLI, mirroring `cms-schema-validate`. Rejected: a LOCALE column (mostly empty, and placed after MESSAGE in `-o text`); skipping the outdated check when git fails (the person asked for it) | owner | -| 2026-11-25 | `cms validate --git` with cms-schema 0.11.0: an outdated translation is one whose source changed a translatable text since the translation last changed or was marked current, so `--git` hands the module a reader of the source's earlier versions (`gitlog.SourceBases`) instead of file dates. The history is read only when the checks have language versions to judge, under the same deadline; a read failure still ends the run with the same codes, and the deadline or an interrupt decides the code before what git printed (a killed `git rev-parse` reads as "not a repository") | A date says nothing about what changed: a changed link or a commit in another folder made a translation "outdated". Rejected: reading the history up front to fail early on a site without language versions (twice the git work for a check with nothing to judge) | owner | +| 2026-11-25 | `cms validate --git` with cms-schema 0.11.0: an outdated translation is one whose source changed a translatable text since the translation last changed or was marked current, so `--git` hands the module a reader of the source's earlier versions (`gitlog.SourceBases`) instead of file dates. The history is read only when the checks have language versions to judge, under the same deadline; a read failure still ends the run with the same codes, and the deadline or an interrupt decides the code before what git printed (a killed `git rev-parse` reads as "not a repository"). A shallow clone is refused with `usage_error` (cms-schema 0.11.1, `gitlog.ErrShallowHistory`): its oldest commit lists every file as added, so every translation would look current, a silent pass in CI, where `actions/checkout` clones with depth 1 | A date says nothing about what changed: a changed link or a commit in another folder made a translation "outdated". Rejected: reading the history up front to fail early on a site without language versions (twice the git work for a check with nothing to judge) | owner | --- diff --git a/go.mod b/go.mod index 26bb53a..a479da0 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/gofrs/flock v0.13.0 github.com/google/uuid v1.6.0 github.com/jmespath-community/go-jmespath v1.1.1 - github.com/norcubeplatform/cms-schema v0.11.0 + github.com/norcubeplatform/cms-schema v0.11.1 github.com/oapi-codegen/runtime v1.4.0 github.com/pelletier/go-toml/v2 v2.3.1 github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c diff --git a/go.sum b/go.sum index e188146..e6e8bfc 100644 --- a/go.sum +++ b/go.sum @@ -129,8 +129,8 @@ github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELU github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= -github.com/norcubeplatform/cms-schema v0.11.0 h1:tCe5qh4qyKJqmrdtGe4LbQ9yIxDySotwEZpNiQxCjJM= -github.com/norcubeplatform/cms-schema v0.11.0/go.mod h1:fY05NpvoygKgMBZjj3+R6KI1vko9CSJPJKS02n6WRh0= +github.com/norcubeplatform/cms-schema v0.11.1 h1:GWief9ru4UOTNlEjidKZ3LACcKWRDavJwz66l51gu1I= +github.com/norcubeplatform/cms-schema v0.11.1/go.mod h1:fY05NpvoygKgMBZjj3+R6KI1vko9CSJPJKS02n6WRh0= github.com/oapi-codegen/runtime v1.4.0 h1:KLOSFOp7UzkbS7Cs1ms6NBEKYr0WmH2wZG0KKbd2er4= github.com/oapi-codegen/runtime v1.4.0/go.mod h1:5sw5fxCDmnOzKNYmkVNF8d34kyUeejJEY8HNT2WaPec= github.com/oasdiff/yaml v0.1.1 h1:6nHx+pn9gBRM6YpBlFZFQGCCd1nuvqOBtTD3KKTgGxY= diff --git a/internal/cli/cms/validate.go b/internal/cli/cms/validate.go index 2c66dd8..5e45dde 100644 --- a/internal/cli/cms/validate.go +++ b/internal/cli/cms/validate.go @@ -123,7 +123,8 @@ history (git must be installed) to find a translation whose source, the page in the site's default language, changed a text since the translation last changed or was marked as current. Changed links, images, numbers and white space are not texts to translate and never -count. +count. --git needs the full history: a shallow clone is refused (in CI, +check out with fetch-depth: 0). Each finding names the file, the field path inside it, a severity and a rule id (schema.unresolved_ref, content.required, quality.title_missing…). @@ -309,6 +310,15 @@ func gitHistoryError(ctx context.Context, path string, err error) error { Hint: "Run it on a clone of the site's repository with git on the PATH, or drop --git.", Err: err, } + case errors.Is(err, gitlog.ErrShallowHistory): + // Its oldest commit lists every file as added, so every + // translation would look current: refused, never judged. + return &clierr.Error{ + Code: clierr.CodeUsage, + Message: fmt.Sprintf("--git: %s is a shallow clone, so its history can't tell which translations are out of date", path), + Hint: "Fetch the full history (git fetch --unshallow, or fetch-depth: 0 in actions/checkout), or drop --git.", + Err: err, + } default: return &clierr.Error{ Code: clierr.CodeError, diff --git a/internal/cli/cms/validate_git_test.go b/internal/cli/cms/validate_git_test.go index 8cdc508..29d7771 100644 --- a/internal/cli/cms/validate_git_test.go +++ b/internal/cli/cms/validate_git_test.go @@ -146,3 +146,38 @@ func TestValidateGitOutsideACheckout(t *testing.T) { t.Errorf("hint %q", ce.Hint) } } + +// A shallow clone (`--depth 1`, the default of CI checkouts) would make +// every translation look current: --git refuses it with a usage error +// that says how to fetch the full history. +func TestValidateGitShallowClone(t *testing.T) { + r := newGitRepo(t) + r.git("init", "-q") + r.commit(map[string]string{ + ".norcube/cms/collections/pages.yml": gitPages, + qualityEnPage: gitPage("About the studio", "/cs/about/"), + qualityCsPage: gitPage("O ateliéru", "/en/about/"), + }) + r.commit(map[string]string{qualityEnPage: gitPage("About the studio and its people", "/cs/about/")}) + if got := r.outdated(); len(got) != 1 { + t.Fatalf("the full repository: %v", got) + } + + shallow := filepath.Join(t.TempDir(), "shallow") + r.git("clone", "-q", "--depth", "1", "file://"+r.root, shallow) + site := filepath.Join(shallow, "website") + out, _, err := execValidate(t, validateDeps{sourceBases: gitlog.SourceBases}, site, "--quality", "--git") + var ce *clierr.Error + if !errors.As(err, &ce) || ce.Code != clierr.CodeUsage || !errors.Is(err, gitlog.ErrShallowHistory) { + t.Fatalf("got %v", err) + } + if want := "--git: " + site + " is a shallow clone"; !strings.HasPrefix(ce.Message, want) { + t.Errorf("message %q", ce.Message) + } + if !strings.Contains(ce.Hint, "fetch-depth: 0") || !strings.Contains(ce.Hint, "git fetch --unshallow") { + t.Errorf("hint %q", ce.Hint) + } + if out != "" { + t.Errorf("a report was printed: %q", out) + } +} diff --git a/internal/cli/cms/validate_test.go b/internal/cli/cms/validate_test.go index 37996db..0717781 100644 --- a/internal/cli/cms/validate_test.go +++ b/internal/cli/cms/validate_test.go @@ -145,6 +145,7 @@ func TestValidateGitHistoryFailures(t *testing.T) { code string }{ {"not a checkout is a usage error", gitlog.ErrNotARepository, clierr.CodeUsage}, + {"a shallow clone is a usage error", fmt.Errorf("%w: site", gitlog.ErrShallowHistory), clierr.CodeUsage}, {"too slow is a timeout", fmt.Errorf("git log: %w", context.DeadlineExceeded), clierr.CodeTimeout}, {"anything else is an error", errors.New("git log: exit status 128"), clierr.CodeError}, } From 35b771bd5b9997d9731d4ae795c50f593e48c49e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0v=C3=A1b=C3=ADk?= Date: Wed, 25 Nov 2026 13:55:12 +0100 Subject: [PATCH 7/7] chore: release 0.28.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Švábík --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30e65a5..850b5c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ this file collects what users and scripts need to know. ## Unreleased +## 0.28.0 (2026-11-25) + ### New - `norcube cms validate --quality` also runs the content quality checks: