pulp_npm_client 0.8.0 → 0.10.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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -4
  3. data/docs/ContentPackagesApi.md +4 -0
  4. data/docs/DistributionsNpmApi.md +312 -0
  5. data/docs/MyPermissionsResponse.md +18 -0
  6. data/docs/NestedRole.md +22 -0
  7. data/docs/NestedRoleResponse.md +22 -0
  8. data/docs/NpmPingApi.md +1 -7
  9. data/docs/ObjectRolesResponse.md +18 -0
  10. data/docs/RemotesNpmApi.md +312 -0
  11. data/docs/RepositoriesNpmApi.md +312 -0
  12. data/docs/RepositoryAddRemoveContent.md +3 -1
  13. data/lib/pulp_npm_client/api/content_packages_api.rb +6 -0
  14. data/lib/pulp_npm_client/api/distributions_npm_api.rb +298 -0
  15. data/lib/pulp_npm_client/api/npm_ping_api.rb +1 -1
  16. data/lib/pulp_npm_client/api/remotes_npm_api.rb +298 -0
  17. data/lib/pulp_npm_client/api/repositories_npm_api.rb +298 -0
  18. data/lib/pulp_npm_client/models/my_permissions_response.rb +223 -0
  19. data/lib/pulp_npm_client/models/nested_role.rb +263 -0
  20. data/lib/pulp_npm_client/models/nested_role_response.rb +244 -0
  21. data/lib/pulp_npm_client/models/object_roles_response.rb +223 -0
  22. data/lib/pulp_npm_client/models/repository_add_remove_content.rb +16 -4
  23. data/lib/pulp_npm_client/version.rb +1 -1
  24. data/lib/pulp_npm_client.rb +4 -0
  25. data/spec/api/content_packages_api_spec.rb +2 -0
  26. data/spec/api/distributions_npm_api_spec.rb +58 -0
  27. data/spec/api/remotes_npm_api_spec.rb +58 -0
  28. data/spec/api/repositories_npm_api_spec.rb +58 -0
  29. data/spec/models/my_permissions_response_spec.rb +36 -0
  30. data/spec/models/nested_role_response_spec.rb +48 -0
  31. data/spec/models/nested_role_spec.rb +48 -0
  32. data/spec/models/object_roles_response_spec.rb +36 -0
  33. data/spec/models/repository_add_remove_content_spec.rb +6 -0
  34. metadata +43 -27
@@ -24,6 +24,7 @@ module PulpNpmClient
24
24
  # @param [Hash] opts the optional parameters
25
25
  # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
26
26
  # @option opts [String] :repository A URI of a repository the new content unit should be associated with.
27
+ # @option opts [Boolean] :overwrite When set to true, existing content in the repository with the same unique key will be silently overwritten. When set to false, the task will fail if content would be overwritten. Only used when &#39;repository&#39; is specified. Defaults to true.
27
28
  # @option opts [Hash<String, String>] :pulp_labels A dictionary of arbitrary key/value pairs used to describe a specific Content instance.
28
29
  # @option opts [String] :artifact Artifact file representing the physical content
29
30
  # @option opts [String] :relative_path Path where the artifact is located relative to distributions base_path. If not provided, it will be computed from name and version.
@@ -44,6 +45,7 @@ module PulpNpmClient
44
45
  # @param [Hash] opts the optional parameters
45
46
  # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
46
47
  # @option opts [String] :repository A URI of a repository the new content unit should be associated with.
48
+ # @option opts [Boolean] :overwrite When set to true, existing content in the repository with the same unique key will be silently overwritten. When set to false, the task will fail if content would be overwritten. Only used when &#39;repository&#39; is specified. Defaults to true.
47
49
  # @option opts [Hash<String, String>] :pulp_labels A dictionary of arbitrary key/value pairs used to describe a specific Content instance.
48
50
  # @option opts [String] :artifact Artifact file representing the physical content
49
51
  # @option opts [String] :relative_path Path where the artifact is located relative to distributions base_path. If not provided, it will be computed from name and version.
@@ -94,6 +96,7 @@ module PulpNpmClient
94
96
  # form parameters
95
97
  form_params = opts[:form_params] || {}
