|
| 1 | +module Oktakit |
| 2 | + class Client |
| 3 | + module PolicyRules |
| 4 | + # List Policy Rules |
| 5 | + # |
| 6 | + # @param policy_id [string] Policy 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 Policy Rules |
| 13 | + # @see https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Policy/#tag/Policy/operation/listPolicyRules |
| 14 | + # @example |
| 15 | + # Oktakit.list_policy_rules('policy_id') |
| 16 | + def list_policy_rules(policy_id, options = {}) |
| 17 | + get("/policies/#{policy_id}/rules", options) |
| 18 | + end |
| 19 | + |
| 20 | + # Create Policy Rule |
| 21 | + # |
| 22 | + # @param policy_id [string] Policy 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 [Sawyer::Resource] The created Policy Rule |
| 29 | + # @see https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Policy/#tag/Policy/operation/createPolicyRule |
| 30 | + # @example |
| 31 | + # Oktakit.add_policy_rule('policy_id', {}) |
| 32 | + def add_policy_rule(policy_id, options = {}) |
| 33 | + post("/policies/#{policy_id}/rules", options) |
| 34 | + end |
| 35 | + |
| 36 | + # Get Policy Rule |
| 37 | + # |
| 38 | + # @param policy_id [string] Policy ID |
| 39 | + # @param rule_id [string] Rule 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 [Sawyer::Resource] Policy Rule |
| 46 | + # @see https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Policy/#tag/Policy/operation/getPolicyRule |
| 47 | + # @example |
| 48 | + # Oktakit.get_policy_rule('policy_id', 'rule_id', {}) |
| 49 | + def get_policy_rule(policy_id, rule_id, options = {}) |
| 50 | + get("/policies/#{policy_id}/rules/#{rule_id}", options) |
| 51 | + end |
| 52 | + |
| 53 | + # Update Policy Rule |
| 54 | + # |
| 55 | + # @param policy_id [string] Policy ID |
| 56 | + # @param rule_id [string] Rule 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 [Sawyer::Resource] Updated policy rule |
| 63 | + # @see https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Policy/#tag/Policy/operation/replacePolicyRule |
| 64 | + # @example |
| 65 | + # Oktakit.update_policy_rule('policy_id', 'rule_id', {}) |
| 66 | + def update_policy_rule(policy_id, rule_id, options = {}) |
| 67 | + put("/policies/#{policy_id}/rules/#{rule_id}", options) |
| 68 | + end |
| 69 | + |
| 70 | + # Delete a Policy Rule |
| 71 | + # |
| 72 | + # @param policy_id [string] Policy ID |
| 73 | + # @param rule_id [string] Rule ID |
| 74 | + # @param options[:query] [Hash] Optional. Query params for request |
| 75 | + # @param options[:headers] [Hash] Optional. Header params for the request. |
| 76 | + # @param options[:accept] [String] Optional. The content type to accept. Default application/json |
| 77 | + # @param options[:content_type] [String] Optional. The content type for the request. Default application/json |
| 78 | + # @param options [Hash] Optional. Body params for request. |
| 79 | + # @return 204 No content |
| 80 | + # @see https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Policy/#tag/Policy/operation/deletePolicyRule |
| 81 | + # @example |
| 82 | + # Oktakit.delete_policy_rule('policy_id', 'rule_id', {}) |
| 83 | + def delete_policy_rule(policy_id, rule_id, options = {}) |
| 84 | + delete("/policies/#{policy_id}/rules/#{rule_id}", options) |
| 85 | + end |
| 86 | + |
| 87 | + end |
| 88 | + end |
| 89 | +end |
0 commit comments