github.com/hernad/nomad@v1.6.112/nomad/structs/workload_id.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package structs
     5  
     6  // WorkloadIdentity is the jobspec block which determines if and how a workload
     7  // identity is exposed to tasks similar to the Vault block.
     8  type WorkloadIdentity struct {
     9  	// Env injects the Workload Identity into the Task's environment if
    10  	// set.
    11  	Env bool
    12  
    13  	// File writes the Workload Identity into the Task's secrets directory
    14  	// if set.
    15  	File bool
    16  }
    17  
    18  func (wi *WorkloadIdentity) Copy() *WorkloadIdentity {
    19  	if wi == nil {
    20  		return nil
    21  	}
    22  	return &WorkloadIdentity{
    23  		Env:  wi.Env,
    24  		File: wi.File,
    25  	}
    26  }
    27  
    28  func (wi *WorkloadIdentity) Equal(other *WorkloadIdentity) bool {
    29  	if wi == nil || other == nil {
    30  		return wi == other
    31  	}
    32  
    33  	if wi.Env != other.Env {
    34  		return false
    35  	}
    36  
    37  	if wi.File != other.File {
    38  		return false
    39  	}
    40  
    41  	return true
    42  }