Class: ManagedServiceInstanceHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/jdc/cli/service/service_instance_helper.rb

Instance Method Summary collapse

Constructor Details

#initialize(service_instance) ⇒ ManagedServiceInstanceHelper

Returns a new instance of ManagedServiceInstanceHelper.



47
48
49
# File 'lib/jdc/cli/service/service_instance_helper.rb', line 47

def initialize(service_instance)
  @instance = service_instance
end

Instance Method Details

#matches(opts = {}) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/jdc/cli/service/service_instance_helper.rb', line 75

def matches(opts = {})
  service = opts[:service]
  plan = opts[:plan]
  provider = opts[:provider]
  version = opts[:version]

  if service
    return false unless File.fnmatch(service, service_label)
  end

  if plan
    return false unless File.fnmatch(plan.upcase, plan_name.upcase)
  end

  if provider
    return false unless File.fnmatch(provider, service_provider)
  end

  if version
    return false unless File.fnmatch(version, self.version)
  end

  true
end

#nameObject



71
72
73
# File 'lib/jdc/cli/service/service_instance_helper.rb', line 71

def name
  @instance.name
end

#plan_nameObject



63
64
65
# File 'lib/jdc/cli/service/service_instance_helper.rb', line 63

def plan_name
  @instance.service_plan.name
end

#service_bindingsObject



67
68
69
# File 'lib/jdc/cli/service/service_instance_helper.rb', line 67

def service_bindings
  @instance.service_bindings
end

#service_labelObject



51
52
53
# File 'lib/jdc/cli/service/service_instance_helper.rb', line 51

def service_label
  @instance.service_plan.service.label
end

#service_providerObject



55
56
57
# File 'lib/jdc/cli/service/service_instance_helper.rb', line 55

def service_provider
  @instance.service_plan.service.provider
end

#versionObject



59
60
61
# File 'lib/jdc/cli/service/service_instance_helper.rb', line 59

def version
  @instance.service_plan.service.version
end