Skip to content

Commit

Permalink
fix golangci-lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Vatson112 authored and engelmi committed Nov 29, 2022
1 parent 0cf2123 commit c879a79
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 53 deletions.
20 changes: 10 additions & 10 deletions disk_helper_imagetransfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ func generateCorrelationID(prefix string) string {
// newImageTransfer creates a new image transfer for both uploads and downloads of images. It must be passed the
// following parameters:
//
// - cli is the oVirt SDK client.
// - logger is a logger from the go-ovirt-client-logger library
// - diskID is the ID of the disk that is being transferred to/from.
// - correlationID is an optional unique ID that can be used to check if the job completed. If no correlation ID is
// passed, this function generates a random one.
// - retries is a list of retry strategies to use for each API call.
// - direction is the direction of transfer. See ovirtsdk.ImageTransferDirection.
// - format is the disk format being uploaded, or the disk format requested. The oVirt Engine will automatically convert
// images to the requested format.
// - updateDisk is a function that will be called whenever the disk object is updated.
// - cli is the oVirt SDK client.
// - logger is a logger from the go-ovirt-client-logger library
// - diskID is the ID of the disk that is being transferred to/from.
// - correlationID is an optional unique ID that can be used to check if the job completed. If no correlation ID is
// passed, this function generates a random one.
// - retries is a list of retry strategies to use for each API call.
// - direction is the direction of transfer. See ovirtsdk.ImageTransferDirection.
// - format is the disk format being uploaded, or the disk format requested. The oVirt Engine will automatically convert
// images to the requested format.
// - updateDisk is a function that will be called whenever the disk object is updated.
func newImageTransfer(
cli *oVirtClient,
logger Logger,
Expand Down
50 changes: 25 additions & 25 deletions new.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,63 +77,63 @@ func (e *extraSettings) WithProxy(addr string) ExtraSettingsBuilder {

// New creates a new copy of the enhanced oVirt client. It accepts the following options:
//
// url
// url
//
// This is the oVirt engine URL. This must start with http:// or https:// and typically ends with /ovirt-engine/.
//
// username
// username
//
// This is the username for the oVirt engine. This must contain the profile separated with an @ sign. For example,
// admin@internal.
//
// password
// password
//
// This is the password for the oVirt engine. Other authentication mechanisms are not supported.
//
// tls
// tls
//
// This is a TLSProvider responsible for supplying TLS configuration to the client. See below for a simple example.
//
// logger
// logger
//
// This is an implementation of ovirtclientlog.Logger to provide logging.
//
// extraSettings
// extraSettings
//
// This is an implementation of the ExtraSettings interface, allowing for customization of headers and turning on
// compression.
//
// TLS
// # TLS
//
// This library tries to follow best practices when it comes to connection security. Therefore, you will need to pass
// a valid implementation of the TLSProvider interface in the tls parameter. The easiest way to do this is calling
// the ovirtclient.TLS() function and then configuring the resulting variable with the following functions:
//
// tls := ovirtclient.TLS()
// tls := ovirtclient.TLS()
//
// // Add certificates from an in-memory byte slice. Certificates must be in PEM format.
// tls.CACertsFromMemory(caCerts)
// // Add certificates from an in-memory byte slice. Certificates must be in PEM format.
// tls.CACertsFromMemory(caCerts)
//
// // Add certificates from a single file. Certificates must be in PEM format.
// tls.CACertsFromFile("/path/to/file.pem")
// // Add certificates from a single file. Certificates must be in PEM format.
// tls.CACertsFromFile("/path/to/file.pem")
//
// // Add certificates from a directory. Optionally, regular expressions can be passed that must match the file
// // names.
// tls.CACertsFromDir("/path/to/certs", regexp.MustCompile(`\.pem`))
// // Add certificates from a directory. Optionally, regular expressions can be passed that must match the file
// // names.
// tls.CACertsFromDir("/path/to/certs", regexp.MustCompile(`\.pem`))
//
// // Add system certificates
// tls.CACertsFromSystem()
// // Add system certificates
// tls.CACertsFromSystem()
//
// // Disable certificate verification. This is a bad idea.
// tls.Insecure()
// // Disable certificate verification. This is a bad idea.
// tls.Insecure()
//
// client, err := ovirtclient.New(
// url, username, password,
// tls,
// logger, extraSettings
// )
// client, err := ovirtclient.New(
// url, username, password,
// tls,
// logger, extraSettings
// )
//
// Extra settings
// # Extra settings
//
// This library also supports customizing the connection settings. In order to stay backwards compatible the
// extraSettings parameter must implement the ovirtclient.ExtraSettings interface. Future versions of this library will
Expand Down
1 change: 1 addition & 0 deletions newmock.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

// NewMock creates a new in-memory mock client. This client can be used as a testing facility for
// higher level code.
//
//goland:noinspection GoUnusedExportedFunction
func NewMock() MockClient {
return NewMockWithLogger(&noopLogger{})
Expand Down
20 changes: 10 additions & 10 deletions util_test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,43 +505,43 @@ func NewMockTestHelper(logger ovirtclientlog.Logger) (TestHelper, error) {
// NewLiveTestHelperFromEnv is a function that creates a test helper working against a live (not mock)
// oVirt engine using environment variables. The environment variables are as follows:
//
// OVIRT_URL
// OVIRT_URL
//
// URL of the oVirt engine. Mandatory.
//
// OVIRT_USERNAME
// OVIRT_USERNAME
//
// The username for the oVirt engine. Mandatory.
//
// OVIRT_PASSWORD
// OVIRT_PASSWORD
//
// The password for the oVirt engine. Mandatory.
//
// OVIRT_CAFILE
// OVIRT_CAFILE
//
// A file containing the CA certificate in PEM format.
//
// OVIRT_CA_BUNDLE
// OVIRT_CA_BUNDLE
//
// Provide the CA certificate in PEM format directly.
//
// OVIRT_INSECURE
// OVIRT_INSECURE
//
// Disable certificate verification if set. Not recommended.
//
// OVIRT_CLUSTER_ID
// OVIRT_CLUSTER_ID
//
// The cluster to use for testing. Will be automatically chosen if not provided.
//
// OVIRT_BLANK_TEMPLATE_ID
// OVIRT_BLANK_TEMPLATE_ID
//
// ID of the blank template. Will be automatically chosen if not provided.
//
// OVIRT_STORAGE_DOMAIN_ID
// OVIRT_STORAGE_DOMAIN_ID
//
// Storage domain to use for testing. Will be automatically chosen if not provided.
//
// OVIRT_VNIC_PROFILE_ID
// OVIRT_VNIC_PROFILE_ID
//
// VNIC profile to use for testing. Will be automatically chosen if not provided.
func NewLiveTestHelperFromEnv(logger ovirtclientlog.Logger) (TestHelper, error) {
Expand Down
16 changes: 8 additions & 8 deletions util_wait_for_job_finished.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import (
// under 30 chars. To set a correlationID add `Query("correlation_id", correlationID)` to the engine API call, for
// example:
//
// correlationID := fmt.Sprintf("image_transfer_%s", utilrand.String(5))
// conn.
// SystemService().
// DisksService().
// DiskService(diskId).
// Update().
// Query("correlation_id", correlationID).
// Send()
// correlationID := fmt.Sprintf("image_transfer_%s", utilrand.String(5))
// conn.
// SystemService().
// DisksService().
// DiskService(diskId).
// Update().
// Query("correlation_id", correlationID).
// Send()
func (o *oVirtClient) waitForJobFinished(correlationID string, retries []RetryStrategy) error {
return retry(
fmt.Sprintf("waiting for job with correlation ID %s to finish", correlationID),
Expand Down

0 comments on commit c879a79

Please sign in to comment.