func updateSecret(ours *Secret, theirs *api.Secret) {
	if theirs.RequestID != "" {
		ours.RequestID = theirs.RequestID
	}

	if theirs.LeaseID != "" {
		ours.LeaseID = theirs.LeaseID
	}

	if theirs.LeaseDuration != 0 {
		ours.LeaseDuration = theirs.LeaseDuration
	}

	if theirs.Renewable {
		ours.Renewable = theirs.Renewable
	}

	if len(theirs.Data) != 0 {
		ours.Data = theirs.Data
	}

	if len(theirs.Warnings) != 0 {
		ours.Warnings = theirs.Warnings
	}

	if theirs.Auth != nil {
		if ours.Auth == nil {
			ours.Auth = &SecretAuth{}
		}

		if theirs.Auth.ClientToken != "" {
			ours.Auth.ClientToken = theirs.Auth.ClientToken
		}

		if theirs.Auth.Accessor != "" {
			ours.Auth.Accessor = theirs.Auth.Accessor
		}

		if len(theirs.Auth.Policies) != 0 {
			ours.Auth.Policies = theirs.Auth.Policies
		}

		if len(theirs.Auth.Metadata) != 0 {
			ours.Auth.Metadata = theirs.Auth.Metadata
		}

		if theirs.Auth.LeaseDuration != 0 {
			ours.Auth.LeaseDuration = theirs.Auth.LeaseDuration
		}

		if theirs.Auth.Renewable {
			ours.Auth.Renewable = theirs.Auth.Renewable
		}
	}

	if theirs.WrapInfo != nil {
		if ours.WrapInfo == nil {
			ours.WrapInfo = &SecretWrapInfo{}
		}

		if theirs.WrapInfo.Token != "" {
			ours.WrapInfo.Token = theirs.WrapInfo.Token
		}

		if theirs.WrapInfo.TTL != 0 {
			ours.WrapInfo.TTL = theirs.WrapInfo.TTL
		}

		if !theirs.WrapInfo.CreationTime.IsZero() {
			ours.WrapInfo.CreationTime = theirs.WrapInfo.CreationTime
		}

		if theirs.WrapInfo.WrappedAccessor != "" {
			ours.WrapInfo.WrappedAccessor = theirs.WrapInfo.WrappedAccessor
		}
	}
}
func updateSecret(ours *Secret, theirs *api.Secret) {
	if theirs.RequestID != "" {
		ours.RequestID = theirs.RequestID
	}

	if theirs.LeaseID != "" {
		ours.LeaseID = theirs.LeaseID
	}

	if theirs.LeaseDuration != 0 {
		ours.LeaseDuration = theirs.LeaseDuration
	}

	if theirs.Renewable {
		ours.Renewable = theirs.Renewable
	}

	if len(theirs.Data) != 0 {
		ours.Data = theirs.Data
	}

	if len(theirs.Warnings) != 0 {
		ours.Warnings = theirs.Warnings
	}

	if theirs.Auth != nil {
		if ours.Auth == nil {
			ours.Auth = &SecretAuth{}
		}

		if theirs.Auth.ClientToken != "" {
			ours.Auth.ClientToken = theirs.Auth.ClientToken
		}

		if theirs.Auth.Accessor != "" {
			ours.Auth.Accessor = theirs.Auth.Accessor
		}

		if len(theirs.Auth.Policies) != 0 {
			ours.Auth.Policies = theirs.Auth.Policies
		}

		if len(theirs.Auth.Metadata) != 0 {
			ours.Auth.Metadata = theirs.Auth.Metadata
		}

		if theirs.Auth.LeaseDuration != 0 {
			ours.Auth.LeaseDuration = theirs.Auth.LeaseDuration
		}

		if theirs.Auth.Renewable {
			ours.Auth.Renewable = theirs.Auth.Renewable
		}
	}

	if theirs.WrapInfo != nil {
		if ours.WrapInfo == nil {
			ours.WrapInfo = &SecretWrapInfo{}
		}

		if theirs.WrapInfo.Token != "" {
			ours.WrapInfo.Token = theirs.WrapInfo.Token
		}

		if theirs.WrapInfo.TTL != 0 {
			ours.WrapInfo.TTL = theirs.WrapInfo.TTL
		}

		if !theirs.WrapInfo.CreationTime.IsZero() {
			ours.WrapInfo.CreationTime = theirs.WrapInfo.CreationTime
		}

		if theirs.WrapInfo.WrappedAccessor != "" {
			ours.WrapInfo.WrappedAccessor = theirs.WrapInfo.WrappedAccessor
		}
	}
}
func updateSecret ( ours * Secret , theirs * api . Secret ) { if theirs . RequestID != " " { ours . RequestID = theirs . RequestID } if theirs . LeaseID != " " { ours . LeaseID = theirs . LeaseID } if theirs . LeaseDuration != 0 { ours . LeaseDuration = theirs . LeaseDuration } if theirs . Renewable { ours . Renewable = theirs . Renewable } if len ( theirs . Data ) != 0 { ours . Data = theirs . Data } if len ( theirs . Warnings ) != 0 { ours . Warnings = theirs . Warnings } if theirs . Auth != nil { if ours . Auth == nil { ours . Auth = & SecretAuth { } } if theirs . Auth . ClientToken != " " { ours . Auth . ClientToken = theirs . Auth . ClientToken } if theirs . Auth . Accessor != " " { ours . Auth . Accessor = theirs . Auth . Accessor } if len ( theirs . Auth . Policies ) != 0 { ours . Auth . Policies = theirs . Auth . Policies } if len ( theirs . Auth . Metadata ) != 0 { ours . Auth . Metadata = theirs . Auth . Metadata } if theirs . Auth . LeaseDuration != 0 { ours . Auth . LeaseDuration = theirs . Auth . LeaseDuration } if theirs . Auth . Renewable { ours . Auth . Renewable = theirs . Auth . Renewable } } if theirs . WrapInfo != nil { if ours . WrapInfo == nil { ours . WrapInfo = & SecretWrapInfo { } } if theirs . WrapInfo . Token != " " { ours . WrapInfo . Token = theirs . WrapInfo . Token } if theirs . WrapInfo . TTL != 0 { ours . WrapInfo . TTL = theirs . WrapInfo . TTL } if ! theirs . WrapInfo . CreationTime . IsZero ( ) { ours . WrapInfo . CreationTime = theirs . WrapInfo . CreationTime } if theirs . WrapInfo . WrappedAccessor != " " { ours . WrapInfo . WrappedAccessor = theirs . WrapInfo . WrappedAccessor } } }
// updateSecret updates our secret with the new data from the api, careful to
// not overwrite missing data. Renewals don't include the original secret, and
// we don't want to delete that data accidentally.
updateSecret updates our secret with the new data from the api careful to not overwrite missing data . Renewals don t include the original secret and we don t want to delete that data accidentally .