diff --git a/Makefile b/Makefile index 2f88740f6..0029edbd0 100644 --- a/Makefile +++ b/Makefile @@ -226,7 +226,7 @@ build: build-cli build-agent build-server ## Build all project binaries docs: export TZ = UTC ## set UTC as the default timezone in generated docs docs: build ## Update docs/source with generated code @rm -rf docs/source/sctool/partials - @SCYLLA_MANAGER_CLUSTER="" ./sctool doc -o docs/source/sctool/partials + @SCYLLA_MANAGER_CLUSTER="" ./sctool.dev doc -o docs/source/sctool/partials .PHONY: filler-tool filler-tool: ## Build "filler" tool diff --git a/docs/source/sctool/partials/sctool_backup.yaml b/docs/source/sctool/partials/sctool_backup.yaml index 6c82b9c14..1da58e4c4 100644 --- a/docs/source/sctool/partials/sctool_backup.yaml +++ b/docs/source/sctool/partials/sctool_backup.yaml @@ -125,6 +125,14 @@ options: default_value: "false" usage: | Prints table names together with keyspace, used in combination with --dry-run. + - name: skip-schema + default_value: "false" + usage: | + Don't backup schema. + For ScyllaDB versions starting at 6.0 and 2024.2, SM requires CQL credentials to back up the schema. + CQL Credentials can be added with 'sctool cluster update --username --password' command. + This flag can be used to skip this step and allow for backing up user data without providing SM with CQL credentials. + Note that it's impossible to restore schema from such backups. - name: snapshot-parallel default_value: '[]' usage: | diff --git a/docs/source/sctool/partials/sctool_backup_update.yaml b/docs/source/sctool/partials/sctool_backup_update.yaml index ac3ee7146..611b60b4a 100644 --- a/docs/source/sctool/partials/sctool_backup_update.yaml +++ b/docs/source/sctool/partials/sctool_backup_update.yaml @@ -126,6 +126,14 @@ options: default_value: "false" usage: | Prints table names together with keyspace, used in combination with --dry-run. + - name: skip-schema + default_value: "false" + usage: | + Don't backup schema. + For ScyllaDB versions starting at 6.0 and 2024.2, SM requires CQL credentials to back up the schema. + CQL Credentials can be added with 'sctool cluster update --username --password' command. + This flag can be used to skip this step and allow for backing up user data without providing SM with CQL credentials. + Note that it's impossible to restore schema from such backups. - name: snapshot-parallel default_value: '[]' usage: | diff --git a/v3/swagger/agent.json b/v3/swagger/agent.json index 022deea5e..de8bf5732 100644 --- a/v3/swagger/agent.json +++ b/v3/swagger/agent.json @@ -19,7 +19,7 @@ "paths": { "/rclone/core/bwlimit": { "post": { - "description": "This sets the bandwidth limit to that passed in", + "description": "This sets the bandwidth limit to that passed in. If the rate parameter is not supplied then the bandwidth is queried", "summary": "Set the bandwidth limit", "operationId": "CoreBwlimit", "produces": [ @@ -54,6 +54,43 @@ "security": [] } }, + "/rclone/core/transfers": { + "post": { + "description": "This sets the default amount of transfers to that passed in. If the transfers parameter is not supplied then the transfers are queried", + "summary": "Set transfers", + "operationId": "CoreTransfers", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "transfers", + "description": "transfers", + "schema": { + "$ref": "#/definitions/Transfers" + } + } + ], + "responses": { + "200": { + "description": "transfers", + "schema": { + "$ref": "#/definitions/Transfers" + }, + "headers": {} + }, + "default": { + "description": "Server error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + }, + "headers": {} + } + }, + "security": [] + } + }, "/rclone/core/stats-reset": { "post": { "description": "Resets stats", @@ -875,6 +912,16 @@ } } }, + "Transfers": { + "title": "transfers", + "type": "object", + "properties": { + "transfers": { + "description": "The number of file transfers to run in parallel", + "type": "integer" + } + } + }, "Jobid": { "type": "object", "properties": { diff --git a/v3/swagger/gen/agent/client/operations/core_transfers_parameters.go b/v3/swagger/gen/agent/client/operations/core_transfers_parameters.go new file mode 100644 index 000000000..6b874e116 --- /dev/null +++ b/v3/swagger/gen/agent/client/operations/core_transfers_parameters.go @@ -0,0 +1,139 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/scylladb/scylla-manager/v3/swagger/gen/agent/models" +) + +// NewCoreTransfersParams creates a new CoreTransfersParams object +// with the default values initialized. +func NewCoreTransfersParams() *CoreTransfersParams { + var () + return &CoreTransfersParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewCoreTransfersParamsWithTimeout creates a new CoreTransfersParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCoreTransfersParamsWithTimeout(timeout time.Duration) *CoreTransfersParams { + var () + return &CoreTransfersParams{ + + timeout: timeout, + } +} + +// NewCoreTransfersParamsWithContext creates a new CoreTransfersParams object +// with the default values initialized, and the ability to set a context for a request +func NewCoreTransfersParamsWithContext(ctx context.Context) *CoreTransfersParams { + var () + return &CoreTransfersParams{ + + Context: ctx, + } +} + +// NewCoreTransfersParamsWithHTTPClient creates a new CoreTransfersParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCoreTransfersParamsWithHTTPClient(client *http.Client) *CoreTransfersParams { + var () + return &CoreTransfersParams{ + HTTPClient: client, + } +} + +/* +CoreTransfersParams contains all the parameters to send to the API endpoint +for the core transfers operation typically these are written to a http.Request +*/ +type CoreTransfersParams struct { + + /*Transfers + transfers + + */ + Transfers *models.Transfers + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the core transfers params +func (o *CoreTransfersParams) WithTimeout(timeout time.Duration) *CoreTransfersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the core transfers params +func (o *CoreTransfersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the core transfers params +func (o *CoreTransfersParams) WithContext(ctx context.Context) *CoreTransfersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the core transfers params +func (o *CoreTransfersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the core transfers params +func (o *CoreTransfersParams) WithHTTPClient(client *http.Client) *CoreTransfersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the core transfers params +func (o *CoreTransfersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithTransfers adds the transfers to the core transfers params +func (o *CoreTransfersParams) WithTransfers(transfers *models.Transfers) *CoreTransfersParams { + o.SetTransfers(transfers) + return o +} + +// SetTransfers adds the transfers to the core transfers params +func (o *CoreTransfersParams) SetTransfers(transfers *models.Transfers) { + o.Transfers = transfers +} + +// WriteToRequest writes these params to a swagger request +func (o *CoreTransfersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Transfers != nil { + if err := r.SetBodyParam(o.Transfers); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/v3/swagger/gen/agent/client/operations/core_transfers_responses.go b/v3/swagger/gen/agent/client/operations/core_transfers_responses.go new file mode 100644 index 000000000..af096646f --- /dev/null +++ b/v3/swagger/gen/agent/client/operations/core_transfers_responses.go @@ -0,0 +1,135 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + "strconv" + "strings" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/scylladb/scylla-manager/v3/swagger/gen/agent/models" +) + +// CoreTransfersReader is a Reader for the CoreTransfers structure. +type CoreTransfersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CoreTransfersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCoreTransfersOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewCoreTransfersDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewCoreTransfersOK creates a CoreTransfersOK with default headers values +func NewCoreTransfersOK() *CoreTransfersOK { + return &CoreTransfersOK{} +} + +/* +CoreTransfersOK handles this case with default header values. + +transfers +*/ +type CoreTransfersOK struct { + Payload *models.Transfers + JobID int64 +} + +func (o *CoreTransfersOK) GetPayload() *models.Transfers { + return o.Payload +} + +func (o *CoreTransfersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Transfers) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + if jobIDHeader := response.GetHeader("x-rclone-jobid"); jobIDHeader != "" { + jobID, err := strconv.ParseInt(jobIDHeader, 10, 64) + if err != nil { + return err + } + + o.JobID = jobID + } + return nil +} + +// NewCoreTransfersDefault creates a CoreTransfersDefault with default headers values +func NewCoreTransfersDefault(code int) *CoreTransfersDefault { + return &CoreTransfersDefault{ + _statusCode: code, + } +} + +/* +CoreTransfersDefault handles this case with default header values. + +Server error +*/ +type CoreTransfersDefault struct { + _statusCode int + + Payload *models.ErrorResponse + JobID int64 +} + +// Code gets the status code for the core transfers default response +func (o *CoreTransfersDefault) Code() int { + return o._statusCode +} + +func (o *CoreTransfersDefault) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *CoreTransfersDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + if jobIDHeader := response.GetHeader("x-rclone-jobid"); jobIDHeader != "" { + jobID, err := strconv.ParseInt(jobIDHeader, 10, 64) + if err != nil { + return err + } + + o.JobID = jobID + } + return nil +} + +func (o *CoreTransfersDefault) Error() string { + return fmt.Sprintf("agent [HTTP %d] %s", o._statusCode, strings.TrimRight(o.Payload.Message, ".")) +} diff --git a/v3/swagger/gen/agent/client/operations/operations_client.go b/v3/swagger/gen/agent/client/operations/operations_client.go index 18bd52efc..4c3f1546b 100644 --- a/v3/swagger/gen/agent/client/operations/operations_client.go +++ b/v3/swagger/gen/agent/client/operations/operations_client.go @@ -31,6 +31,8 @@ type ClientService interface { CoreStatsReset(params *CoreStatsResetParams) (*CoreStatsResetOK, error) + CoreTransfers(params *CoreTransfersParams) (*CoreTransfersOK, error) + FreeOSMemory(params *FreeOSMemoryParams) (*FreeOSMemoryOK, error) JobInfo(params *JobInfoParams) (*JobInfoOK, error) @@ -73,7 +75,7 @@ type ClientService interface { /* CoreBwlimit sets the bandwidth limit -This sets the bandwidth limit to that passed in +This sets the bandwidth limit to that passed in. If the rate parameter is not supplied then the bandwidth is queried */ func (a *Client) CoreBwlimit(params *CoreBwlimitParams) (*CoreBwlimitOK, error) { // TODO: Validate the params before sending @@ -175,6 +177,41 @@ func (a *Client) CoreStatsReset(params *CoreStatsResetParams) (*CoreStatsResetOK return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +CoreTransfers sets transfers + +This sets the default amount of transfers to that passed in. If the transfers parameter is not supplied then the transfers are queried +*/ +func (a *Client) CoreTransfers(params *CoreTransfersParams) (*CoreTransfersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCoreTransfersParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "CoreTransfers", + Method: "POST", + PathPattern: "/rclone/core/transfers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &CoreTransfersReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*CoreTransfersOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*CoreTransfersDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* FreeOSMemory returns memory to o s diff --git a/v3/swagger/gen/agent/models/transfers.go b/v3/swagger/gen/agent/models/transfers.go new file mode 100644 index 000000000..45422b1b0 --- /dev/null +++ b/v3/swagger/gen/agent/models/transfers.go @@ -0,0 +1,43 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Transfers transfers +// +// swagger:model Transfers +type Transfers struct { + + // The number of file transfers to run in parallel + Transfers int64 `json:"transfers,omitempty"` +} + +// Validate validates this transfers +func (m *Transfers) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Transfers) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Transfers) UnmarshalBinary(b []byte) error { + var res Transfers + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}