Class: ManagedServiceInstanceHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/cf/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
50
# File 'lib/cf/cli/service/service_instance_helper.rb', line 47

def initialize(service_instance)
  @instance = service_instance
  @service_helper = ServiceHelper.new(service_instance.service_plan.service)
end

Instance Method Details

#matches(opts = {}) ⇒ Object


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

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


72
73
74
# File 'lib/cf/cli/service/service_instance_helper.rb', line 72

def name
  @instance.name
end

#plan_nameObject


64
65
66
# File 'lib/cf/cli/service/service_instance_helper.rb', line 64

def plan_name
  @instance.service_plan.name
end

#service_bindingsObject


68
69
70
# File 'lib/cf/cli/service/service_instance_helper.rb', line 68

def service_bindings
  @instance.service_bindings
end

#service_labelObject


52
53
54
# File 'lib/cf/cli/service/service_instance_helper.rb', line 52

def service_label
  @service_helper.label
end

#service_providerObject


56
57
58
# File 'lib/cf/cli/service/service_instance_helper.rb', line 56

def service_provider
  @service_helper.provider
end

#versionObject


60
61
62
# File 'lib/cf/cli/service/service_instance_helper.rb', line 60

def version
  @service_helper.version
end