mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
rebase: bump github.com/IBM/keyprotect-go-client from 0.8.0 to 0.8.1
Bumps [github.com/IBM/keyprotect-go-client](https://github.com/IBM/keyprotect-go-client) from 0.8.0 to 0.8.1. - [Release notes](https://github.com/IBM/keyprotect-go-client/releases) - [Commits](https://github.com/IBM/keyprotect-go-client/compare/v0.8.0...v0.8.1) --- updated-dependencies: - dependency-name: github.com/IBM/keyprotect-go-client dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
parent
fc89159daf
commit
9ddb4a784a
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module github.com/ceph/ceph-csi
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
github.com/IBM/keyprotect-go-client v0.8.0
|
||||
github.com/IBM/keyprotect-go-client v0.8.1
|
||||
github.com/aws/aws-sdk-go v1.44.96
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.16.13
|
||||
github.com/ceph/ceph-csi/api v0.0.0-00010101000000-000000000000
|
||||
|
6
go.sum
6
go.sum
@ -88,8 +88,8 @@ github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3
|
||||
github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
|
||||
github.com/GoogleCloudPlatform/k8s-cloud-provider v1.18.1-0.20220218231025-f11817397a1b/go.mod h1:FNj4KYEAAHfYu68kRYolGoxkaJn+6mdEsaM12VTwuI0=
|
||||
github.com/IBM/keyprotect-go-client v0.5.1/go.mod h1:5TwDM/4FRJq1ZOlwQL1xFahLWQ3TveR88VmL1u3njyI=
|
||||
github.com/IBM/keyprotect-go-client v0.8.0 h1:IgLKSigHRpCCl5cZjBkOYziUZ9zxn6w9iRh+KA8Siww=
|
||||
github.com/IBM/keyprotect-go-client v0.8.0/go.mod h1:yr8h2noNgU8vcbs+vhqoXp3Lmv73PI0zAc6VMgFvWwM=
|
||||
github.com/IBM/keyprotect-go-client v0.8.1 h1:viTQCtoeWQeDRTe8S0ed++uM4J2uf1DGuQbV9mNTCj8=
|
||||
github.com/IBM/keyprotect-go-client v0.8.1/go.mod h1:yr8h2noNgU8vcbs+vhqoXp3Lmv73PI0zAc6VMgFvWwM=
|
||||
github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab/go.mod h1:3VYc5hodBMJ5+l/7J4xAyMeuM2PNuepvHlGs8yilUCA=
|
||||
github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E=
|
||||
github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc=
|
||||
@ -278,8 +278,6 @@ github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ
|
||||
github.com/csi-addons/replication-lib-utils v0.2.0 h1:tGs42wfjkObbBo/98a3uxTFWEJ1dq5PIMqPWtdLd040=
|
||||
github.com/csi-addons/replication-lib-utils v0.2.0/go.mod h1:ROQlEsc2EerVtc/K/C+6Hx8pqaQ9MVy9xFFpyKfI9lc=
|
||||
github.com/csi-addons/spec v0.1.0/go.mod h1:Mwq4iLiUV4s+K1bszcWU6aMsR5KPsbIYzzszJ6+56vI=
|
||||
github.com/csi-addons/spec v0.1.2-0.20220829042231-b27a0d84b50b h1:C5KgryC4RwQVSF8L/pgcKftgn7Z1zHFZlACJukPlCxs=
|
||||
github.com/csi-addons/spec v0.1.2-0.20220829042231-b27a0d84b50b/go.mod h1:Mwq4iLiUV4s+K1bszcWU6aMsR5KPsbIYzzszJ6+56vI=
|
||||
github.com/csi-addons/spec v0.1.2-0.20220906123848-52ce69f90900 h1:zX0138DipZsZqxK1UwAmaRZmL89OuQMkwh7FtvTDgFw=
|
||||
github.com/csi-addons/spec v0.1.2-0.20220906123848-52ce69f90900/go.mod h1:Mwq4iLiUV4s+K1bszcWU6aMsR5KPsbIYzzszJ6+56vI=
|
||||
github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
|
||||
|
57
vendor/github.com/IBM/keyprotect-go-client/README.md
generated
vendored
57
vendor/github.com/IBM/keyprotect-go-client/README.md
generated
vendored
@ -27,7 +27,7 @@ This client expects that you have an existing IBM Cloud Key Protect Service Inst
|
||||
|
||||
Build a client with `ClientConfig` and `New`, then use the client to do some operations.
|
||||
```go
|
||||
import "github.com/IBM/keyprotect-go-client"
|
||||
import kp "github.com/IBM/keyprotect-go-client"
|
||||
|
||||
// Use your IAM API Key and your KeyProtect Service Instance GUID/UUID to create a ClientConfig
|
||||
cc := kp.ClientConfig{
|
||||
@ -213,4 +213,57 @@ if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
fmt.Println(keys)
|
||||
```
|
||||
```
|
||||
|
||||
### Fetching List Key In Sorted Ascending Order Based On Paramaeters.
|
||||
|
||||
```go
|
||||
srtStr, _ := kp.GetKeySortStr(kp.WithCreationDate(), kp.WithImported())
|
||||
|
||||
listKeysOptions := &kp.ListKeysOptions{
|
||||
Sort:srtStr,
|
||||
}
|
||||
|
||||
keys, err := client.ListKeys(ctx, listKeysOptions)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
fmt.Println(keys)
|
||||
```
|
||||
|
||||
### Fetching List Key In Sorted Descending Order Based On Paramaeters.
|
||||
|
||||
```go
|
||||
srtStr, _ := GetKeySortStr(WithCreationDateDesc(), WithImportedDesc())
|
||||
|
||||
listKeysOptions := &ListKeysOptions{
|
||||
Sort: srtStr,
|
||||
}
|
||||
|
||||
keys, err := client.ListKeys(ctx, listKeysOptions)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
fmt.Println(keys)
|
||||
```
|
||||
|
||||
For more information about KeySearch visit: https://cloud.ibm.com/apidocs/key-protect#kp-get-key-search-api
|
||||
|
||||
### Using Search functionality in list Keys API
|
||||
|
||||
```go
|
||||
|
||||
searchStr := "foobar"
|
||||
srcStr2, _ := kp.GetKeySearchQuery(&searchStr, kp.ApplyNot(), kp.AddAliasScope())
|
||||
|
||||
listKeysOptions := &kp.ListKeysOptions{
|
||||
Search: srcStr2,
|
||||
}
|
||||
|
||||
keys, err := client.ListKeys(ctx, listKeysOptions)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
fmt.Println(keys)
|
||||
|
||||
```
|
||||
|
50
vendor/github.com/IBM/keyprotect-go-client/keys.go
generated
vendored
50
vendor/github.com/IBM/keyprotect-go-client/keys.go
generated
vendored
@ -21,7 +21,6 @@ import (
|
||||
"log"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -286,55 +285,6 @@ func (c *Client) GetKeys(ctx context.Context, limit int, offset int) (*Keys, err
|
||||
return &keys, nil
|
||||
}
|
||||
|
||||
//ListKeysOptions struct to add the query parameters for the List Keys function
|
||||
type ListKeysOptions struct {
|
||||
Extractable *bool
|
||||
Limit *uint32
|
||||
Offset *uint32
|
||||
State []KeyState
|
||||
}
|
||||
|
||||
// ListKeys retrieves a list of keys that are stored in your Key Protect service instance.
|
||||
// https://cloud.ibm.com/apidocs/key-protect#getkeys
|
||||
func (c *Client) ListKeys(ctx context.Context, listKeysOptions *ListKeysOptions) (*Keys, error) {
|
||||
|
||||
req, err := c.newRequest("GET", "keys", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// extracting the query parameters and encoding the same in the request url
|
||||
if listKeysOptions != nil {
|
||||
values := req.URL.Query()
|
||||
if listKeysOptions.Limit != nil {
|
||||
values.Set("limit", fmt.Sprint(*listKeysOptions.Limit))
|
||||
}
|
||||
if listKeysOptions.Offset != nil {
|
||||
values.Set("offset", fmt.Sprint(*listKeysOptions.Offset))
|
||||
}
|
||||
if listKeysOptions.State != nil {
|
||||
var states []string
|
||||
for _, i := range listKeysOptions.State {
|
||||
states = append(states, strconv.Itoa(int(i)))
|
||||
}
|
||||
|
||||
values.Set("state", strings.Join(states, ","))
|
||||
}
|
||||
if listKeysOptions.Extractable != nil {
|
||||
values.Set("extractable", fmt.Sprint(*listKeysOptions.Extractable))
|
||||
}
|
||||
req.URL.RawQuery = values.Encode()
|
||||
}
|
||||
|
||||
keys := Keys{}
|
||||
_, err = c.do(ctx, req, &keys)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &keys, nil
|
||||
}
|
||||
|
||||
// GetKey retrieves a key by ID or alias name.
|
||||
// For more information on Key Alias please refer to the link below
|
||||
// https://cloud.ibm.com/docs/key-protect?topic=key-protect-retrieve-key
|
||||
|
213
vendor/github.com/IBM/keyprotect-go-client/listkeys.go
generated
vendored
Normal file
213
vendor/github.com/IBM/keyprotect-go-client/listkeys.go
generated
vendored
Normal file
@ -0,0 +1,213 @@
|
||||
// Copyright 2019 IBM Corp.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// keyprotect-go-client is a Go client library for interacting with the IBM KeyProtect service.
|
||||
package kp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//ListKeysOptions struct to add the query parameters for the List Keys function
|
||||
type ListKeysOptions struct {
|
||||
Extractable *bool
|
||||
Limit *uint32
|
||||
Offset *uint32
|
||||
State []KeyState
|
||||
Sort *string
|
||||
Search *string
|
||||
}
|
||||
|
||||
// ListKeys retrieves a list of keys that are stored in your Key Protect service instance.
|
||||
// https://cloud.ibm.com/apidocs/key-protect#getkeys
|
||||
func (c *Client) ListKeys(ctx context.Context, listKeysOptions *ListKeysOptions) (*Keys, error) {
|
||||
|
||||
req, err := c.newRequest("GET", "keys", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// extracting the query parameters and encoding the same in the request url
|
||||
if listKeysOptions != nil {
|
||||
values := req.URL.Query()
|
||||
if listKeysOptions.Limit != nil {
|
||||
values.Set("limit", fmt.Sprint(*listKeysOptions.Limit))
|
||||
}
|
||||
if listKeysOptions.Offset != nil {
|
||||
values.Set("offset", fmt.Sprint(*listKeysOptions.Offset))
|
||||
}
|
||||
if listKeysOptions.State != nil {
|
||||
var states []string
|
||||
for _, i := range listKeysOptions.State {
|
||||
states = append(states, strconv.Itoa(int(i)))
|
||||
}
|
||||
|
||||
values.Set("state", strings.Join(states, ","))
|
||||
}
|
||||
if listKeysOptions.Extractable != nil {
|
||||
values.Set("extractable", fmt.Sprint(*listKeysOptions.Extractable))
|
||||
}
|
||||
if listKeysOptions.Search != nil {
|
||||
values.Set("search", fmt.Sprint(*listKeysOptions.Search, ","))
|
||||
}
|
||||
if listKeysOptions.Sort != nil {
|
||||
values.Set("sort", fmt.Sprint(*listKeysOptions.Sort))
|
||||
}
|
||||
req.URL.RawQuery = values.Encode()
|
||||
}
|
||||
|
||||
keys := Keys{}
|
||||
_, err = c.do(ctx, req, &keys)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &keys, nil
|
||||
}
|
||||
|
||||
type SortByOpts func(s *string)
|
||||
|
||||
// sort related funcs
|
||||
func GetKeySortStr(opts ...SortByOpts) *string {
|
||||
sortStr := ""
|
||||
for _, opt := range opts {
|
||||
opt(&sortStr)
|
||||
}
|
||||
return &sortStr
|
||||
}
|
||||
|
||||
func buildSortOpts(val string) SortByOpts {
|
||||
return func(s *string) {
|
||||
*s += "," + val
|
||||
// remove the extra comma appended in the begining of the string
|
||||
*s = strings.TrimLeft(*s, ",")
|
||||
}
|
||||
}
|
||||
|
||||
// sort by id
|
||||
func WithID() SortByOpts {
|
||||
return buildSortOpts("id")
|
||||
}
|
||||
func WithIDDesc() SortByOpts {
|
||||
return buildSortOpts("-id")
|
||||
}
|
||||
|
||||
// sort by creation date
|
||||
func WithCreationDate() SortByOpts {
|
||||
return buildSortOpts("creationDate")
|
||||
}
|
||||
|
||||
func WithCreationDateDesc() SortByOpts {
|
||||
return buildSortOpts("-creationDate")
|
||||
}
|
||||
|
||||
// sort by deletionDate
|
||||
func WithDeletionDate() SortByOpts {
|
||||
return buildSortOpts("deletionDate")
|
||||
}
|
||||
|
||||
func WithDeletionDateDesc() SortByOpts {
|
||||
return buildSortOpts("-deletionDate")
|
||||
}
|
||||
|
||||
// sort by expirationDate
|
||||
func WithExpirationDate() SortByOpts {
|
||||
return buildSortOpts("expirationDate")
|
||||
}
|
||||
|
||||
func WithExpirationDateDesc() SortByOpts {
|
||||
return buildSortOpts("-expirationDate")
|
||||
}
|
||||
|
||||
// sort by extractable
|
||||
func WithExtractable() SortByOpts {
|
||||
return buildSortOpts("extractable")
|
||||
}
|
||||
|
||||
func WithExtractableDesc() SortByOpts {
|
||||
return buildSortOpts("-extractable")
|
||||
}
|
||||
|
||||
// sort by imported
|
||||
func WithImported() SortByOpts {
|
||||
return buildSortOpts("imported")
|
||||
}
|
||||
|
||||
func WithImportedDesc() SortByOpts {
|
||||
return buildSortOpts("-imported")
|
||||
}
|
||||
|
||||
// sort by lastRotateDate
|
||||
func WithLastRotateDate() SortByOpts {
|
||||
return buildSortOpts("lastRotateDate")
|
||||
}
|
||||
|
||||
func WithLastRotateDateDesc() SortByOpts {
|
||||
return buildSortOpts("-lastRotateDate")
|
||||
}
|
||||
|
||||
// sort by lastUpdateDate
|
||||
func WithLastUpdateDate() SortByOpts {
|
||||
return buildSortOpts("lastUpdateDate")
|
||||
}
|
||||
|
||||
func WithLastUpdateDateDesc() SortByOpts {
|
||||
return buildSortOpts("-lastUpdateDate")
|
||||
}
|
||||
|
||||
// sort by state
|
||||
func WithState() SortByOpts {
|
||||
return buildSortOpts("state")
|
||||
}
|
||||
|
||||
func WithStateDesc() SortByOpts {
|
||||
return buildSortOpts("-state")
|
||||
}
|
||||
|
||||
type SearchOpts func(s *string)
|
||||
|
||||
func GetKeySearchQuery(searchStr *string, opts ...SearchOpts) (*string, error) {
|
||||
for _, opt := range opts {
|
||||
opt(searchStr)
|
||||
}
|
||||
return searchStr, nil
|
||||
}
|
||||
|
||||
func buildSearcOpts(val string) SearchOpts {
|
||||
return func(s *string) {
|
||||
*s = val + ":" + *s
|
||||
}
|
||||
}
|
||||
|
||||
func WithExactMatch() SearchOpts {
|
||||
return buildSearcOpts("exact")
|
||||
}
|
||||
|
||||
func AddEscape() SearchOpts {
|
||||
return buildSearcOpts("escape")
|
||||
}
|
||||
|
||||
func ApplyNot() SearchOpts {
|
||||
return buildSearcOpts("not")
|
||||
}
|
||||
|
||||
func AddAliasScope() SearchOpts {
|
||||
return buildSearcOpts("alias")
|
||||
}
|
||||
|
||||
func AddKeyNameScope() SearchOpts {
|
||||
return buildSearcOpts("name")
|
||||
}
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -1,4 +1,4 @@
|
||||
# github.com/IBM/keyprotect-go-client v0.8.0
|
||||
# github.com/IBM/keyprotect-go-client v0.8.1
|
||||
## explicit; go 1.15
|
||||
github.com/IBM/keyprotect-go-client
|
||||
github.com/IBM/keyprotect-go-client/iam
|
||||
|
Loading…
Reference in New Issue
Block a user