Skip to content

Commit

Permalink
Allow Service to create a ServiceSizingPolicy
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelaossa committed Sep 6, 2024
1 parent 5f70f29 commit 827f82c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/aptible/api/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ class Service < Resource
field :instance_class
field :created_at, type: Time
field :updated_at, type: Time

def create_policy!(params)
params = { token: token }.merge(params)

# First create a link object so we know where to go
link = HyperResource::Link.new(
self,
'href' => "#{self.href}/service_sizing_policies"
)

# Now create the policy
link.create(
self.class.normalize_params(params)
)
end
end
end
end

0 comments on commit 827f82c

Please sign in to comment.