NewInputPolicy constructs and returns a new instance of Policy that doesn't perform strict checks on the consistency of the policy, but can evaluate based on provided effectiveTime The policyRef parameter is expected to be either a YAML/JSON-encoded instance of EnterpriseContractPolicySpec, or refe
(ctx context.Context, policyRef string, effectiveTime string)
| 220 | // |
| 221 | // If policyRef is blank, an empty EnterpriseContractPolicySpec is used. |
| 222 | func NewInputPolicy(ctx context.Context, policyRef string, effectiveTime string) (Policy, error) { |
| 223 | if efn, err := parseEffectiveTime(effectiveTime); err == nil { |
| 224 | p := policy{ |
| 225 | choosenTime: effectiveTime, |
| 226 | checkOpts: &cosign.CheckOpts{}, |
| 227 | } |
| 228 | if err := p.loadPolicy(ctx, policyRef); err != nil { |
| 229 | return nil, err |
| 230 | } |
| 231 | p.effectiveTime = efn |
| 232 | return &p, nil |
| 233 | } else { |
| 234 | return nil, err |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | // NewPolicy construct and return a new instance of Policy. |
| 239 | // |