2021-08-31 13:36:49 +00:00
|
|
|
/*
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2021-08-18 13:40:57 +00:00
|
|
|
package fake
|
|
|
|
|
|
|
|
import (
|
2023-04-16 12:12:30 +00:00
|
|
|
"context"
|
|
|
|
|
|
|
|
kmssdk "github.com/alibabacloud-go/kms-20160120/v3/client"
|
2021-08-18 13:40:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type AlibabaMockClient struct {
|
2023-04-16 12:12:30 +00:00
|
|
|
getSecretValue func(request *kmssdk.GetSecretValueRequest) (response *kmssdk.GetSecretValueResponseBody, err error)
|
2021-08-18 13:40:57 +00:00
|
|
|
}
|
|
|
|
|
2023-04-16 12:12:30 +00:00
|
|
|
func (mc *AlibabaMockClient) GetSecretValue(context.Context, *kmssdk.GetSecretValueRequest) (result *kmssdk.GetSecretValueResponseBody, err error) {
|
2021-08-18 13:40:57 +00:00
|
|
|
return mc.getSecretValue(&kmssdk.GetSecretValueRequest{})
|
|
|
|
}
|
|
|
|
|
2023-05-12 08:11:33 +00:00
|
|
|
func (mc *AlibabaMockClient) WithValue(_ *kmssdk.GetSecretValueRequest, val *kmssdk.GetSecretValueResponseBody, err error) {
|
2021-08-30 19:28:32 +00:00
|
|
|
if mc != nil {
|
2023-04-16 12:12:30 +00:00
|
|
|
mc.getSecretValue = func(paramIn *kmssdk.GetSecretValueRequest) (*kmssdk.GetSecretValueResponseBody, error) {
|
2021-08-30 19:16:20 +00:00
|
|
|
return val, err
|
2021-08-18 13:40:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-04-16 12:12:30 +00:00
|
|
|
|
|
|
|
func (mc *AlibabaMockClient) Endpoint() string {
|
|
|
|
return ""
|
|
|
|
}
|