Class: Puppet::Provider::Auth0ResourceServer::Auth0ResourceServer

Inherits:
ResourceApi::SimpleProvider
  • Object
show all
Defined in:
lib/puppet/provider/auth0_resource_server/auth0_resource_server.rb

Overview

Implementation for the auth0_resource_server type using the Resource API.

Instance Method Summary collapse

Instance Method Details

#create(context, identifier, should) ⇒ Object



22
23
24
25
26
27
# File 'lib/puppet/provider/auth0_resource_server/auth0_resource_server.rb', line 22

def create(context, identifier, should)
  context.notice("Creating '#{identifier}' with #{should.inspect}")
  data = transform_should(should)
  result = context.device.create_resource_server(identifier,data)
  Puppet.debug("Got response: #{result.inspect}")
end

#delete(context, identifier) ⇒ Object



37
38
39
40
41
42
# File 'lib/puppet/provider/auth0_resource_server/auth0_resource_server.rb', line 37

def delete(context, identifier)
  context.notice("Deleting '#{identifier}'")
  id = CGI.escape(identifier)
  result = context.device.delete_resource_server(id)
  Puppet.debug("Got response: #{result.inspect}")
end

#get(context) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/puppet/provider/auth0_resource_server/auth0_resource_server.rb', line 6

def get(context)
  apis(context).map do |data|
    {
      ensure: 'present',
      display_name: data['name'],
      identifier: data['identifier'],
      scopes: scopes_to_hash(data['scopes'] || []),
      signing_alg: data['signing_alg'],
      signing_secret: data['signing_secret'],
      allow_offline_access: data['allow_offline_access'],
      token_lifetime: data['token_lifetime'],
      skip_consent: data['skip_consent_for_verifiable_first_party_clients'],
    }.compact
  end
end

#update(context, identifier, should) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/puppet/provider/auth0_resource_server/auth0_resource_server.rb', line 29

def update(context, identifier, should)
  context.notice("Updating '#{identifier}' with #{should.inspect}")
  data = transform_should(should)
  id = CGI.escape(identifier)
  result = context.device.patch_resource_server(id,data)
  Puppet.debug("Got response: #{result.inspect}")
end