oci 2.0.5 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/oci.rb +3 -0
- data/lib/oci/api_client.rb +24 -3
- data/lib/oci/audit/audit_client.rb +19 -5
- data/lib/oci/audit/models/audit_event.rb +19 -0
- data/lib/oci/audit/models/configuration.rb +1 -0
- data/lib/oci/audit/models/update_configuration_details.rb +1 -0
- data/lib/oci/auth/auth.rb +16 -0
- data/lib/oci/auth/federation_client.rb +125 -0
- data/lib/oci/auth/internal/auth_token_request_signer.rb +20 -0
- data/lib/oci/auth/security_token_container.rb +25 -0
- data/lib/oci/auth/session_key_supplier.rb +37 -0
- data/lib/oci/auth/signers/instance_principals_security_token_signer.rb +83 -0
- data/lib/oci/auth/signers/security_token_signer.rb +32 -0
- data/lib/oci/auth/signers/x509_federation_client_based_security_token_signer.rb +70 -0
- data/lib/oci/auth/url_based_certificate_retriever.rb +104 -0
- data/lib/oci/auth/util.rb +33 -0
- data/lib/oci/base_signer.rb +154 -0
- data/lib/oci/core/blockstorage_client.rb +19 -5
- data/lib/oci/core/compute_client.rb +19 -5
- data/lib/oci/core/models/attach_boot_volume_details.rb +5 -2
- data/lib/oci/core/models/attach_i_scsi_volume_details.rb +5 -1
- data/lib/oci/core/models/attach_vnic_details.rb +6 -2
- data/lib/oci/core/models/attach_volume_details.rb +8 -3
- data/lib/oci/core/models/boot_volume.rb +22 -6
- data/lib/oci/core/models/boot_volume_attachment.rb +17 -7
- data/lib/oci/core/models/bulk_add_virtual_circuit_public_prefixes_details.rb +2 -1
- data/lib/oci/core/models/bulk_delete_virtual_circuit_public_prefixes_details.rb +2 -1
- data/lib/oci/core/models/capture_console_history_details.rb +5 -1
- data/lib/oci/core/models/connect_local_peering_gateways_details.rb +3 -1
- data/lib/oci/core/models/console_history.rb +19 -6
- data/lib/oci/core/models/cpe.rb +18 -3
- data/lib/oci/core/models/create_cpe_details.rb +5 -2
- data/lib/oci/core/models/create_cross_connect_details.rb +10 -3
- data/lib/oci/core/models/create_cross_connect_group_details.rb +3 -1
- data/lib/oci/core/models/create_dhcp_details.rb +9 -3
- data/lib/oci/core/models/create_drg_attachment_details.rb +5 -2
- data/lib/oci/core/models/create_drg_details.rb +3 -1
- data/lib/oci/core/models/create_image_details.rb +9 -1
- data/lib/oci/core/models/create_instance_console_connection_details.rb +9 -2
- data/lib/oci/core/models/create_internet_gateway_details.rb +8 -4
- data/lib/oci/core/models/create_ip_sec_connection_details.rb +9 -4
- data/lib/oci/core/models/create_local_peering_gateway_details.rb +5 -2
- data/lib/oci/core/models/create_private_ip_details.rb +7 -1
- data/lib/oci/core/models/create_route_table_details.rb +9 -3
- data/lib/oci/core/models/create_security_list_details.rb +11 -4
- data/lib/oci/core/models/create_subnet_details.rb +17 -5
- data/lib/oci/core/models/create_vcn_details.rb +8 -2
- data/lib/oci/core/models/create_virtual_circuit_details.rb +14 -2
- data/lib/oci/core/models/create_virtual_circuit_public_prefix_details.rb +2 -1
- data/lib/oci/core/models/create_vnic_details.rb +14 -3
- data/lib/oci/core/models/create_volume_backup_details.rb +5 -1
- data/lib/oci/core/models/create_volume_details.rb +11 -2
- data/lib/oci/core/models/cross_connect.rb +26 -0
- data/lib/oci/core/models/cross_connect_group.rb +19 -0
- data/lib/oci/core/models/cross_connect_location.rb +5 -2
- data/lib/oci/core/models/cross_connect_mapping.rb +31 -0
- data/lib/oci/core/models/cross_connect_port_speed_shape.rb +6 -2
- data/lib/oci/core/models/cross_connect_status.rb +6 -1
- data/lib/oci/core/models/delete_virtual_circuit_public_prefix_details.rb +2 -1
- data/lib/oci/core/models/dhcp_dns_option.rb +7 -1
- data/lib/oci/core/models/dhcp_option.rb +9 -1
- data/lib/oci/core/models/dhcp_options.rb +31 -6
- data/lib/oci/core/models/dhcp_search_domain_option.rb +5 -1
- data/lib/oci/core/models/drg.rb +18 -3
- data/lib/oci/core/models/drg_attachment.rb +15 -5
- data/lib/oci/core/models/egress_security_rule.rb +10 -3
- data/lib/oci/core/models/export_image_details.rb +13 -1
- data/lib/oci/core/models/export_image_via_object_storage_tuple_details.rb +3 -0
- data/lib/oci/core/models/export_image_via_object_storage_uri_details.rb +2 -1
- data/lib/oci/core/models/fast_connect_provider_service.rb +17 -6
- data/lib/oci/core/models/i_scsi_volume_attachment.rb +17 -3
- data/lib/oci/core/models/icmp_options.rb +11 -1
- data/lib/oci/core/models/image.rb +28 -7
- data/lib/oci/core/models/image_source_details.rb +4 -1
- data/lib/oci/core/models/image_source_via_object_storage_tuple_details.rb +7 -3
- data/lib/oci/core/models/image_source_via_object_storage_uri_details.rb +3 -1
- data/lib/oci/core/models/ingress_security_rule.rb +10 -3
- data/lib/oci/core/models/instance.rb +33 -7
- data/lib/oci/core/models/instance_console_connection.rb +15 -0
- data/lib/oci/core/models/instance_credentials.rb +5 -2
- data/lib/oci/core/models/instance_source_details.rb +3 -1
- data/lib/oci/core/models/instance_source_via_boot_volume_details.rb +2 -1
- data/lib/oci/core/models/instance_source_via_image_details.rb +2 -1
- data/lib/oci/core/models/internet_gateway.rb +20 -5
- data/lib/oci/core/models/ip_sec_connection.rb +23 -6
- data/lib/oci/core/models/ip_sec_connection_device_config.rb +7 -2
- data/lib/oci/core/models/ip_sec_connection_device_status.rb +7 -2
- data/lib/oci/core/models/launch_instance_details.rb +20 -3
- data/lib/oci/core/models/launch_options.rb +10 -4
- data/lib/oci/core/models/letter_of_authority.rb +10 -0
- data/lib/oci/core/models/local_peering_gateway.rb +29 -9
- data/lib/oci/core/models/port_range.rb +4 -2
- data/lib/oci/core/models/private_ip.rb +41 -1
- data/lib/oci/core/models/route_rule.rb +7 -2
- data/lib/oci/core/models/route_table.rb +22 -5
- data/lib/oci/core/models/security_list.rb +32 -8
- data/lib/oci/core/models/shape.rb +5 -1
- data/lib/oci/core/models/subnet.rb +38 -10
- data/lib/oci/core/models/tcp_options.rb +5 -0
- data/lib/oci/core/models/tunnel_config.rb +6 -2
- data/lib/oci/core/models/tunnel_status.rb +7 -1
- data/lib/oci/core/models/udp_options.rb +5 -0
- data/lib/oci/core/models/update_boot_volume_details.rb +1 -0
- data/lib/oci/core/models/update_console_history_details.rb +3 -0
- data/lib/oci/core/models/update_cpe_details.rb +1 -0
- data/lib/oci/core/models/update_cross_connect_details.rb +5 -1
- data/lib/oci/core/models/update_cross_connect_group_details.rb +1 -0
- data/lib/oci/core/models/update_dhcp_details.rb +4 -0
- data/lib/oci/core/models/update_drg_attachment_details.rb +1 -0
- data/lib/oci/core/models/update_drg_details.rb +1 -0
- data/lib/oci/core/models/update_image_details.rb +3 -0
- data/lib/oci/core/models/update_instance_details.rb +3 -0
- data/lib/oci/core/models/update_internet_gateway_details.rb +3 -1
- data/lib/oci/core/models/update_ip_sec_connection_details.rb +1 -0
- data/lib/oci/core/models/update_local_peering_gateway_details.rb +1 -0
- data/lib/oci/core/models/update_private_ip_details.rb +5 -0
- data/lib/oci/core/models/update_route_table_details.rb +4 -0
- data/lib/oci/core/models/update_security_list_details.rb +5 -0
- data/lib/oci/core/models/update_subnet_details.rb +3 -0
- data/lib/oci/core/models/update_vcn_details.rb +3 -0
- data/lib/oci/core/models/update_virtual_circuit_details.rb +7 -0
- data/lib/oci/core/models/update_vnic_details.rb +4 -1
- data/lib/oci/core/models/update_volume_backup_details.rb +3 -0
- data/lib/oci/core/models/update_volume_details.rb +3 -0
- data/lib/oci/core/models/vcn.rb +24 -4
- data/lib/oci/core/models/virtual_circuit.rb +41 -0
- data/lib/oci/core/models/virtual_circuit_bandwidth_shape.rb +5 -1
- data/lib/oci/core/models/virtual_circuit_public_prefix.rb +8 -2
- data/lib/oci/core/models/vnic.rb +38 -9
- data/lib/oci/core/models/vnic_attachment.rb +21 -7
- data/lib/oci/core/models/volume.rb +28 -8
- data/lib/oci/core/models/volume_attachment.rb +25 -8
- data/lib/oci/core/models/volume_backup.rb +26 -5
- data/lib/oci/core/models/volume_source_details.rb +3 -0
- data/lib/oci/core/models/volume_source_from_volume_backup_details.rb +3 -1
- data/lib/oci/core/models/volume_source_from_volume_details.rb +3 -1
- data/lib/oci/core/virtual_network_client.rb +19 -5
- data/lib/oci/database/database_client.rb +19 -5
- data/lib/oci/database/models/backup.rb +13 -0
- data/lib/oci/database/models/backup_summary.rb +13 -0
- data/lib/oci/database/models/create_backup_details.rb +4 -2
- data/lib/oci/database/models/create_data_guard_association_details.rb +18 -4
- data/lib/oci/database/models/create_data_guard_association_to_existing_db_system_details.rb +5 -0
- data/lib/oci/database/models/create_database_details.rb +9 -2
- data/lib/oci/database/models/create_database_from_backup_details.rb +6 -3
- data/lib/oci/database/models/create_db_home_details.rb +5 -1
- data/lib/oci/database/models/create_db_home_with_db_system_id_base.rb +5 -1
- data/lib/oci/database/models/create_db_home_with_db_system_id_details.rb +6 -1
- data/lib/oci/database/models/create_db_home_with_db_system_id_from_backup_details.rb +4 -0
- data/lib/oci/database/models/data_guard_association.rb +32 -7
- data/lib/oci/database/models/data_guard_association_summary.rb +32 -7
- data/lib/oci/database/models/database.rb +22 -5
- data/lib/oci/database/models/database_summary.rb +22 -5
- data/lib/oci/database/models/db_backup_config.rb +5 -1
- data/lib/oci/database/models/db_home.rb +22 -5
- data/lib/oci/database/models/db_home_summary.rb +22 -5
- data/lib/oci/database/models/db_node.rb +17 -5
- data/lib/oci/database/models/db_node_summary.rb +17 -5
- data/lib/oci/database/models/db_system.rb +56 -12
- data/lib/oci/database/models/db_system_shape_summary.rb +11 -2
- data/lib/oci/database/models/db_system_summary.rb +56 -12
- data/lib/oci/database/models/db_version_summary.rb +8 -2
- data/lib/oci/database/models/failover_data_guard_association_details.rb +4 -1
- data/lib/oci/database/models/launch_db_system_details.rb +27 -8
- data/lib/oci/database/models/patch.rb +18 -4
- data/lib/oci/database/models/patch_details.rb +6 -0
- data/lib/oci/database/models/patch_history_entry.rb +12 -4
- data/lib/oci/database/models/patch_history_entry_summary.rb +12 -4
- data/lib/oci/database/models/patch_summary.rb +18 -4
- data/lib/oci/database/models/reinstate_data_guard_association_details.rb +4 -1
- data/lib/oci/database/models/restore_database_details.rb +4 -1
- data/lib/oci/database/models/switchover_data_guard_association_details.rb +4 -1
- data/lib/oci/database/models/update_database_details.rb +1 -0
- data/lib/oci/database/models/update_db_home_details.rb +3 -0
- data/lib/oci/database/models/update_db_system_details.rb +6 -0
- data/lib/oci/identity/identity.rb +3 -0
- data/lib/oci/identity/identity_client.rb +290 -70
- data/lib/oci/identity/models/add_user_to_group_details.rb +4 -2
- data/lib/oci/identity/models/api_key.rb +18 -0
- data/lib/oci/identity/models/availability_domain.rb +6 -0
- data/lib/oci/identity/models/compartment.rb +38 -10
- data/lib/oci/identity/models/create_api_key_details.rb +2 -1
- data/lib/oci/identity/models/create_compartment_details.rb +14 -7
- data/lib/oci/identity/models/create_customer_secret_key_details.rb +2 -1
- data/lib/oci/identity/models/create_dynamic_group_details.rb +160 -0
- data/lib/oci/identity/models/create_group_details.rb +14 -7
- data/lib/oci/identity/models/create_identity_provider_details.rb +19 -9
- data/lib/oci/identity/models/create_idp_group_mapping_details.rb +4 -2
- data/lib/oci/identity/models/create_policy_details.rb +18 -9
- data/lib/oci/identity/models/create_region_subscription_details.rb +2 -1
- data/lib/oci/identity/models/create_saml2_identity_provider_details.rb +10 -2
- data/lib/oci/identity/models/create_swift_password_details.rb +2 -1
- data/lib/oci/identity/models/create_tag_details.rb +12 -6
- data/lib/oci/identity/models/create_tag_namespace_details.rb +14 -7
- data/lib/oci/identity/models/create_user_details.rb +14 -7
- data/lib/oci/identity/models/customer_secret_key.rb +16 -0
- data/lib/oci/identity/models/customer_secret_key_summary.rb +10 -0
- data/lib/oci/identity/models/dynamic_group.rb +239 -0
- data/lib/oci/identity/models/group.rb +35 -11
- data/lib/oci/identity/models/identity_provider.rb +36 -12
- data/lib/oci/identity/models/idp_group_mapping.rb +27 -7
- data/lib/oci/identity/models/policy.rb +38 -11
- data/lib/oci/identity/models/region.rb +10 -0
- data/lib/oci/identity/models/region_subscription.rb +16 -5
- data/lib/oci/identity/models/saml2_identity_provider.rb +20 -3
- data/lib/oci/identity/models/swift_password.rb +17 -1
- data/lib/oci/identity/models/tag.rb +30 -13
- data/lib/oci/identity/models/tag_namespace.rb +25 -11
- data/lib/oci/identity/models/tag_namespace_summary.rb +23 -10
- data/lib/oci/identity/models/tag_summary.rb +21 -8
- data/lib/oci/identity/models/tenancy.rb +21 -4
- data/lib/oci/identity/models/ui_password.rb +10 -0
- data/lib/oci/identity/models/update_compartment_details.rb +10 -4
- data/lib/oci/identity/models/update_customer_secret_key_details.rb +1 -0
- data/lib/oci/identity/models/update_dynamic_group_details.rb +134 -0
- data/lib/oci/identity/models/update_group_details.rb +9 -4
- data/lib/oci/identity/models/update_identity_provider_details.rb +12 -5
- data/lib/oci/identity/models/update_idp_group_mapping_details.rb +2 -0
- data/lib/oci/identity/models/update_policy_details.rb +12 -5
- data/lib/oci/identity/models/update_saml2_identity_provider_details.rb +5 -0
- data/lib/oci/identity/models/update_state_details.rb +2 -1
- data/lib/oci/identity/models/update_swift_password_details.rb +1 -0
- data/lib/oci/identity/models/update_tag_details.rb +15 -7
- data/lib/oci/identity/models/update_tag_namespace_details.rb +15 -7
- data/lib/oci/identity/models/update_user_details.rb +9 -4
- data/lib/oci/identity/models/user.rb +38 -11
- data/lib/oci/identity/models/user_group_membership.rb +16 -6
- data/lib/oci/load_balancer/load_balancer.rb +1 -0
- data/lib/oci/load_balancer/load_balancer_client.rb +24 -9
- data/lib/oci/load_balancer/models/backend.rb +20 -10
- data/lib/oci/load_balancer/models/backend_details.rb +12 -5
- data/lib/oci/load_balancer/models/backend_health.rb +6 -2
- data/lib/oci/load_balancer/models/backend_set.rb +14 -2
- data/lib/oci/load_balancer/models/backend_set_details.rb +11 -1
- data/lib/oci/load_balancer/models/backend_set_health.rb +15 -5
- data/lib/oci/load_balancer/models/certificate.rb +10 -3
- data/lib/oci/load_balancer/models/certificate_details.rb +10 -1
- data/lib/oci/load_balancer/models/connection_configuration.rb +157 -0
- data/lib/oci/load_balancer/models/create_backend_details.rb +15 -5
- data/lib/oci/load_balancer/models/create_backend_set_details.rb +13 -2
- data/lib/oci/load_balancer/models/create_certificate_details.rb +10 -1
- data/lib/oci/load_balancer/models/create_listener_details.rb +28 -5
- data/lib/oci/load_balancer/models/create_load_balancer_details.rb +14 -5
- data/lib/oci/load_balancer/models/health_check_result.rb +10 -4
- data/lib/oci/load_balancer/models/health_checker.rb +15 -4
- data/lib/oci/load_balancer/models/health_checker_details.rb +10 -1
- data/lib/oci/load_balancer/models/ip_address.rb +5 -2
- data/lib/oci/load_balancer/models/listener.rb +28 -5
- data/lib/oci/load_balancer/models/listener_details.rb +23 -4
- data/lib/oci/load_balancer/models/load_balancer.rb +30 -7
- data/lib/oci/load_balancer/models/load_balancer_health.rb +15 -5
- data/lib/oci/load_balancer/models/load_balancer_health_summary.rb +5 -2
- data/lib/oci/load_balancer/models/load_balancer_policy.rb +6 -1
- data/lib/oci/load_balancer/models/load_balancer_protocol.rb +3 -1
- data/lib/oci/load_balancer/models/load_balancer_shape.rb +8 -1
- data/lib/oci/load_balancer/models/session_persistence_configuration_details.rb +14 -2
- data/lib/oci/load_balancer/models/ssl_configuration.rb +11 -4
- data/lib/oci/load_balancer/models/ssl_configuration_details.rb +6 -2
- data/lib/oci/load_balancer/models/update_backend_details.rb +12 -7
- data/lib/oci/load_balancer/models/update_backend_set_details.rb +12 -1
- data/lib/oci/load_balancer/models/update_health_checker_details.rb +16 -7
- data/lib/oci/load_balancer/models/update_listener_details.rb +23 -4
- data/lib/oci/load_balancer/models/update_load_balancer_details.rb +3 -1
- data/lib/oci/load_balancer/models/work_request.rb +20 -6
- data/lib/oci/load_balancer/models/work_request_error.rb +5 -1
- data/lib/oci/object_storage/models/bucket.rb +27 -8
- data/lib/oci/object_storage/models/bucket_summary.rb +16 -6
- data/lib/oci/object_storage/models/commit_multipart_upload_details.rb +7 -1
- data/lib/oci/object_storage/models/commit_multipart_upload_part_details.rb +8 -2
- data/lib/oci/object_storage/models/create_bucket_details.rb +15 -4
- data/lib/oci/object_storage/models/create_multipart_upload_details.rb +10 -1
- data/lib/oci/object_storage/models/create_preauthenticated_request_details.rb +7 -3
- data/lib/oci/object_storage/models/list_objects.rb +8 -1
- data/lib/oci/object_storage/models/multipart_upload.rb +20 -5
- data/lib/oci/object_storage/models/multipart_upload_part_summary.rb +13 -4
- data/lib/oci/object_storage/models/namespace_metadata.rb +8 -3
- data/lib/oci/object_storage/models/object_summary.rb +9 -1
- data/lib/oci/object_storage/models/preauthenticated_request.rb +20 -6
- data/lib/oci/object_storage/models/preauthenticated_request_summary.rb +13 -5
- data/lib/oci/object_storage/models/rename_object_details.rb +11 -2
- data/lib/oci/object_storage/models/restore_objects_details.rb +2 -1
- data/lib/oci/object_storage/models/update_bucket_details.rb +13 -2
- data/lib/oci/object_storage/models/update_namespace_metadata_details.rb +5 -0
- data/lib/oci/object_storage/object_storage_client.rb +26 -12
- data/lib/oci/regions.rb +8 -1
- data/lib/oci/signer.rb +5 -124
- data/lib/oci/version.rb +1 -1
- metadata +31 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38b3af475a0f7eb30b1f26b775ae4121b5fdb7f8
|
4
|
+
data.tar.gz: 245eb1ec30aacc7266559e3f9a8669593282fd30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45e486bdf5f719d842281e33fb05b98433346d786018009abb5d7c9b64b3d19dad1db37fa35d248f215baa5623fc78708e8f2136c6a6072ae075fcea7787c898
|
7
|
+
data.tar.gz: 009fdb794589d0821d5c789e3ea332a2a62acb02f4c7ca3f8a06790442594add8e3af721d97c0c34ec193d6e91a57d97d89e865f53449ed076979705a5caf82f
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Oracle Cloud Infrastructure Ruby SDK
|
2
|
-
**Version 2.0.
|
2
|
+
**Version 2.0.6**
|
3
3
|
|
4
4
|
This topic describes how to install, configure, and use the Oracle Cloud Infrastructure Ruby SDK.
|
5
5
|
|
@@ -66,7 +66,7 @@ To use the Ruby SDK, you must have:
|
|
66
66
|
* An Oracle Cloud Infrastructure account.
|
67
67
|
* A user created in that account, in a group with a policy that grants the desired permissions. This can be a user for yourself, or another person/system that needs to call the API. For an example of how to set up a new user, group, compartment, and policy, see [Adding Users](https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Tasks/addingusers.htm) in the Getting Started Guide. For a list of typical policies you may want to use, see [Common Policies](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/commonpolicies.htm) in the User Guide.
|
68
68
|
* A keypair used for signing API requests, with the public key uploaded to Oracle. Only the user calling the API should be in possession of the private key. See the configuration information below.
|
69
|
-
* Ruby version 2.2 or later running on Mac or
|
69
|
+
* Ruby version 2.2 or later running on Mac, Linux or Windows.
|
70
70
|
|
71
71
|
# Downloading and Installing the Gem File
|
72
72
|
## Installing the SDK
|
data/lib/oci.rb
CHANGED
@@ -9,10 +9,13 @@ require 'oci/internal/internal'
|
|
9
9
|
require 'oci/regions'
|
10
10
|
require 'oci/response_headers'
|
11
11
|
require 'oci/response'
|
12
|
+
require 'oci/base_signer'
|
12
13
|
require 'oci/signer'
|
13
14
|
require 'oci/version'
|
14
15
|
require 'oci/waiter'
|
15
16
|
|
17
|
+
require 'oci/auth/auth'
|
18
|
+
|
16
19
|
require 'oci/audit/audit'
|
17
20
|
require 'oci/core/core'
|
18
21
|
require 'oci/database/database'
|
data/lib/oci/api_client.rb
CHANGED
@@ -57,7 +57,8 @@ module OCI
|
|
57
57
|
def call_api(http_method, path, endpoint, opts, &block)
|
58
58
|
http_method = http_method.to_sym.downcase
|
59
59
|
|
60
|
-
return call_api_inner(http_method, path, endpoint, opts, &block)
|
60
|
+
return call_api_inner(http_method, path, endpoint, opts, &block) if !using_instance_principals? && http_method != :get
|
61
|
+
return instance_principals_signer_wrapped_call { call_api_inner(http_method, path, endpoint, opts, &block) } if using_instance_principals? && http_method != :get
|
61
62
|
|
62
63
|
# Wrap get calls in a lambda that can be called later for paging
|
63
64
|
# and wait_until.
|
@@ -70,7 +71,9 @@ module OCI
|
|
70
71
|
return call_api_inner(http_method, path, endpoint, opts, &block)
|
71
72
|
}
|
72
73
|
|
73
|
-
response = proc.call(nil)
|
74
|
+
response = proc.call(nil) if !using_instance_principals?
|
75
|
+
response = instance_principals_signer_wrapped_call { proc.call(nil) } if using_instance_principals?
|
76
|
+
|
74
77
|
response.api_call = proc
|
75
78
|
response
|
76
79
|
end
|
@@ -238,7 +241,6 @@ module OCI
|
|
238
241
|
rescue Errors::NetworkError, Errors::ServiceError, JSON::ParserError
|
239
242
|
raise
|
240
243
|
rescue => ex
|
241
|
-
puts(ex.inspect)
|
242
244
|
raise Errors::NetworkError.new(ex.message, 0)
|
243
245
|
end
|
244
246
|
end
|
@@ -391,5 +393,24 @@ module OCI
|
|
391
393
|
end
|
392
394
|
end
|
393
395
|
|
396
|
+
def using_instance_principals?
|
397
|
+
@signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
|
398
|
+
end
|
399
|
+
|
400
|
+
def instance_principals_signer_wrapped_call
|
401
|
+
max_attempts = 2
|
402
|
+
|
403
|
+
max_attempts.times do |attempt|
|
404
|
+
begin
|
405
|
+
return yield
|
406
|
+
rescue OCI::Errors::ServiceError => e
|
407
|
+
raise if attempt >= (max_attempts - 1) # .times is zero-based
|
408
|
+
raise if e.status != 401
|
409
|
+
|
410
|
+
@signer.refresh_security_token
|
411
|
+
retry
|
412
|
+
end
|
413
|
+
end
|
414
|
+
end
|
394
415
|
end
|
395
416
|
end
|
@@ -28,15 +28,29 @@ module OCI
|
|
28
28
|
# @param [Config] config A Config object.
|
29
29
|
# @param [String] region A region used to determine the service endpoint. This will usually
|
30
30
|
# correspond to a value in {OCI::Regions::REGION_ENUM}, but may be an arbitrary string.
|
31
|
-
#
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
# @param [OCI::BaseSigner] signer A signer implementation which can be used by this client. If this is not provided then
|
32
|
+
# a signer will be constructed via the provided config. One use case of this parameter is instance principals authentication,
|
33
|
+
# so that the instance principals signer can be provided to the client
|
34
|
+
def initialize(config:nil, region:nil, signer:nil)
|
35
|
+
# If the signer is an InstancePrincipalsSecurityTokenSigner and no config was supplied (which is valid for instance principals)
|
36
|
+
# then create a dummy config to pass to the ApiClient constructor. If customers wish to create a client which uses instance principals
|
37
|
+
# and has config (either populated programmatically or loaded from a file), they must construct that config themselves and then
|
38
|
+
# pass it to this constructor.
|
39
|
+
#
|
40
|
+
# If there is no signer (or the signer is not an instance principals signer) and no config was supplied, this is not valid
|
41
|
+
# so try and load the config from the default file.
|
42
|
+
config ||= OCI.config unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
|
43
|
+
config ||= OCI::Config.new if signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
|
44
|
+
config.validate unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
|
45
|
+
|
46
|
+
if signer.nil?
|
47
|
+
signer = Signer.new(config.user, config.fingerprint, config.tenancy, config.key_file, pass_phrase: config.pass_phrase, private_key_content: config.key_content, signing_strategy: Signer::STANDARD)
|
48
|
+
end
|
35
49
|
|
36
|
-
signer = Signer.new(config.user, config.fingerprint, config.tenancy, config.key_file, pass_phrase: config.pass_phrase, private_key_content: config.key_content, signing_strategy: Signer::STANDARD)
|
37
50
|
@api_client = ApiClient.new(config, signer)
|
38
51
|
|
39
52
|
region ||= config.region
|
53
|
+
region ||= signer.region if signer.respond_to?(:region)
|
40
54
|
self.region = region
|
41
55
|
end
|
42
56
|
|
@@ -83,6 +83,25 @@ module OCI
|
|
83
83
|
|
84
84
|
# Initializes the object
|
85
85
|
# @param [Hash] attributes Model attributes in the form of hash
|
86
|
+
# @option attributes [String] :tenantId The value to assign to the {#tenant_id} property
|
87
|
+
# @option attributes [String] :compartmentId The value to assign to the {#compartment_id} property
|
88
|
+
# @option attributes [String] :eventId The value to assign to the {#event_id} property
|
89
|
+
# @option attributes [String] :eventSource The value to assign to the {#event_source} property
|
90
|
+
# @option attributes [String] :eventType The value to assign to the {#event_type} property
|
91
|
+
# @option attributes [DateTime] :eventTime The value to assign to the {#event_time} property
|
92
|
+
# @option attributes [String] :principalId The value to assign to the {#principal_id} property
|
93
|
+
# @option attributes [String] :credentialId The value to assign to the {#credential_id} property
|
94
|
+
# @option attributes [String] :requestAction The value to assign to the {#request_action} property
|
95
|
+
# @option attributes [String] :requestId The value to assign to the {#request_id} property
|
96
|
+
# @option attributes [String] :requestAgent The value to assign to the {#request_agent} property
|
97
|
+
# @option attributes [Hash<String, Array<String>>] :requestHeaders The value to assign to the {#request_headers} property
|
98
|
+
# @option attributes [String] :requestOrigin The value to assign to the {#request_origin} property
|
99
|
+
# @option attributes [Hash<String, Array<String>>] :requestParameters The value to assign to the {#request_parameters} property
|
100
|
+
# @option attributes [String] :requestResource The value to assign to the {#request_resource} property
|
101
|
+
# @option attributes [Hash<String, Array<String>>] :responseHeaders The value to assign to the {#response_headers} property
|
102
|
+
# @option attributes [String] :responseStatus The value to assign to the {#response_status} property
|
103
|
+
# @option attributes [DateTime] :responseTime The value to assign to the {#response_time} property
|
104
|
+
# @option attributes [Hash<String, Object>] :responsePayload The value to assign to the {#response_payload} property
|
86
105
|
def initialize(attributes = {})
|
87
106
|
return unless attributes.is_a?(Hash)
|
88
107
|
|
@@ -11,6 +11,7 @@ module OCI
|
|
11
11
|
|
12
12
|
# Initializes the object
|
13
13
|
# @param [Hash] attributes Model attributes in the form of hash
|
14
|
+
# @option attributes [Integer] :retentionPeriodDays The value to assign to the {#retention_period_days} property
|
14
15
|
def initialize(attributes = {})
|
15
16
|
return unless attributes.is_a?(Hash)
|
16
17
|
|
@@ -11,6 +11,7 @@ module OCI
|
|
11
11
|
|
12
12
|
# Initializes the object
|
13
13
|
# @param [Hash] attributes Model attributes in the form of hash
|
14
|
+
# @option attributes [Integer] :retentionPeriodDays The value to assign to the {#retention_period_days} property
|
14
15
|
def initialize(attributes = {})
|
15
16
|
return unless attributes.is_a?(Hash)
|
16
17
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
module OCI
|
4
|
+
module Audit
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'oci/auth/federation_client'
|
9
|
+
require 'oci/auth/security_token_container'
|
10
|
+
require 'oci/auth/session_key_supplier'
|
11
|
+
require 'oci/auth/util'
|
12
|
+
require 'oci/auth/url_based_certificate_retriever'
|
13
|
+
|
14
|
+
require 'oci/auth/signers/security_token_signer'
|
15
|
+
require 'oci/auth/signers/x509_federation_client_based_security_token_signer'
|
16
|
+
require 'oci/auth/signers/instance_principals_security_token_signer'
|
@@ -0,0 +1,125 @@
|
|
1
|
+
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'net/http'
|
5
|
+
require 'thread'
|
6
|
+
|
7
|
+
require 'oci/auth/internal/auth_token_request_signer'
|
8
|
+
require 'oci/auth/session_key_supplier'
|
9
|
+
|
10
|
+
module OCI
|
11
|
+
module Auth
|
12
|
+
# A client which can be used to retrieve a token from Auth Service. It needs the following supplied to it:
|
13
|
+
#
|
14
|
+
# * The endpoint for Auth Service
|
15
|
+
# * Our tenancy OCID
|
16
|
+
# * A session key supplier so that we can send its public key as part of the token request. The private key in the session key supplier should be used to sign all requests made with the token
|
17
|
+
# * The certificate (via leaf_certificate_supplier) which will be used to sign the requests to Auth Service.
|
18
|
+
#
|
19
|
+
# Optionally, intermediate certificates (if present) can be supplied as part of the request to Auth Service.
|
20
|
+
#
|
21
|
+
# The client has knowledge of its last requested token and can re-request the token if it is expired (otherwise
|
22
|
+
# it will vend the last requested token if it is not expired).
|
23
|
+
class FederationClient
|
24
|
+
# A supplier which vends a private and public key for signing token requests to Auth Service.
|
25
|
+
# The public key will be sent as part of the token request and the private key should be used to
|
26
|
+
# sign all requests made with the token vended by this client
|
27
|
+
# @return [OCI::Auth::SessionKeySupplier] A supplier which vends a private and public key for signing token requests to Auth Service
|
28
|
+
attr_reader :session_key_supplier
|
29
|
+
|
30
|
+
# Creates a new FederationClient
|
31
|
+
#
|
32
|
+
# @param [String] federation_endpoint The Auth Service endpoint from which to retrieve the token
|
33
|
+
# @param [String] tenancy_id The OCID of the tenancy whose resources will be interacted with by users of the token
|
34
|
+
# @param [OCI::Auth::SessionKeySupplier] session_key_supplier A supplier which vends a private and public key for signing token requests to Auth Service
|
35
|
+
# @param [OCI::Auth::UrlBasedCertificateRetriever] leaf_certificate_supplier The certificate which will be used to sign requests to Auth Service
|
36
|
+
# @param [Array<OCI::Auth::UrlBasedCertificateRetriever>] intermediate_certificate_suppliers An array of retrievers which can be used to fetch intermediate certificates which can be sent as part of the Auth Service request. If not provided, defaults to an empty array
|
37
|
+
# @param [String] cert_bundle_path The full file path to a custom certificate bundle which can be used for SSL verification against the Auth Service endpoint. If not provided (e.g. because a custom bundle is not needed), defaults to nil
|
38
|
+
def initialize(federation_endpoint, tenancy_id, session_key_supplier, leaf_certificate_supplier, intermediate_certificate_suppliers: [], cert_bundle_path: nil)
|
39
|
+
@federation_endpoint = federation_endpoint
|
40
|
+
uri = URI(@federation_endpoint)
|
41
|
+
@federation_http_client = Net::HTTP.new(uri.hostname, uri.port)
|
42
|
+
@federation_http_client.use_ssl = (uri.scheme == 'https')
|
43
|
+
@federation_http_client.ca_file = cert_bundle_path if cert_bundle_path
|
44
|
+
|
45
|
+
@tenancy_id = tenancy_id
|
46
|
+
@session_key_supplier = session_key_supplier
|
47
|
+
@leaf_certificate_supplier = leaf_certificate_supplier
|
48
|
+
@intermediate_certificate_suppliers = intermediate_certificate_suppliers
|
49
|
+
|
50
|
+
@refresh_lock = Mutex.new
|
51
|
+
@security_token = nil
|
52
|
+
end
|
53
|
+
|
54
|
+
# Retrieves a security token, but always asks Auth Service for a new token, regardless of whether or not the previously requested
|
55
|
+
# token is still valid
|
56
|
+
# @return [String] The security token
|
57
|
+
def security_token!
|
58
|
+
refresh_security_token_inner
|
59
|
+
end
|
60
|
+
|
61
|
+
# Retrieves the security token held by the client. If the previously retrieved token is still valid, it is vended
|
62
|
+
# rather than making another request
|
63
|
+
# @return [String] The security token
|
64
|
+
def security_token
|
65
|
+
return @security_token.security_token if @security_token && @security_token.token_valid?
|
66
|
+
refresh_security_token_inner
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
def refresh_security_token_inner
|
71
|
+
@refresh_lock.lock
|
72
|
+
|
73
|
+
@session_key_supplier.refresh
|
74
|
+
@leaf_certificate_supplier.refresh
|
75
|
+
|
76
|
+
updated_tenancy_id = OCI::Auth::Util.get_tenancy_id_from_certificate(@leaf_certificate_supplier.certificate)
|
77
|
+
raise "Unexpected update of tenancy OCID in the leaf certificate. Previous tenancy: #{@tenancy_id}, Updated: #{updated_tenancy_id}" if updated_tenancy_id != @tenancy_id
|
78
|
+
|
79
|
+
@intermediate_certificate_suppliers.each { |supplier| supplier.refresh }
|
80
|
+
|
81
|
+
leaf_certificate_pem = @leaf_certificate_supplier.certificate_pem
|
82
|
+
request_payload = {
|
83
|
+
'certificate': OCI::Auth::Util.sanitize_certificate_string(leaf_certificate_pem),
|
84
|
+
'publicKey': OCI::Auth::Util.sanitize_certificate_string(@session_key_supplier.key_pair[:public_key].to_pem)
|
85
|
+
}
|
86
|
+
|
87
|
+
unless @intermediate_certificate_suppliers.empty?
|
88
|
+
retrieved_certs = []
|
89
|
+
@intermediate_certificate_suppliers.each { |supplier| retrieved_certs << OCI::Auth::Util.sanitize_certificate_string(supplier.certificate_pem) }
|
90
|
+
request_payload['intermediateCertificates'] = retrieved_certs
|
91
|
+
end
|
92
|
+
|
93
|
+
fingerprint = OCI::Auth::Util.colon_separate_fingerprint(OpenSSL::Digest::SHA1.new(@leaf_certificate_supplier.certificate.to_der).to_s)
|
94
|
+
signer = OCI::Auth::Internal::AuthTokenRequestSigner.new(@tenancy_id, fingerprint, @leaf_certificate_supplier.private_key_pem)
|
95
|
+
|
96
|
+
request = Net::HTTP::Post.new(@federation_endpoint)
|
97
|
+
request.body = request_payload.to_json
|
98
|
+
|
99
|
+
header_params = {}
|
100
|
+
signer.sign(:post, @federation_endpoint, header_params, request.body)
|
101
|
+
header_params.each { |key, value| request[key.to_s] = value }
|
102
|
+
|
103
|
+
raw_body = nil
|
104
|
+
@federation_http_client.start do
|
105
|
+
@federation_http_client.request(request) do |response|
|
106
|
+
raw_body = response.body
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
begin
|
111
|
+
parsed_response = JSON.parse(raw_body)
|
112
|
+
raise "No token received in the response from auth service: #{raw_body}" unless parsed_response.has_key?('token')
|
113
|
+
|
114
|
+
@security_token = OCI::Auth::SecurityTokenContainer.new(parsed_response['token'])
|
115
|
+
rescue JSON::ParserError => e
|
116
|
+
raise "Unable to parse response from Auth Service: #{raw_body}"
|
117
|
+
end
|
118
|
+
|
119
|
+
@security_token.security_token
|
120
|
+
ensure
|
121
|
+
@refresh_lock.unlock if @refresh_lock.locked? && @refresh_lock.owned?
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
require 'oci/base_signer'
|
4
|
+
|
5
|
+
module OCI
|
6
|
+
module Auth
|
7
|
+
module Internal
|
8
|
+
# A signer which can sign requests to Auth Service. Not intended for general use
|
9
|
+
class AuthTokenRequestSigner < OCI::BaseSigner
|
10
|
+
def initialize(tenancy_id, fingerprint, private_key_pem)
|
11
|
+
api_key = "#{tenancy_id}/fed-x509/#{fingerprint}"
|
12
|
+
private_key = private_key_pem
|
13
|
+
|
14
|
+
generic_headers = [:"date", :"(request-target)"]
|
15
|
+
super(api_key, private_key, headers_to_sign_in_all_requests: generic_headers)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
require 'jwt'
|
4
|
+
|
5
|
+
module OCI
|
6
|
+
module Auth
|
7
|
+
# A container class which holds the raw token retrieved from Auth Service and its decoded
|
8
|
+
# equivalent
|
9
|
+
class SecurityTokenContainer
|
10
|
+
attr_reader :jwt
|
11
|
+
attr_reader :security_token
|
12
|
+
|
13
|
+
def initialize(security_token, key_pair: nil)
|
14
|
+
@key_pair = key_pair
|
15
|
+
@security_token = security_token
|
16
|
+
@jwt = JWT.decode(@security_token, nil, false)
|
17
|
+
end
|
18
|
+
|
19
|
+
def token_valid?
|
20
|
+
expiration_epoch_seconds = @jwt[0]['exp']
|
21
|
+
return expiration_epoch_seconds > Time.now.to_i
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
require 'openssl'
|
4
|
+
require 'thread'
|
5
|
+
|
6
|
+
module OCI
|
7
|
+
module Auth
|
8
|
+
# A supplier which can vend a public and private key to be used for signing requests
|
9
|
+
class SessionKeySupplier
|
10
|
+
PUBLIC_EXPONENT = 65537 # Ruby docs suggest 3, 17 or 65537
|
11
|
+
def initialize(key_size: 2048)
|
12
|
+
@key_size = key_size
|
13
|
+
@refresh_lock = Mutex.new
|
14
|
+
|
15
|
+
@private_key = OpenSSL::PKey::RSA.generate(@key_size, PUBLIC_EXPONENT)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Retrieves a public key and private key
|
19
|
+
# @return [Hash] A 2 element hash, where the key 'private_key' retrieves the private key and the public key can be retrieved by using the key 'public_key'
|
20
|
+
def key_pair
|
21
|
+
@refresh_lock.lock
|
22
|
+
private_key = @private_key
|
23
|
+
@refresh_lock.unlock
|
24
|
+
|
25
|
+
{'private_key': private_key, 'public_key': private_key.public_key}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Generates a new public and private key
|
29
|
+
def refresh
|
30
|
+
@refresh_lock.lock
|
31
|
+
@private_key = OpenSSL::PKey::RSA.generate(@key_size, PUBLIC_EXPONENT)
|
32
|
+
ensure
|
33
|
+
@refresh_lock.unlock if @refresh_lock.locked? && @refresh_lock.owned?
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
require 'uri'
|
5
|
+
|
6
|
+
require 'oci/auth/session_key_supplier'
|
7
|
+
require 'oci/auth/url_based_certificate_retriever'
|
8
|
+
require 'oci/auth/util'
|
9
|
+
require 'oci/base_signer'
|
10
|
+
require 'oci/regions'
|
11
|
+
|
12
|
+
require_relative 'x509_federation_client_based_security_token_signer'
|
13
|
+
|
14
|
+
module OCI
|
15
|
+
module Auth
|
16
|
+
module Signers
|
17
|
+
# A SecurityTokenSigner which uses a security token for an instance principal. This signer can also
|
18
|
+
# refresh its token as needed.
|
19
|
+
#
|
20
|
+
# This signer is self-sufficient in that its internals know how to source the required information to request and use
|
21
|
+
# the token:
|
22
|
+
#
|
23
|
+
# * Using the metadata endpoint for the instance (http://169.254.169.254/opc/v1) we can discover the region the instance is in, its leaf certificate and any intermediate certificates (for requesting the token) and the tenancy (as) that is in the leaf certificate.
|
24
|
+
# * The signer leverages {OCI::Auth::FederationClient} so it can refresh the security token and also get the private key needed to sign requests (via the client's session_key_supplier)
|
25
|
+
class InstancePrincipalsSecurityTokenSigner < OCI::Auth::Signers::X509FederationClientBasedSecurityTokenSigner
|
26
|
+
# The region the instance is in, as returned from the metadata endpoint for the instance (http://169.254.169.254/opc/v1/instance/region)
|
27
|
+
# @return [String] The region for the instance
|
28
|
+
attr_reader :region
|
29
|
+
|
30
|
+
METADATA_URL_BASE = 'http://169.254.169.254/opc/v1'.freeze
|
31
|
+
GET_REGION_URL = "#{METADATA_URL_BASE}/instance/region".freeze
|
32
|
+
LEAF_CERTIFICATE_URL = "#{METADATA_URL_BASE}/identity/cert.pem".freeze
|
33
|
+
LEAF_CERTIFICATE_PRIVATE_KEY_URL = "#{METADATA_URL_BASE}/identity/key.pem".freeze
|
34
|
+
INTERMEDIATE_CERTIFICATE_URL = "#{METADATA_URL_BASE}/identity/intermediate.pem".freeze
|
35
|
+
|
36
|
+
# Creates a new InstancePrincipalsSecurityTokenSigner
|
37
|
+
#
|
38
|
+
# @param [String] federation_endpoint The endpoint where we will retrieve the instance principals auth token from. If not provided, this will
|
39
|
+
# default to the endpoint which the instance is in
|
40
|
+
# @param [String] federation_client_cert_bundle The full file path to a custom certificate bundle which can be used for SSL verification against the federation_endpoint. If not provided (e.g. because a custom bundle is not needed), defaults to nil
|
41
|
+
# @param [String] signing_strategy Whether this signer is used for Object Storage requests or not. Acceptable values are {OCI::BaseSigner::STANDARD} and {OCI::BaseSigner::OBJECT_STORAGE}. If not provided, defaults to {OCI::BaseSigner::STANDARD}
|
42
|
+
# @param [Array<String>] headers_to_sign_in_all_requests An array of headers which will be signed in each request. If not provided, defaults to {OCI::BaseSigner::GENERIC_HEADERS}
|
43
|
+
# @param [Array<String>] body_headers_to_sign An array of headers which should be signed on requests with bodies. If not provided, defaults to {OCI::BaseSigner::BODY_HEADERS}
|
44
|
+
def initialize(federation_endpoint: nil, federation_client_cert_bundle: nil, signing_strategy: OCI::BaseSigner::STANDARD, headers_to_sign_in_all_requests: OCI::BaseSigner::GENERIC_HEADERS, body_headers_to_sign: OCI::BaseSigner::BODY_HEADERS)
|
45
|
+
@leaf_certificate_retriever = OCI::Auth::UrlBasedCertificateRetriever.new(LEAF_CERTIFICATE_URL, private_key_url: LEAF_CERTIFICATE_PRIVATE_KEY_URL)
|
46
|
+
@intermediate_certificate_retriever = OCI::Auth::UrlBasedCertificateRetriever.new(INTERMEDIATE_CERTIFICATE_URL)
|
47
|
+
@session_key_supplier = OCI::Auth::SessionKeySupplier.new
|
48
|
+
@tenancy_id = OCI::Auth::Util.get_tenancy_id_from_certificate(@leaf_certificate_retriever.certificate)
|
49
|
+
|
50
|
+
raw_region = Net::HTTP.get(URI(GET_REGION_URL)).strip
|
51
|
+
symbolised_raw_region = raw_region.to_sym
|
52
|
+
if OCI::Regions::REGION_SHORT_NAMES_TO_LONG_NAMES.has_key?(symbolised_raw_region)
|
53
|
+
@region = OCI::Regions::REGION_SHORT_NAMES_TO_LONG_NAMES[symbolised_raw_region]
|
54
|
+
else
|
55
|
+
@region = raw_region
|
56
|
+
end
|
57
|
+
|
58
|
+
if federation_endpoint
|
59
|
+
@federation_endpoint = federation_endpoint
|
60
|
+
else
|
61
|
+
@federation_endpoint = "#{OCI::Regions.get_service_endpoint(@region, :Auth)}/v1/x509"
|
62
|
+
end
|
63
|
+
|
64
|
+
@federation_client = OCI::Auth::FederationClient.new(
|
65
|
+
@federation_endpoint,
|
66
|
+
@tenancy_id,
|
67
|
+
@session_key_supplier,
|
68
|
+
@leaf_certificate_retriever,
|
69
|
+
intermediate_certificate_suppliers: [@intermediate_certificate_retriever],
|
70
|
+
cert_bundle_path: federation_client_cert_bundle
|
71
|
+
)
|
72
|
+
|
73
|
+
super(
|
74
|
+
@federation_client,
|
75
|
+
signing_strategy: signing_strategy,
|
76
|
+
headers_to_sign_in_all_requests: headers_to_sign_in_all_requests,
|
77
|
+
body_headers_to_sign: body_headers_to_sign
|
78
|
+
)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|