revive v1.3.7 added https://github.com/mgechev/revive/pull/966 which
checks for unused parameters in function literals. This caused several
lint errors in go-ceph code.
Signed-off-by: Manish <myathnal@redhat.com>
It's unusual to put any kind of credentials out in open. The set
of credentials defined with `S3_ACCESS_KEY` and `S3_SECRET_KEY`
variables in the script are questionable in its nature. But these
are not real/valid credential values in any form for AWS rather
used for testing the S3 compatible API from Ceph RGW. Therefore
clarify the intention and replace with sample values from official
AWS documentation.
Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
Implement support for new /info AdminOps interface, which returns
a json record similar to:
{
"info": {
"storage_backends": [
{
"name":"rados",
"cluster_id":"204a1415-0b03-4926-bf76-6aebd192a52d"
}
]
}
}
Co-authored-by: Anoop C S <anoopcs@cryptolab.net>
Co-authored-by: Sébastien Han <seb@redhat.com>
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
The request header in GetBucketPolicy(), was not passing policy in its
header, so the response received Bucket than the actual policy.
Signed-off-by: Jiffin Tony Thottan <thottanjiffin@gmail.com>
**Description:**
Added the uid member to the usage type.
We don't need to handle the uid here, as the ceph funtion handles it in the backend.
Fixes: #758
Signed-off-by: Nikhil-Ladha <nikhilladha1999@gmail.com>
These are left overs from v0.13.0 and v0.17.0 releases where we missed
to remove preview tag when corresponding APIs were promoted to stable.
Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
This change add a new bucket struct field, so we can use rgw.admin.API.GetBucketInfo()
to get a bucket's num_shards.
Format bucket.go.
Signed-off-by: oneto1 <644739768@qq.com>
THIS POTENTIALLY BREAKY DOWNSTREAM CODE (as it changes the types
of exported fields in an existing, exported struct).
The fields of the User structure representing the Subuser information
have been specified to parse this data strictly and typesafe.
The fields SwiftKeys and Subusers need the url:"-" annotation,
because otherwise url-keys in that substructure would clash with
those in the User structure.
Signed-off-by: Sebastian Riese <sebastian.riese@cloudandheat.com>
Only one of the two code paths of buildQueryPath was tested so far.
This makes the test harness tight by testing the second one (where
the path already contains a query parameter).
Signed-off-by: Sebastian Riese <sebastian.riese@cloudandheat.com>
The following changes have been done:
* Up until now everything in the argument objects was serialized to
the API calls. This was updated to restrict the serialization to
the API call parameters that are parsed in the Ceph RGW source code.
Parameters not yet supported by us are documented as comments.
Note, that a superset of the documented parameters is supported.
Documentation for the API:
<https://docs.ceph.com/en/pacific/radosgw/adminops/>
Link to the used source tree:
<193895ffba/src/rgw>
The argument parsing happens in the rgw_rest_*.cc files.
* The serialization code (valueToURLParams) has been updated to
be more in line with other serialization methods:
- A tag "-" causes the field to be ignored
- Only the first item in a list of tag items is interpreted as
name.
- The handling of pointer and direct data types has been
harmonized (the same rules for the names and value apply now).
* There is still room for improvement to make things more consistent:
A pointer to a non-elementary data type will emit unexpected
request parameters.
* Presence of required parameters is not validated by the library,
this is left to the API.
Signed-off-by: Sebastian Riese <sebastian.riese@cloudandheat.com>
We can now get an s3 user from the rgw admin ops API with its access
key. No validation on the key is performed other than not being empty.
Closes: https://github.com/ceph/go-ceph/issues/600
Signed-off-by: Sébastien Han <seb@redhat.com>
Added two apis AddUserCap() and RemoveUserCap() to add/remove the
capabilities from RGW user.
Signed-off-by: Jiffin Tony Thottan <thottanjiffin@gmail.com>
The caps is option in RGW for providing special permissions for
the ceph user, include it on the User{} so that it can be send in
the request for CreateUser().
Signed-off-by: Jiffin Tony Thottan <thottanjiffin@gmail.com>
The stat information gives idea about current storage consumption.
Include that info to the user struct
Signed-off-by: Jiffin Tony Thottan <thottanjiffin@gmail.com>
Instead of implementing our own logging let's the consumer implement
their own potential debug for each HTTP requests.
Closes: https://github.com/ceph/go-ceph/issues/508
Signed-off-by: Sébastien Han <seb@redhat.com>
We don't need to export the mock, the consumer will generate its own.
What really matters is to have an interface that consumer can mock it
desired. Reference: https://github.com/golang/go/wiki/CodeReviewComments#interfaces
Signed-off-by: Sébastien Han <seb@redhat.com>
Now that we use http.Method* constant from the http package, we don't
need to have verbHTTP type anymore.
Signed-off-by: Sébastien Han <seb@redhat.com>
We now have a new interface `HTTPClient` which helps us doing various
operations such as mutating and mocking the HTTP Client.
Signed-off-by: Sébastien Han <seb@redhat.com>
Since we are not passing a pointer, let's not return a pointer either.
Also, our use case fits well the non-returning pointer approach since
the content of the struct type is not expected to be modified.
Signed-off-by: Sébastien Han <seb@redhat.com>