oci-go-sdk
oci-go-sdk copied to clipboard
`UploadRequest` creates `ObjectStorageClient` when uploading request is processing.
I don't think it is good idea to create ObjectStorageClient instance while uploading.
How about return error instantly if the client is not set?
I used long time to debug this issue and I can create a pull request.
https://github.com/oracle/oci-go-sdk/blob/a172b320b82f9d45afe9a044511d4eba550d06d1/objectstorage/transfer/upload_manager_req_resp.go#L144-L157
func New() (CloudStorage, error) {
// I used `ConfigurationProviderEnvironmentVariables` to create the configuration.
conf := common.ConfigurationProviderEnvironmentVariables("oci", "")
// It passes `IsConfigurationProviderValid`.
c, err := objectstorage.NewObjectStorageClientWithConfigurationProvider(conf)
// ...
}
func (s *ociObjectStorage) Upload(objectName string, data []byte) error {
// ...
uploadManager := transfer.NewUploadManager()
req := transfer.UploadStreamRequest{
UploadRequest: transfer.UploadRequest{
NamespaceName: &namespace,
BucketName: &bname,
ObjectName: &objectName,
EnableMultipartChecksumVerification: common.Bool(true),
},
// ...
}
// I got a client error if `ObjectStorageClient` is set manually.
_, err := uploadManager.UploadStream(ctx, req)
// ...
}
@urunimi assigning this issue to the Object Storage team to take a look and suggest.