96
98
  form_params['repository'] = opts[:'repository'] if !opts[:'repository'].nil?
99
+ form_params['overwrite'] = opts[:'overwrite'] if !opts[:'overwrite'].nil?
97
100
  form_params['pulp_labels'] = opts[:'pulp_labels'] if !opts[:'pulp_labels'].nil?
98
101
  form_params['artifact'] = opts[:'artifact'] if !opts[:'artifact'].nil?
99
102
  form_params['relative_path'] = opts[:'relative_path'] if !opts[:'relative_path'].nil?
@@ -472,6 +475,7 @@ module PulpNpmClient
472
475
  # Create an npm package content unit synchronously.
473
476
  # @param [Hash] opts the optional parameters
474
477
  # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
478
+ # @option opts [Boolean] :overwrite When set to true, existing content in the repository with the same unique key will be silently overwritten. When set to false, the task will fail if content would be overwritten. Only used when &#39;repository&#39; is specified. Defaults to true.
475
479
  # @option opts [Hash<String, String>] :pulp_labels A dictionary of arbitrary key/value pairs used to describe a specific Content instance.
476
480
  # @option opts [String] :artifact Artifact file representing the physical content
477
481
  # @option opts [String] :relative_path Path where the artifact is located relative to distributions base_path. If not provided, it will be computed from name and version.
@@ -491,6 +495,7 @@ module PulpNpmClient
491
495
  # Create an npm package content unit synchronously.
492
496
  # @param [Hash] opts the optional parameters
493
497
  # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
498
+ # @option opts [Boolean] :overwrite When set to true, existing content in the repository with the same unique key will be silently overwritten. When set to false, the task will fail if content would be overwritten. Only used when &#39;repository&#39; is specified. Defaults to true.
494
499
  # @option opts [Hash<String, String>] :pulp_labels A dictionary of arbitrary key/value pairs used to describe a specific Content instance.
495
500
  # @option opts [String] :artifact Artifact file representing the physical content
496
501
  # @option opts [String] :relative_path Path where the artifact is located relative to distributions base_path. If not provided, it will be computed from name and version.
@@ -540,6 +545,7 @@ module PulpNpmClient
540
545
 
541
546
  # form parameters
542
547
  form_params = opts[:form_params] || {}
548
+ form_params['overwrite'] = opts[:'overwrite'] if !opts[:'overwrite'].nil?
543
549
  form_params['pulp_labels'] = opts[:'pulp_labels'] if !opts[:'pulp_labels'].nil?
544
550
  form_params['artifact'] = opts[:'artifact'] if !opts[:'artifact'].nil?
545
551
  form_params['relative_path'] = opts[:'relative_path'] if !opts[:'relative_path'].nil?
