1414-%>
1515<%= compile 'templates/license.erb' -%>
1616
17- <%= lines(autogen_notice :ruby) -%>
17+ <%= lines(autogen_notice :ruby) -%>
18+
19+ # A provider to manage <%= @api.name -%> resources.
20+ <%= lines(indent(
21+ emit_rubocop(binding, :class,
22+ ['Google', @api.prefix.upcase, object.name].join('::'),
23+ :disabled),
24+ 4)) -%>
25+ class <%= object.name -%> < Inspec .resource(1)
26+
27+ name 'google_<%= product_ns . downcase -%> _<%= object . name . downcase -%> '
28+ desc '<%= object . name -%> '
29+ supports platform: 'gcp-mm'
30+
31+ <% object . properties . reject ( &:input ) . each do |prop | -%>
32+ <%= "attr_reader :#{ prop . out_name } " -%>
33+
34+ <% end -%>
35+
36+ <%
37+ base = "'#{ object . self_link_url [ 0 ] . join } '"
38+ url = object . self_link_url [ 1 ]
39+ if url . is_a? ( Array )
40+ url = url . join ( '' )
41+ else
42+ url = url . split ( "\n " ) . join ( '' )
43+ end
44+ url = "'#{ url } '"
45+ -%>
46+ def base
47+ <%= base %>
48+ end
49+
50+ def url
51+ <%= url %>
52+ end
53+
54+ <% if object . self_link_query . nil? -%>
55+ def initialize(params)
56+ @fetched = <%= method_call ( 'fetch_resource' , [ 'params' , ( "'#{ object . kind } '" if object . kind? ) ] , 2 ) %>
57+ parse unless @fetched.nil?
58+ end
59+ <% else # object.self_link_query.nil? -%>
60+ def initialize(params)
61+ @fetched = <%= method_call('fetch_wrapped_resource', ['params', ("'#{object.kind}'" if object.kind?),
62+ "'#{ object . self_link_query . kind } '" ,
63+ "'#{ object . self_link_query . items } '" ] , 2 ) %>
64+ parse unless @fetched.nil?
65+ end
66+ <% end # object.self_link_query.nil? -%>
67+
68+ # TODO
69+ def parse end
70+
71+ def exists?
72+ !@fetched.nil?
73+ end
74+ end
0 commit comments