Method: Puppet::HTTP::Service::FileServer#get_static_file_content

Defined in:
lib/puppet/http/service/file_server.rb

#get_static_file_content(path:, environment:, code_id:) {|String| ... } ⇒ Puppet::HTTP::Response

Submit a GET request to retrieve file content using the ‘static_file_content` API uniquely identified by (`code_id`, `environment`, `path`).

Parameters:

  • path (String)

    path to the file to retrieve data from

  • environment (String)

    the name of the environment we are operating in

  • code_id (String)

    Defines the version of the resource to return

Yields:

  • (String)

    Yields the body of the response returned

Returns:



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/puppet/http/service/file_server.rb', line 173

def get_static_file_content(path:, environment:, code_id:, &block)
  validate_path(path)

  headers = add_puppet_headers('Accept' => 'application/octet-stream')
  response = @client.get(
    with_base_url("/static_file_content#{path}"),
    headers: headers,
    params: {
      environment: environment,
      code_id: code_id,
    }
  ) do |res|
    if res.success?
      res.read_body(&block)
    end
  end

  process_response(response)

  response
end