@@ -19,6 +19,83 @@ module PulpNpmClient
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Add a role
23
+ # Add a role for this object to users/groups.
24
+ # @param npm_npm_distribution_href [String]
25
+ # @param nested_role [NestedRole]
26
+ # @param [Hash] opts the optional parameters
27
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
28
+ # @return [NestedRoleResponse]
29
+ def add_role(npm_npm_distribution_href, nested_role, opts = {})
30
+ data, _status_code, _headers = add_role_with_http_info(npm_npm_distribution_href, nested_role, opts)
31
+ data
32
+ end
33
+
34
+ # Add a role
35
+ # Add a role for this object to users/groups.
36
+ # @param npm_npm_distribution_href [String]
37
+ # @param nested_role [NestedRole]
38
+ # @param [Hash] opts the optional parameters
39
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
40
+ # @return [Array<(NestedRoleResponse, Integer, Hash)>] NestedRoleResponse data, response status code and response headers
41
+ def add_role_with_http_info(npm_npm_distribution_href, nested_role, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: DistributionsNpmApi.add_role ...'
44
+ end
45
+ # verify the required parameter 'npm_npm_distribution_href' is set
46
+ if @api_client.config.client_side_validation && npm_npm_distribution_href.nil?
47
+ fail ArgumentError, "Missing the required parameter 'npm_npm_distribution_href' when calling DistributionsNpmApi.add_role"
48
+ end
49
+ # verify the required parameter 'nested_role' is set
50
+ if @api_client.config.client_side_validation && nested_role.nil?
51
+ fail ArgumentError, "Missing the required parameter 'nested_role' when calling DistributionsNpmApi.add_role"
52
+ end
53
+ # resource path
54
+ local_var_path = '{npm_npm_distribution_href}add_role/'.sub('{' + 'npm_npm_distribution_href' + '}', CGI.escape(npm_npm_distribution_href.to_s).gsub('%2F', '/'))
55
+
56
+ # query parameters
57
+ query_params = opts[:query_params] || {}
58
+
59
+ # header parameters
60
+ header_params = opts[:header_params] || {}
61
+ # HTTP header 'Accept' (if needed)
62
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
63
+ # HTTP header 'Content-Type'
64
+ content_type = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])
65
+ if !content_type.nil?
66
+ header_params['Content-Type'] = content_type
67
+ end
68
+ header_params[:'X-Task-Diagnostics'] = @api_client.build_collection_param(opts[:'x_task_diagnostics'], :csv) if !opts[:'x_task_diagnostics'].nil?
69
+
70
+ # form parameters
71
+ form_params = opts[:form_params] || {}
72
+
73
+ # http body (model)
74
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(nested_role)
75
+
76
+ # return_type
77
+ return_type = opts[:debug_return_type] || 'NestedRoleResponse'
78
+
79
+ # auth_names
80
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
81
+
82
+ new_options = opts.merge(
83
+ :operation => :"DistributionsNpmApi.add_role",
84
+ :header_params => header_params,
85
+ :query_params => query_params,
86
+ :form_params => form_params,
87
+ :body => post_body,
88
+ :auth_names => auth_names,
89
+ :return_type => return_type
90
+ )
91
+
92
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
93
+ if @api_client.config.debugging
94
+ @api_client.config.logger.debug "API called: DistributionsNpmApi#add_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
95
+ end
96
+ return data, status_code, headers
97
+ end
98
+
22
99
  # Create a npm distribution
23
100
  # Trigger an asynchronous create task
24
101
  # @param npm_npm_distribution [NpmNpmDistribution]
@@ -301,6 +378,150 @@ module PulpNpmClient
301
378
  return data, status_code, headers
302
379
  end
303
380
 
