| 1 | // |
| 2 | // Copyright 2021 The Sigstore Authors. |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | |
| 16 | // Package options defines options for KMS clients |
| 17 | package optionsscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/ |
| 18 | |
| 19 | import ( |
| 20 | "contextscip-go gomod github.com/golang/go/src go1.25.0 context/" |
| 21 | ) |
| 22 | |
| 23 | // RequestContext implements the functional option pattern for including a context during RPC |
| 24 | type RequestContextscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestContext# struct { |
| 25 | NoOpOptionImplscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestContext#NoOpOptionImpl. |
| 26 | ctxscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestContext#ctx. contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context# |
| 27 | } |
| 28 | |
| 29 | // ApplyContext sets the specified context as the functional option |
| 30 | func (r RequestContextscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestContext#) ApplyContextscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestContext#ApplyContext().(ctx *contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#) { |
| 31 | *ctx = r.ctxscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestContext#ctx. |
| 32 | } |
| 33 | |
| 34 | // WithContext specifies that the given context should be used in RPC to external services |
| 35 | func WithContextscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/WithContext().(ctx contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Contextscip-go gomod github.com/golang/go/src go1.25.0 context/Context#) RequestContextscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestContext# { |
| 36 | return RequestContextscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestContext#{ctxscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestContext#ctx.: ctx} |
| 37 | } |