Sha256: 1a0ba21dc395e1c35778001707de18196eef57ca883d5fcb2db095627696419f

Contents?: true

Size: 1.22 KB

Versions: 111

Compression:

Stored size: 1.22 KB

Contents

require "chef/chef_fs/file_system/chef_server/rest_list_entry"
require "chef/chef_fs/data_handler/policy_data_handler"

class Chef
  module ChefFS
    module FileSystem
      module ChefServer
        # /policies/NAME-REVISION.json
        # Represents the actual data at /organizations/ORG/policies/NAME/revisions/REVISION
        class PolicyRevisionEntry < RestListEntry

          # /policies/foo-1.0.0.json -> /policies/foo/revisions/1.0.0
          def api_path(options = {})
            "#{parent.api_path}/#{policy_name}/revisions/#{revision_id}"
          end

          def display_path
            "/policies/#{policy_name}-#{revision_id}.json"
          end

          def write(file_contents)
            raise OperationNotAllowedError.new(:write, self, nil, "cannot be updated: policy revisions are immutable once uploaded. If you want to change the policy, create a new revision with your changes")
          end

          def policy_name
            policy_name, revision_id = data_handler.name_and_revision(name)
            policy_name
          end

          def revision_id
            policy_name, revision_id = data_handler.name_and_revision(name)
            revision_id
          end
        end
      end
    end
  end
end

Version data entries

111 entries across 111 versions & 1 rubygems

Version Path
chef-12.21.12-universal-mingw32 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-12.21.12 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-13.4.24 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-13.4.19-universal-mingw32 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-13.4.19 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-12.21.10 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-12.21.10-universal-mingw32 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-13.3.42-universal-mingw32 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-13.3.42 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-12.21.4 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-12.21.4-universal-mingw32 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-13.2.20-universal-mingw32 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-13.2.20 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-12.21.1-universal-mingw32 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-12.21.1 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-13.1.31-universal-mingw32 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-13.1.31 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-12.20.3 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-12.20.3-universal-mingw32 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
chef-13.0.118-universal-mingw32 lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb