mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-10-19 05:39:51 +00:00
47b202554e
This commit adds the Azure SDK for Azure key vault KMS integration to the Ceph CSI driver. Signed-off-by: Praveen M <m.praveen@ibm.com>
36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
//go:build go1.16
|
|
// +build go1.16
|
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
package runtime
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared"
|
|
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
|
)
|
|
|
|
// includeResponsePolicy creates a policy that retrieves the raw HTTP response upon request
|
|
func includeResponsePolicy(req *policy.Request) (*http.Response, error) {
|
|
resp, err := req.Next()
|
|
if resp == nil {
|
|
return resp, err
|
|
}
|
|
if httpOutRaw := req.Raw().Context().Value(shared.CtxWithCaptureResponse{}); httpOutRaw != nil {
|
|
httpOut := httpOutRaw.(**http.Response)
|
|
*httpOut = resp
|
|
}
|
|
return resp, err
|
|
}
|
|
|
|
// WithCaptureResponse applies the HTTP response retrieval annotation to the parent context.
|
|
// The resp parameter will contain the HTTP response after the request has completed.
|
|
// Deprecated: use [policy.WithCaptureResponse] instead.
|
|
func WithCaptureResponse(parent context.Context, resp **http.Response) context.Context {
|
|
return policy.WithCaptureResponse(parent, resp)
|
|
}
|