43 lines
828 B
Go
43 lines
828 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package structs
|
|
|
|
// WorkloadIdentity is the jobspec block which determines if and how a workload
|
|
// identity is exposed to tasks similar to the Vault block.
|
|
type WorkloadIdentity struct {
|
|
// Env injects the Workload Identity into the Task's environment if
|
|
// set.
|
|
Env bool
|
|
|
|
// File writes the Workload Identity into the Task's secrets directory
|
|
// if set.
|
|
File bool
|
|
}
|
|
|
|
func (wi *WorkloadIdentity) Copy() *WorkloadIdentity {
|
|
if wi == nil {
|
|
return nil
|
|
}
|
|
return &WorkloadIdentity{
|
|
Env: wi.Env,
|
|
File: wi.File,
|
|
}
|
|
}
|
|
|
|
func (wi *WorkloadIdentity) Equal(other *WorkloadIdentity) bool {
|
|
if wi == nil || other == nil {
|
|
return wi == other
|
|
}
|
|
|
|
if wi.Env != other.Env {
|
|
return false
|
|
}
|
|
|
|
if wi.File != other.File {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|