def create_from_file(file_path)
      client_setup
      resource = OneviewSDK::Resource.from_file(@client, file_path)
      fail_nice 'Failed to determine resource type!' if resource.class == OneviewSDK::Resource
      existing_resource = resource.class.new(@client, resource.data)
      resource.data.delete('uri')
      if existing_resource.retrieve!
        if options['if_missing']
          puts "Skipped: #{resource.class.name.split('::').last} '#{resource[:name]}' already exists.\n#{existing_resource[:uri]}"
          return
        end
        if existing_resource.like?(resource.data)
          puts "Skipped: #{resource.class.name.split('::').last} '#{resource[:name]}' is up to date.\n#{existing_resource[:uri]}"
          return
        end
        begin
          existing_resource.update(resource.data)
          puts "Updated Successfully!\n#{existing_resource[:uri]}"
        rescue StandardError => e
          fail_nice "Failed to update #{resource.class.name.split('::').last} '#{resource[:name]}': #{e}"
        end
      else
        begin
          resource.create
          puts "Created Successfully!\n#{resource[:uri]}"
        rescue StandardError => e
          fail_nice "Failed to create #{resource.class.name.split('::').last} '#{resource[:name]}': #{e}"
        end
      end
    rescue IncompleteResource => e
      fail_nice "Failed to create #{resource.class.name.split('::').last} '#{resource[:name]}': #{e}"
    rescue SystemCallError => e # File open errors
      fail_nice e
    end
def create_from_file(file_path)
      client_setup
      resource = OneviewSDK::Resource.from_file(@client, file_path)
      fail_nice 'Failed to determine resource type!' if resource.class == OneviewSDK::Resource
      existing_resource = resource.class.new(@client, resource.data)
      resource.data.delete('uri')
      if existing_resource.retrieve!
        if options['if_missing']
          puts "Skipped: #{resource.class.name.split('::').last} '#{resource[:name]}' already exists.\n#{existing_resource[:uri]}"
          return
        end
        if existing_resource.like?(resource.data)
          puts "Skipped: #{resource.class.name.split('::').last} '#{resource[:name]}' is up to date.\n#{existing_resource[:uri]}"
          return
        end
        begin
          existing_resource.update(resource.data)
          puts "Updated Successfully!\n#{existing_resource[:uri]}"
        rescue StandardError => e
          fail_nice "Failed to update #{resource.class.name.split('::').last} '#{resource[:name]}': #{e}"
        end
      else
        begin
          resource.create
          puts "Created Successfully!\n#{resource[:uri]}"
        rescue StandardError => e
          fail_nice "Failed to create #{resource.class.name.split('::').last} '#{resource[:name]}': #{e}"
        end
      end
    rescue IncompleteResource => e
      fail_nice "Failed to create #{resource.class.name.split('::').last} '#{resource[:name]}': #{e}"
    rescue SystemCallError => e # File open errors
      fail_nice e
    end
Create/Update resource defined in file