381
+ # List roles
382
+ # List roles assigned to this object.
383
+ # @param npm_npm_distribution_href [String]
384
+ # @param [Hash] opts the optional parameters
385
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
386
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
387
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
388
+ # @return [ObjectRolesResponse]
389
+ def list_roles(npm_npm_distribution_href, opts = {})
390
+ data, _status_code, _headers = list_roles_with_http_info(npm_npm_distribution_href, opts)
391
+ data
392
+ end
393
+
394
+ # List roles
395
+ # List roles assigned to this object.
396
+ # @param npm_npm_distribution_href [String]
397
+ # @param [Hash] opts the optional parameters
398
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
399
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
400
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
401
+ # @return [Array<(ObjectRolesResponse, Integer, Hash)>] ObjectRolesResponse data, response status code and response headers
402
+ def list_roles_with_http_info(npm_npm_distribution_href, opts = {})
403
+ if @api_client.config.debugging
404
+ @api_client.config.logger.debug 'Calling API: DistributionsNpmApi.list_roles ...'
405
+ end
406
+ # verify the required parameter 'npm_npm_distribution_href' is set
407
+ if @api_client.config.client_side_validation && npm_npm_distribution_href.nil?
408
+ fail ArgumentError, "Missing the required parameter 'npm_npm_distribution_href' when calling DistributionsNpmApi.list_roles"
409
+ end
410
+ # resource path
411
+ local_var_path = '{npm_npm_distribution_href}list_roles/'.sub('{' + 'npm_npm_distribution_href' + '}', CGI.escape(npm_npm_distribution_href.to_s).gsub('%2F', '/'))
412
+
413
+ # query parameters
414
+ query_params = opts[:query_params] || {}
415
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].nil?
416
+ query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :multi) if !opts[:'exclude_fields'].nil?
417
+
418
+ # header parameters
419
+ header_params = opts[:header_params] || {}
420
+ # HTTP header 'Accept' (if needed)
421
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
422
+ header_params[:'X-Task-Diagnostics'] = @api_client.build_collection_param(opts[:'x_task_diagnostics'], :csv) if !opts[:'x_task_diagnostics'].nil?
423
+
424
+ # form parameters
425
+ form_params = opts[:form_params] || {}
426
+
427
+ # http body (model)
428
+ post_body = opts[:debug_body]
429
+
430
+ # return_type
431
+ return_type = opts[:debug_return_type] || 'ObjectRolesResponse'
432
+
433
+ # auth_names
434
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
435
+
436
+ new_options = opts.merge(
437
+ :operation => :"DistributionsNpmApi.list_roles",
438
+ :header_params => header_params,
439
+ :query_params => query_params,
440
+ :form_params => form_params,
441
+ :body => post_body,
442
+ :auth_names => auth_names,
443
+ :return_type => return_type
444
+ )
445
+
446
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
447
+ if @api_client.config.debugging
448
+ @api_client.config.logger.debug "API called: DistributionsNpmApi#list_roles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
449
+ end
450
+ return data, status_code, headers
451
+ end
452
+
453
+ # List user permissions
454
+ # List permissions available to the current user on this object.
455
+ # @param npm_npm_distribution_href [String]
456
+ # @param [Hash] opts the optional parameters
457
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
458
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
459
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
460
+ # @return [MyPermissionsResponse]
461
+ def my_permissions(npm_npm_distribution_href, opts = {})
462
+ data, _status_code, _headers = my_permissions_with_http_info(npm_npm_distribution_href, opts)
463
+ data
464
+ end
465
+
466
+ # List user permissions
467
+ # List permissions available to the current user on this object.
468
+ # @param npm_npm_distribution_href [String]
469
+ # @param [Hash] opts the optional parameters
470
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
471
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
472
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
473
+ # @return [Array<(MyPermissionsResponse, Integer, Hash)>] MyPermissionsResponse data, response status code and response headers
474
+ def my_permissions_with_http_info(npm_npm_distribution_href, opts = {})
475
+ if @api_client.config.debugging
476
+ @api_client.config.logger.debug 'Calling API: DistributionsNpmApi.my_permissions ...'
477
+ end
478
+ # verify the required parameter 'npm_npm_distribution_href' is set
479
+ if @api_client.config.client_side_validation && npm_npm_distribution_href.nil?
480
+ fail ArgumentError, "Missing the required parameter 'npm_npm_distribution_href' when calling DistributionsNpmApi.my_permissions"
481
+ end
482
+ # resource path
483
+ local_var_path = '{npm_npm_distribution_href}my_permissions/'.sub('{' + 'npm_npm_distribution_href' + '}', CGI.escape(npm_npm_distribution_href.to_s).gsub('%2F', '/'))
484
+
485
+ # query parameters
486
+ query_params = opts[:query_params] || {}
487
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].nil?
488
+ query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :multi) if !opts[:'exclude_fields'].nil?
489
+
490
+ # header parameters
491
+ header_params = opts[:header_params] || {}
492
+ # HTTP header 'Accept' (if needed)
493
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
494
+ header_params[:'X-Task-Diagnostics'] = @api_client.build_collection_param(opts[:'x_task_diagnostics'], :csv) if !opts[:'x_task_diagnostics'].nil?
495
+
496
+ # form parameters
497
+ form_params = opts[:form_params] || {}
498
+
499
+ # http body (model)
500
+ post_body = opts[:debug_body]
501
+
502
+ # return_type
503
+ return_type = opts[:debug_return_type] || 'MyPermissionsResponse'
504
+
505
+ # auth_names
506
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
507
+
508
+ new_options = opts.merge(
509
+ :operation => :"DistributionsNpmApi.my_permissions",
510
+ :header_params => header_params,
511
+ :query_params => query_params,
512
+ :form_params => form_params,
513
+ :body => post_body,
514
+ :auth_names => auth_names,
515
+ :return_type => return_type
516
+ )
517
+
518
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
519
+ if @api_client.config.debugging
520
+ @api_client.config.logger.debug "API called: DistributionsNpmApi#my_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
521
+ end
522
+ return data, status_code, headers
523
+ end
524
+
304
525
  # Update a npm distribution
305
526
  # Update the entity partially and trigger an asynchronous task if necessary
