Class: Cerbos::Hub::Stores::Output::ReplaceFiles

Inherits:
Object
  • Object
show all
Defined in:
lib/cerbos/hub/stores/output/replace_files.rb

Overview

The outcome of replacing files in a store.

Instance Attribute Summary collapse

Instance Attribute Details

#changedBoolean (readonly)

Whether any changes were made to the store contents.

This can only be false if allow_unchanged was true.

Returns:

  • (Boolean)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cerbos/hub/stores/output/replace_files.rb', line 10

ReplaceFiles = Cerbos::Output.new_class(:new_store_version, :ignored_files, :changed) do
  # @!attribute [r] new_store_version
  #   The new version of the store after the files were replaced.
  #
  #   If `allow_unchanged` was `true`, this will be the existing store version if no changes were made.
  #
  #   @return [Integer]

  # @!attribute [r] ignored_files
  #   Paths of files that were provided in the request but were ignored.
  #
  #   Files with unexpected paths, for example hidden files, will be ignored.
  #
  #   @return [Array<String>]

  # @!attribute [r] changed
  #   Whether any changes were made to the store contents.
  #
  #   This can only be `false` if `allow_unchanged` was `true`.
  #
  #   @return [Boolean]

  def self.from_protobuf(replace_files)
    new(
      new_store_version: replace_files.new_store_version,
      ignored_files: replace_files.ignored_files,
      changed: true
    )
  end
end

#ignored_filesArray<String> (readonly)

Paths of files that were provided in the request but were ignored.

Files with unexpected paths, for example hidden files, will be ignored.

Returns:

  • (Array<String>)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cerbos/hub/stores/output/replace_files.rb', line 10

ReplaceFiles = Cerbos::Output.new_class(:new_store_version, :ignored_files, :changed) do
  # @!attribute [r] new_store_version
  #   The new version of the store after the files were replaced.
  #
  #   If `allow_unchanged` was `true`, this will be the existing store version if no changes were made.
  #
  #   @return [Integer]

  # @!attribute [r] ignored_files
  #   Paths of files that were provided in the request but were ignored.
  #
  #   Files with unexpected paths, for example hidden files, will be ignored.
  #
  #   @return [Array<String>]

  # @!attribute [r] changed
  #   Whether any changes were made to the store contents.
  #
  #   This can only be `false` if `allow_unchanged` was `true`.
  #
  #   @return [Boolean]

  def self.from_protobuf(replace_files)
    new(
      new_store_version: replace_files.new_store_version,
      ignored_files: replace_files.ignored_files,
      changed: true
    )
  end
end

#new_store_versionInteger (readonly)

The new version of the store after the files were replaced.

If allow_unchanged was true, this will be the existing store version if no changes were made.

Returns:

  • (Integer)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cerbos/hub/stores/output/replace_files.rb', line 10

ReplaceFiles = Cerbos::Output.new_class(:new_store_version, :ignored_files, :changed) do
  # @!attribute [r] new_store_version
  #   The new version of the store after the files were replaced.
  #
  #   If `allow_unchanged` was `true`, this will be the existing store version if no changes were made.
  #
  #   @return [Integer]

  # @!attribute [r] ignored_files
  #   Paths of files that were provided in the request but were ignored.
  #
  #   Files with unexpected paths, for example hidden files, will be ignored.
  #
  #   @return [Array<String>]

  # @!attribute [r] changed
  #   Whether any changes were made to the store contents.
  #
  #   This can only be `false` if `allow_unchanged` was `true`.
  #
  #   @return [Boolean]

  def self.from_protobuf(replace_files)
    new(
      new_store_version: replace_files.new_store_version,
      ignored_files: replace_files.ignored_files,
      changed: true
    )
  end
end