Method: Metatron::Templates::VolumeSnapshotContent#formatted_volume_snapshot_ref

Defined in:
lib/metatron/templates/volume_snapshot_content.rb

#formatted_volume_snapshot_refObject



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/metatron/templates/volume_snapshot_content.rb', line 50

def formatted_volume_snapshot_ref
  return {} unless volume_snapshot_ref

  if volume_snapshot_ref.is_a?(Hash)
    { volumeSnapshotRef: }
  elsif volume_snapshot_ref.is_a?(VolumeSnapshot)
    {
      volumeSnapshotRef: {
        name: volume_snapshot_ref.name,
        namespace: volume_snapshot_ref.namespace
      }.compact
    }
  else
    raise ArgumentError,
          "Invalid volume_snapshot_ref type: #{volume_snapshot_ref.class}."
  end
end