oktakit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a9909ae42a8aab1535c521ce334ab75809daf340
4
+ data.tar.gz: d961502c418a988213484c0427e080078ab1719e
5
+ SHA512:
6
+ metadata.gz: cbb1128f0b98700c17e9476b46a72c5ce4024962e773b2331d11808432623ea7722f8e082dfec04170fa65b9e6d0621992db59d4e67a678d084a75b045555af1
7
+ data.tar.gz: 8721eb00c6ea3dc40fa13c980a1b02c4d472198f65dc7b6b6016171e6a8f183fc394bd7e412bbc6c3f2a4da79084d69beb87e6b972500289dbfece6145f8a858
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .byebug_history
11
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,84 @@
1
+ # This file strictly follows the rules defined in the Ruby style guide:
2
+ # http://shopify.github.io/ruby-style-guide/
3
+
4
+ AllCops:
5
+ TargetRubyVersion: 2.1
6
+
7
+ Rails:
8
+ Enabled: false
9
+
10
+ Lint/AssignmentInCondition:
11
+ Enabled: false
12
+
13
+ Style/Documentation:
14
+ Enabled: false
15
+
16
+ Style/MultilineOperationIndentation:
17
+ Enabled: false
18
+
19
+ Style/AlignParameters:
20
+ EnforcedStyle: with_fixed_indentation
21
+
22
+ Style/FirstParameterIndentation:
23
+ EnforcedStyle: consistent
24
+
25
+ Style/TrailingCommaInLiteral:
26
+ Enabled: false
27
+
28
+ Style/SignalException:
29
+ EnforcedStyle: only_raise
30
+
31
+ Style/NumericLiterals:
32
+ Enabled: false
33
+
34
+ Style/CaseIndentation:
35
+ IndentWhenRelativeTo: end
36
+
37
+ Style/IndentHash:
38
+ EnforcedStyle: consistent
39
+
40
+ Style/WordArray:
41
+ Enabled: false
42
+
43
+ Metrics/AbcSize:
44
+ Enabled: false
45
+
46
+ Metrics/CyclomaticComplexity:
47
+ Enabled: false
48
+
49
+ Style/StringLiterals:
50
+ Enabled: false
51
+
52
+ Metrics/LineLength:
53
+ Max: 120
54
+
55
+ Metrics/ClassLength:
56
+ Enabled: false
57
+
58
+ Metrics/MethodLength:
59
+ Enabled: false
60
+
61
+ Metrics/ParameterLists:
62
+ Max: 5
63
+ CountKeywordArgs: false
64
+
65
+ Metrics/PerceivedComplexity:
66
+ Enabled: false
67
+
68
+ Lint/EndAlignment:
69
+ AlignWith: variable
70
+
71
+ Style/FrozenStringLiteralComment:
72
+ Enabled: false
73
+
74
+ Style/Alias:
75
+ EnforcedStyle: prefer_alias_method
76
+
77
+ Style/MutableConstant:
78
+ Enabled: false
79
+
80
+ Performance/Casecmp:
81
+ Enabled: false
82
+
83
+ Style/GuardClause:
84
+ Enabled: false
@@ -0,0 +1,6 @@
1
+ sudo: false
2
+ before_install: gem install bundler
3
+ rvm:
4
+ - '2.1'
5
+ - '2.2'
6
+
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+ gem 'byebug'
5
+ gem 'rubocop'
6
+ gem 'yard'
7
+
8
+ group :test do
9
+ gem 'rspec', '~> 3.2'
10
+ gem 'vcr', '~> 2.9', github: 'vcr/vcr', branch: 'master', ref: '480304be6d73803e6c4a0eb21a4ab4091da558d8'
11
+ end
12
+
13
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Shopify
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,52 @@
1
+ # oktakit
2
+
3
+ Ruby toolkit for the [Okta API](http://developer.okta.com/docs/api/getting_started/design_principles.html).
4
+
5
+ [![Build Status](https://secure.travis-ci.org/Shopify/oktakit.png)](http://travis-ci.org/Shopify/oktakit)
6
+ [![Gem Version](https://badge.fury.io/rb/oktakit.png)](http://badge.fury.io/rb/oktakit)
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'oktakit'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ ## Usage
21
+
22
+ `Oktakit` follow the same patterns as [`Octokit`](https://github.com/octokit/octokit.rb), if you are familiar with it you should feel right at home.
23
+
24
+ ```ruby
25
+ client = Oktakit.new(token: 't0k3n', organization: 'my-great-org')
26
+ response, http_status = client.list_users
27
+ ```
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ ## Testing
36
+
37
+ Testing is fairly straightforward, with the exception of the org URL.
38
+ To anonymize the VCR data, first setup a real token and endpoint for Okta, such as `myokta.okta.com`
39
+
40
+ - In `spec_helper.rb`, set the org to `my-okta` (or whatever your organization is).
41
+ - Set the `OKTA_TEST_TOKEN` environment variable (this should be real). Don't worry, it is automatically removed.
42
+ - Before committing, change `my-okta` to `okta-test` in `spec_helper.rb` and any VCR Cassettes.
43
+
44
+ The [API Test Client](http://developer.okta.com/docs/api/getting_started/api_test_client) provided by Okta is also really helpful.
45
+
46
+ ## Contributing
47
+
48
+ 1. Fork it ( https://github.com/shopify/oktakit/fork )
49
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
50
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
51
+ 4. Push to the branch (`git push origin my-new-feature`)
52
+ 5. Create a new Pull Request
@@ -0,0 +1,19 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ require 'rspec/core/rake_task'
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ require 'rubocop/rake_task'
7
+ RuboCop::RakeTask.new
8
+
9
+ task test: :spec
10
+ task default: [:spec, :rubocop]
11
+
12
+ namespace :doc do
13
+ require 'yard'
14
+ YARD::Rake::YardocTask.new do |task|
15
+ task.files = %w(LICENSE.md lib/**/*.rb)
16
+ task.options = %w(--output-dir doc/yard --markup markdown)
17
+ end
18
+ task default: :yard
19
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'oktakit'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/dev.yml ADDED
@@ -0,0 +1,11 @@
1
+ # This is an internal file for Shopify. Please ignore
2
+
3
+ name: oktakit
4
+
5
+ up:
6
+ - ruby: 2.3.1
7
+ - bundler
8
+
9
+ commands:
10
+ test: bundle exec rspec
11
+ console: bin/console
@@ -0,0 +1,8 @@
1
+ require 'oktakit/version'
2
+ require 'oktakit/client'
3
+
4
+ module Oktakit
5
+ def self.new(*args)
6
+ Client.new(*args)
7
+ end
8
+ end
@@ -0,0 +1,165 @@
1
+ require 'sawyer'
2
+ require 'oktakit/response/raise_error'
3
+ require 'oktakit/client/admin_roles'
4
+ require 'oktakit/client/apps'
5
+ require 'oktakit/client/events'
6
+ require 'oktakit/client/factors'
7
+ require 'oktakit/client/groups'
8
+ require 'oktakit/client/identity_providers'
9
+ require 'oktakit/client/schemas'
10
+ require 'oktakit/client/templates'
11
+ require 'oktakit/client/users'
12
+
13
+ module Oktakit
14
+ class Client
15
+ include AdminRoles
16
+ include Apps
17
+ include Events
18
+ include Factors
19
+ include Groups
20
+ include IdentityProviders
21
+ include Schemas
22
+ include Templates
23
+ include Users
24
+
25
+ # In Faraday 0.9, Faraday::Builder was renamed to Faraday::RackBuilder
26
+ RACK_BUILDER_CLASS = defined?(Faraday::RackBuilder) ? Faraday::RackBuilder : Faraday::Builder
27
+
28
+ # Default Faraday middleware stack
29
+ MIDDLEWARE = RACK_BUILDER_CLASS.new do |builder|
30
+ builder.use Oktakit::Response::RaiseError
31
+ builder.adapter Faraday.default_adapter
32
+ end
33
+
34
+ def initialize(token:, organization:)
35
+ @token = token
36
+ @organization = organization
37
+ end
38
+
39
+ # Make a HTTP GET request
40
+ #
41
+ # @param url [String] The path, relative to {#api_endpoint}
42
+ # @param options[:query] [Hash] Optional. Query params for request
43
+ # @param options[:headers] [Hash] Optional. Header params for the request.
44
+ # @param options[:accept] [String] Optional. The content type to accept. Default application/json
45
+ # @param options[:content_type] [String] Optional. The content type for the request. Default application/json
46
+ # @param options [Hash] Optional. Body params for request.
47
+ # @return [Sawyer::Resource]
48
+ def get(url, options = {})
49
+ request :get, url, query: options.delete(:query), headers: options.delete(:headers),
50
+ accept: options.delete(:accept), content_type: options.delete(:content_type),
51
+ data: options
52
+ end
53
+
54
+ # Make a HTTP POST request
55
+ #
56
+ # @param url [String] The path, relative to {#api_endpoint}
57
+ # @param options[:query] [Hash] Optional. Query params for request
58
+ # @param options[:headers] [Hash] Optional. Header params for the request.
59
+ # @param options[:accept] [String] Optional. The content type to accept. Default application/json
60
+ # @param options[:content_type] [String] Optional. The content type for the request. Default application/json
61
+ # @param options [Hash] Optional. Body params for request.
62
+ # @return [Sawyer::Resource]
63
+ def post(url, options = {})
64
+ request :post, url, query: options.delete(:query), headers: options.delete(:headers),
65
+ accept: options.delete(:accept), content_type: options.delete(:content_type),
66
+ data: options
67
+ end
68
+
69
+ # Make a HTTP PUT request
70
+ #
71
+ # @param url [String] The path, relative to {#api_endpoint}
72
+ # @param options[:query] [Hash] Optional. Query params for request
73
+ # @param options[:headers] [Hash] Optional. Header params for the request.
74
+ # @param options[:accept] [String] Optional. The content type to accept. Default application/json
75
+ # @param options[:content_type] [String] Optional. The content type for the request. Default application/json
76
+ # @param options [Hash] Optional. Body params for request.
77
+ # @return [Sawyer::Resource]
78
+ def put(url, options = {})
79
+ request :put, url, query: options.delete(:query), headers: options.delete(:headers),
80
+ accept: options.delete(:accept), content_type: options.delete(:content_type),
81
+ data: options
82
+ end
83
+
84
+ # Make a HTTP PATCH request
85
+ #
86
+ # @param url [String] The path, relative to {#api_endpoint}
87
+ # @param options[:query] [Hash] Optional. Query params for request
88
+ # @param options[:headers] [Hash] Optional. Header params for the request.
89
+ # @param options[:accept] [String] Optional. The content type to accept. Default application/json
90
+ # @param options[:content_type] [String] Optional. The content type for the request. Default application/json
91
+ # @param options [Hash] Optional. Body params for request.
92
+ # @return [Sawyer::Resource]
93
+ def patch(url, options = {})
94
+ request :patch, url, query: options.delete(:query), headers: options.delete(:headers),
95
+ accept: options.delete(:accept), content_type: options.delete(:content_type),
96
+ data: options
97
+ end
98
+
99
+ # Make a HTTP DELETE request
100
+ #
101
+ # @param url [String] The path, relative to {#api_endpoint}
102
+ # @param options[:query] [Hash] Optional. Query params for request
103
+ # @param options[:headers] [Hash] Optional. Header params for the request.
104
+ # @param options[:accept] [String] Optional. The content type to accept. Default application/json
105
+ # @param options[:content_type] [String] Optional. The content type for the request. Default application/json
106
+ # @param options [Hash] Optional. Body params for request.
107
+ # @return [Sawyer::Resource]
108
+ def delete(url, options = {})
109
+ request :delete, url, query: options.delete(:query), headers: options.delete(:headers),
110
+ accept: options.delete(:accept), content_type: options.delete(:content_type),
111
+ data: options
112
+ end
113
+
114
+ # Make a HTTP HEAD request
115
+ #
116
+ # @param url [String] The path, relative to {#api_endpoint}
117
+ # @param options[:query] [Hash] Optional. Query params for request
118
+ # @param options[:headers] [Hash] Optional. Header params for the request.
119
+ # @param options[:accept] [String] Optional. The content type to accept. Default application/json
120
+ # @param options[:content_type] [String] Optional. The content type for the request. Default application/json
121
+ # @param options [Hash] Optional. Body params for request.
122
+ # @return [Sawyer::Resource]
123
+ def head(url, options = {})
124
+ request :head, url, query: options.delete(:query), headers: options.delete(:headers),
125
+ accept: options.delete(:accept), content_type: options.delete(:content_type),
126
+ data: options
127
+ end
128
+
129
+ attr_reader :last_response
130
+
131
+ private
132
+
133
+ def request(method, path, data:, query:, headers:, accept:, content_type:)
134
+ options = {}
135
+ options[:query] = query || {}
136
+ options[:headers] = headers || {}
137
+ options[:headers][:accept] = accept if accept
138
+ options[:headers][:content_type] = content_type if content_type
139
+
140
+ uri = URI::Parser.new.escape("/api/v1/" + path.to_s)
141
+ @last_response = response = sawyer_agent.call(method, uri, data, options)
142
+ [response.data, response.status]
143
+ end
144
+
145
+ def sawyer_agent
146
+ @agent ||= Sawyer::Agent.new(api_endpoint, sawyer_options) do |http|
147
+ http.headers[:accept] = 'application/json'
148
+ http.headers[:content_type] = 'application/json'
149
+ http.headers[:user_agent] = "Oktakit v#{Oktakit::VERSION}"
150
+ http.authorization 'SSWS ', @token
151
+ end
152
+ end
153
+
154
+ def sawyer_options
155
+ {
156
+ links_parser: Sawyer::LinkParsers::Simple.new,
157
+ faraday: Faraday.new(builder: MIDDLEWARE),
158
+ }
159
+ end
160
+
161
+ def api_endpoint
162
+ "https://#{@organization}.okta.com/api/v1/"
163
+ end
164
+ end
165
+ end
@@ -0,0 +1,160 @@
1
+ module Oktakit
2
+ class Client
3
+ module AdminRoles
4
+ # List Roles Assigned to User
5
+ #
6
+ # @params id [string] User ID
7
+ # @param options[:query] [Hash] Optional. Query params for request
8
+ # @param options[:headers] [Hash] Optional. Header params for the request.
9
+ # @param options[:accept] [String] Optional. The content type to accept. Default application/json
10
+ # @param options[:content_type] [String] Optional. The content type for the request. Default application/json
11
+ # @param options [Hash] Optional. Body params for request.
12
+ # @return [Array<Sawyer::Resource>] Array of Role
13
+ # @see http://developer.okta.com/docs/api/resources/roles.html#list-roles-assigned-to-user
14
+ # @example
15
+ # Oktakit.list_roles_assigned_to_user('id')
16
+ def list_roles_assigned_to_user(id, options = {})
17
+ get("/users/#{id}/roles", options)
18
+ end
19
+
20
+ # Assign Role to User
21
+ #
22
+ # @params id [string] User ID
23
+ # @param options[:query] [Hash] Optional. Query params for request
24
+ # @param options[:headers] [Hash] Optional. Header params for the request.
25
+ # @param options[:accept] [String] Optional. The content type to accept. Default application/json
26
+ # @param options[:content_type] [String] Optional. The content type for the request. Default application/json
27
+ # @param options [Hash] Optional. Body params for request.
28
+ # @return [Hash<Sawyer::Resource>] Assigned Role
29
+ # @see http://developer.okta.com/docs/api/resources/roles.html#assign-role-to-user
30
+ # @example
31
+ # Oktakit.assign_role_to_user('id')
32
+ def assign_role_to_user(id, options = {})
33
+ post("/users/#{id}/roles", options)
34
+ end
35
+
36
+ # Unassign Role from User
37
+ #
38
+ # @params user_id [string] User ID
39
+ # @params role_id [string] Role ID
40
+ # @param options[:query] [Hash] Optional. Query params for request
41
+ # @param options[:headers] [Hash] Optional. Header params for the request.
42
+ # @param options[:accept] [String] Optional. The content type to accept. Default application/json
43
+ # @param options[:content_type] [String] Optional. The content type for the request. Default application/json
44
+ # @param options [Hash] Optional. Body params for request.
45
+ # @return HTTP 204 No Content
46
+ # @see http://developer.okta.com/docs/api/resources/roles.html#unassign-role-from-user
47
+ # @example
48
+ # Oktakit.unassign_role_from_user('user_id', 'role_id')
49
+ def unassign_role_from_user(user_id, role_id, options = {})
50
+ delete("/users/#{user_id}/roles/#{role_id}", options)
51
+ end
52
+
53
+ # List Group Targets for User Admin Role
54
+ #
55
+ # @params user_id [string] User ID
56
+ # @params role_id [string] Role ID
57
+ # @param options[:query] [Hash] Optional. Query params for request
58
+ # @param options[:headers] [Hash] Optional. Header params for the request.
59
+ # @param options[:accept] [String] Optional. The content type to accept. Default application/json
60
+ # @param options[:content_type] [String] Optional. The content type for the request. Default application/json
61
+ # @param options [Hash] Optional. Body params for request.
62
+ # @return [Array<Sawyer::Resource>] Array of Groups
63
+ # @see http://developer.okta.com/docs/api/resources/roles.html#list-group-targets-for-user-admin-role
64
+ # @example
65
+ # Oktakit.list_group_targets_for_user_admin_role('user_id', 'role_id')
66
+ def list_group_targets_for_user_admin_role(user_id, role_id, options = {})
67
+ get("/users/#{user_id}/roles/#{role_id}/targets/groups", options)
68
+ end
69
+
70
+ # Add Group Target to User Admin Role
71
+ #
72
+ # @params user_id [string] User ID
73
+ # @params role_id [string] Role ID
74
+ # @params group_id [string] Group ID
75
+ # @param options[:query] [Hash] Optional. Query params for request
76
+ # @param options[:headers] [Hash] Optional. Header params for the request.
77
+ # @param options[:accept] [String] Optional. The content type to accept. Default application/json
78
+ # @param options[:content_type] [String] Optional. The content type for the request. Default application/json
79
+ # @param options [Hash] Optional. Body params for request.
80
+ # @return HTTP 204 No Content
81
+ # @see http://developer.okta.com/docs/api/resources/roles.html#add-group-target-to-user-admin-role
82
+ # @example
83
+ # Oktakit.add_group_target_to_user_admin_role('group_id', 'user_id', 'role_id')
84
+ def add_group_target_to_user_admin_role(user_id, role_id, group_id, options = {})
85
+ put("/users/#{user_id}/roles/#{role_id}/targets/groups/#{group_id}", options)
86
+ end
87
+
88
+ # Remove Group Target from User Admin Role
89
+ #
90
+ # @params user_id [string] User ID
91
+ # @params role_id [string] Role ID
92
+ # @params group_id [string] Group ID
93
+ # @param options[:query] [Hash] Optional. Query params for request
94
+ # @param options[:headers] [Hash] Optional. Header params for the request.
95
+ # @param options[:accept] [String] Optional. The content type to accept. Default application/json
96
+ # @param options[:content_type] [String] Optional. The content type for the request. Default application/json
97
+ # @param options [Hash] Optional. Body params for request.
98
+ # @return HTTP 204 No Content
99
+ # @see http://developer.okta.com/docs/api/resources/roles.html#remove-group-target-from-user-admin-role
100
+ # @example
101
+ # Oktakit.remove_group_target_from_user_admin_role('group_id', 'user_id', 'role_id')
102
+ def remove_group_target_from_user_admin_role(user_id, role_id, group_id, options = {})
103
+ delete("/users/#{user_id}/roles/#{role_id}/targets/groups/#{group_id}", options)
104
+ end
105
+
106
+ # List App Targets for App Admin Role
107
+ #
108
+ # @params user_id [string] User ID
109
+ # @params role_id [string] Role ID
110
+ # @param options[:query] [Hash] Optional. Query params for request
111
+ # @param options[:headers] [Hash] Optional. Header params for the request.
112
+ # @param options[:accept] [String] Optional. The content type to accept. Default application/json
113
+ # @param options[:content_type] [String] Optional. The content type for the request. Default application/json
114
+ # @param options [Hash] Optional. Body params for request.
115
+ # @return [Array<Sawyer::Resource>] Array of Catalog Apps
116
+ # @see http://developer.okta.com/docs/api/resources/roles.html#list-app-targets-for-app-admin-role
117
+ # @example
118
+ # Oktakit.list_app_targets_for_app_admin_role('user_id', 'role_id')
119
+ def list_app_targets_for_app_admin_role(user_id, role_id, options = {})
120
+ get("/users/#{user_id}/roles/#{role_id}/targets/catalog/apps", options)
121
+ end
122
+
123
+ # Add App Target to App Admin Role
124
+ #
125
+ # @params user_id [string] User ID
126
+ # @params role_id [string] Role ID
127
+ # @params app_name [string] App Name
128
+ # @param options[:query] [Hash] Optional. Query params for request
129
+ # @param options[:headers] [Hash] Optional. Header params for the request.
130
+ # @param options[:accept] [String] Optional. The content type to accept. Default application/json
131
+ # @param options[:content_type] [String] Optional. The content type for the request. Default application/json
132
+ # @param options [Hash] Optional. Body params for request.
133
+ # @return HTTP 204 No Content
134
+ # @see http://developer.okta.com/docs/api/resources/roles.html#add-app-target-to-app-admin-role
135
+ # @example
136
+ # Oktakit.add_app_target_to_app_admin_role('user_id', 'role_id')
137
+ def add_app_target_to_app_admin_role(user_id, role_id, app_name, options = {})
138
+ put("/users/#{user_id}/roles/#{role_id}/targets/catalog/apps/#{app_name}", options)
139
+ end
140
+
141
+ # Remove App Target from App Admin Role
142
+ #
143
+ # @params user_id [string] User ID
144
+ # @params role_id [string] Role ID
145
+ # @params app_name [string] App Name
146
+ # @param options[:query] [Hash] Optional. Query params for request
147
+ # @param options[:headers] [Hash] Optional. Header params for the request.
148
+ # @param options[:accept] [String] Optional. The content type to accept. Default application/json
149
+ # @param options[:content_type] [String] Optional. The content type for the request. Default application/json
150
+ # @param options [Hash] Optional. Body params for request.
151
+ # @return HTTP 204 No Content
152
+ # @see http://developer.okta.com/docs/api/resources/roles.html#remove-app-target-from-app-admin-role
153
+ # @example
154
+ # Oktakit.remove_app_target_from_app_admin_role('user_id', 'role_id')
155
+ def remove_app_target_from_app_admin_role(user_id, role_id, app_name, options = {})
156
+ delete("/users/#{user_id}/roles/#{role_id}/targets/catalog/apps/#{app_name}", options)
157
+ end
158
+ end
159
+ end
160
+ end