306
527
  # @param npm_npm_distribution_href [String]
@@ -450,6 +671,83 @@ module PulpNpmClient
450
671
  return data, status_code, headers
451
672
  end
452
673
 
674
+ # Remove a role
675
+ # Remove a role for this object from users/groups.
676
+ # @param npm_npm_distribution_href [String]
677
+ # @param nested_role [NestedRole]
678
+ # @param [Hash] opts the optional parameters
679
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
680
+ # @return [NestedRoleResponse]
681
+ def remove_role(npm_npm_distribution_href, nested_role, opts = {})
682
+ data, _status_code, _headers = remove_role_with_http_info(npm_npm_distribution_href, nested_role, opts)
683
+ data
684
+ end
685
+
686
+ # Remove a role
687
+ # Remove a role for this object from users/groups.
688
+ # @param npm_npm_distribution_href [String]
689
+ # @param nested_role [NestedRole]
690
+ # @param [Hash] opts the optional parameters
691
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
692
+ # @return [Array<(NestedRoleResponse, Integer, Hash)>] NestedRoleResponse data, response status code and response headers
693
+ def remove_role_with_http_info(npm_npm_distribution_href, nested_role, opts = {})
694
+ if @api_client.config.debugging
695
+ @api_client.config.logger.debug 'Calling API: DistributionsNpmApi.remove_role ...'
696
+ end
697
+ # verify the required parameter 'npm_npm_distribution_href' is set
698
+ if @api_client.config.client_side_validation && npm_npm_distribution_href.nil?
699
+ fail ArgumentError, "Missing the required parameter 'npm_npm_distribution_href' when calling DistributionsNpmApi.remove_role"
700
+ end
701
+ # verify the required parameter 'nested_role' is set
702
+ if @api_client.config.client_side_validation && nested_role.nil?
703
+ fail ArgumentError, "Missing the required parameter 'nested_role' when calling DistributionsNpmApi.remove_role"
704
+ end
705
+ # resource path
706
+ local_var_path = '{npm_npm_distribution_href}remove_role/'.sub('{' + 'npm_npm_distribution_href' + '}', CGI.escape(npm_npm_distribution_href.to_s).gsub('%2F', '/'))
707
+
708
+ # query parameters
709
+ query_params = opts[:query_params] || {}
710
+
711
+ # header parameters
712
+ header_params = opts[:header_params] || {}
713
+ # HTTP header 'Accept' (if needed)
714
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
715
+ # HTTP header 'Content-Type'
716
+ content_type = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])
717
+ if !content_type.nil?
718
+ header_params['Content-Type'] = content_type
719
+ end
720
+ header_params[:'X-Task-Diagnostics'] = @api_client.build_collection_param(opts[:'x_task_diagnostics'], :csv) if !opts[:'x_task_diagnostics'].nil?
721
+
722
+ # form parameters
723
+ form_params = opts[:form_params] || {}
724
+
725
+ # http body (model)
726
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(nested_role)
727
+
728
+ # return_type
729
+ return_type = opts[:debug_return_type] || 'NestedRoleResponse'
730
+
731
+ # auth_names
732
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
733
+
734
+ new_options = opts.merge(
735
+ :operation => :"DistributionsNpmApi.remove_role",
736
+ :header_params => header_params,
737
+ :query_params => query_params,
738
+ :form_params => form_params,
739
+ :body => post_body,
740
+ :auth_names => auth_names,
741
+ :return_type => return_type
742
+ )
743
+
744
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
745
+ if @api_client.config.debugging
746
+ @api_client.config.logger.debug "API called: DistributionsNpmApi#remove_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
747
+ end
748
+ return data, status_code, headers
749
+ end
750
+
453
751
  # Set a label
454
752
  # Set a single pulp_label on the object to a specific value or null.
455
753
  # @param npm_npm_distribution_href [String]
@@ -73,7 +73,7 @@ module PulpNpmClient
73
73
  return_type = opts[:debug_return_type]
74
74
 
75
75
  # auth_names
76
- auth_names = opts[:debug_auth_names] || ['basicAuth']
76
+ auth_names = opts[:debug_auth_names] || []
77
77
 
78
78
  new_options = opts.merge(
79
79
  :operation => :"NpmPingApi.get",