forked from cloudfoundry/cloud_controller_ng
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack_presenter.rb
More file actions
42 lines (37 loc) · 1.03 KB
/
stack_presenter.rb
File metadata and controls
42 lines (37 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
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
40
41
42
require 'presenters/mixins/metadata_presentation_helpers'
require 'presenters/v3/base_presenter'
module VCAP::CloudController::Presenters::V3
class StackPresenter < BasePresenter
include VCAP::CloudController::Presenters::Mixins::MetadataPresentationHelpers
def to_hash
{
guid: stack.guid,
created_at: stack.created_at,
updated_at: stack.updated_at,
name: stack.name,
description: stack.description,
state: stack.state,
state_reason: stack.state_reason,
run_rootfs_image: stack.run_rootfs_image,
build_rootfs_image: stack.build_rootfs_image,
default: stack.default?,
metadata: {
labels: hashified_labels(stack.labels),
annotations: hashified_annotations(stack.annotations)
},
links: build_links
}
end
private
def stack
@resource
end
def build_links
{
self: {
href: url_builder.build_url(path: "/v3/stacks/#{stack.guid}")
}
}
end
end
end