From 27c3c092d29c7e3c443092b117bce964405a9bd0 Mon Sep 17 00:00:00 2001 From: Peng Liu Date: Sat, 28 Aug 2021 00:53:34 +0000 Subject: [PATCH] Releasing Version 46.2.0 Squashed commit of the following: commit 16ab46cb1e40cc9e15e2fa3616d9e83dacce1855 Author: pelliu Date: Sat Aug 28 00:19:44 2021 +0000 Releasing version 46 2 0 --- CHANGELOG.md | 5 + Makefile | 4 + common/common.go | 154 -- common/regions.go | 160 ++ common/retry.go | 807 ++++++++- common/retry_test.go | 1467 +++++++++++++++-- common/version.go | 2 +- ...attach_catalog_private_endpoint_details.go | 1 + datacatalog/attribute.go | 1 + datacatalog/attribute_collection.go | 1 + datacatalog/attribute_summary.go | 11 + datacatalog/attribute_tag.go | 1 + datacatalog/attribute_tag_collection.go | 1 + datacatalog/attribute_tag_summary.go | 1 + datacatalog/base_permissions_summary.go | 1 + datacatalog/base_tag.go | 1 + datacatalog/base_tag_summary.go | 1 + datacatalog/catalog.go | 1 + datacatalog/catalog_permissions_summary.go | 1 + datacatalog/catalog_private_endpoint.go | 1 + .../catalog_private_endpoint_summary.go | 1 + datacatalog/catalog_summary.go | 1 + .../change_catalog_compartment_details.go | 1 + ...og_private_endpoint_compartment_details.go | 1 + .../change_metastore_compartment_details.go | 1 + datacatalog/connection.go | 1 + datacatalog/connection_alias_summary.go | 1 + datacatalog/connection_collection.go | 1 + datacatalog/connection_result.go | 1 + datacatalog/connection_summary.go | 1 + datacatalog/create_attribute_details.go | 1 + datacatalog/create_catalog_details.go | 1 + ...create_catalog_private_endpoint_details.go | 1 + datacatalog/create_connection_details.go | 1 + datacatalog/create_custom_property_details.go | 1 + datacatalog/create_data_asset_details.go | 1 + datacatalog/create_entity_details.go | 1 + datacatalog/create_folder_details.go | 1 + datacatalog/create_glossary_details.go | 1 + datacatalog/create_job_definition_details.go | 1 + datacatalog/create_job_details.go | 1 + datacatalog/create_job_execution_details.go | 1 + datacatalog/create_metastore_details.go | 1 + datacatalog/create_namespace_details.go | 1 + datacatalog/create_pattern_details.go | 1 + datacatalog/create_tag_details.go | 1 + datacatalog/create_term_details.go | 1 + .../create_term_relationship_details.go | 1 + datacatalog/custom_property.go | 6 +- datacatalog/custom_property_collection.go | 1 + datacatalog/custom_property_data_type.go | 1 + datacatalog/custom_property_get_usage.go | 1 + datacatalog/custom_property_set_usage.go | 1 + datacatalog/custom_property_summary.go | 4 + datacatalog/custom_property_type_usage.go | 1 + datacatalog/data_asset.go | 1 + datacatalog/data_asset_collection.go | 1 + datacatalog/data_asset_export_scope.go | 1 + .../data_asset_import_export_type_filter.go | 1 + datacatalog/data_asset_permissions_summary.go | 1 + datacatalog/data_asset_summary.go | 1 + datacatalog/data_asset_tag.go | 1 + datacatalog/data_asset_tag_collection.go | 1 + datacatalog/data_asset_tag_summary.go | 1 + datacatalog/data_selector_pattern_details.go | 1 + datacatalog/datacatalog_client.go | 1 + datacatalog/derived_logical_entities.go | 1 + ...detach_catalog_private_endpoint_details.go | 1 + datacatalog/entity.go | 1 + datacatalog/entity_collection.go | 1 + datacatalog/entity_summary.go | 1 + datacatalog/entity_tag.go | 1 + datacatalog/entity_tag_collection.go | 1 + datacatalog/entity_tag_summary.go | 1 + datacatalog/event_config.go | 51 + datacatalog/event_config_status.go | 34 + datacatalog/export_data_asset_details.go | 1 + datacatalog/faceted_search_aggregation.go | 1 + datacatalog/faceted_search_custom_property.go | 1 + .../faceted_search_date_filter_request.go | 1 + datacatalog/faceted_search_filter_request.go | 1 + datacatalog/faceted_search_sort_request.go | 1 + .../faceted_search_string_filter_request.go | 1 + datacatalog/folder.go | 1 + datacatalog/folder_collection.go | 1 + datacatalog/folder_summary.go | 1 + datacatalog/folder_tag.go | 1 + datacatalog/folder_tag_collection.go | 1 + datacatalog/folder_tag_summary.go | 1 + datacatalog/glossary.go | 1 + datacatalog/glossary_collection.go | 1 + datacatalog/glossary_permissions_summary.go | 1 + datacatalog/glossary_summary.go | 1 + datacatalog/glossary_tree_element.go | 1 + datacatalog/harvest_status.go | 1 + datacatalog/import_connection_details.go | 1 + datacatalog/import_data_asset_details.go | 1 + datacatalog/import_data_asset_job_result.go | 1 + datacatalog/import_glossary_details.go | 1 + datacatalog/job.go | 1 + datacatalog/job_collection.go | 1 + datacatalog/job_definition.go | 1 + datacatalog/job_definition_collection.go | 1 + .../job_definition_permissions_summary.go | 1 + datacatalog/job_definition_scope.go | 1 + datacatalog/job_definition_summary.go | 1 + datacatalog/job_execution.go | 1 + datacatalog/job_execution_collection.go | 1 + datacatalog/job_execution_state.go | 1 + datacatalog/job_execution_summary.go | 1 + datacatalog/job_lifecycle_state.go | 1 + datacatalog/job_log.go | 1 + datacatalog/job_log_collection.go | 1 + datacatalog/job_log_summary.go | 1 + datacatalog/job_metric.go | 1 + datacatalog/job_metric_collection.go | 1 + datacatalog/job_metric_summary.go | 1 + datacatalog/job_schedule_type.go | 1 + datacatalog/job_summary.go | 1 + datacatalog/job_type.go | 1 + datacatalog/lifecycle_state.go | 1 + .../list_attributes_request_response.go | 6 +- ...list_custom_properties_request_response.go | 86 +- datacatalog/metastore.go | 1 + datacatalog/metastore_summary.go | 1 + datacatalog/model_type.go | 7 + datacatalog/namespace.go | 1 + datacatalog/namespace_collection.go | 1 + datacatalog/namespace_summary.go | 1 + datacatalog/object_relationship.go | 10 + datacatalog/parse_connection_details.go | 10 +- datacatalog/pattern.go | 1 + datacatalog/pattern_collection.go | 1 + datacatalog/pattern_summary.go | 1 + datacatalog/process_recommendation_details.go | 1 + datacatalog/property_definition.go | 1 + datacatalog/recommendation_collection.go | 1 + datacatalog/recommendation_details.go | 1 + datacatalog/recommendation_resource_type.go | 1 + datacatalog/recommendation_status.go | 1 + datacatalog/recommendation_type.go | 1 + datacatalog/rule_attribute.go | 1 + datacatalog/rule_collection.go | 1 + datacatalog/rule_origin_type.go | 1 + datacatalog/rule_summary.go | 1 + datacatalog/rule_type.go | 1 + datacatalog/search_criteria.go | 1 + datacatalog/search_result.go | 1 + datacatalog/search_result_collection.go | 1 + datacatalog/search_tag_summary.go | 1 + datacatalog/search_term_summary.go | 1 + datacatalog/suggest_list_item.go | 1 + datacatalog/suggest_results.go | 1 + datacatalog/term.go | 1 + datacatalog/term_associated_object.go | 1 + datacatalog/term_collection.go | 1 + datacatalog/term_relationship.go | 1 + datacatalog/term_relationship_collection.go | 1 + datacatalog/term_relationship_summary.go | 1 + datacatalog/term_summary.go | 1 + datacatalog/term_workflow_status.go | 1 + datacatalog/type_collection.go | 1 + datacatalog/type_custom_property_details.go | 1 + datacatalog/type_summary.go | 7 + datacatalog/update_attribute_details.go | 1 + datacatalog/update_catalog_details.go | 1 + ...update_catalog_private_endpoint_details.go | 1 + datacatalog/update_connection_details.go | 1 + datacatalog/update_custom_property_details.go | 1 + datacatalog/update_data_asset_details.go | 1 + datacatalog/update_entity_details.go | 1 + datacatalog/update_folder_details.go | 1 + datacatalog/update_glossary_details.go | 1 + datacatalog/update_job_definition_details.go | 1 + datacatalog/update_job_details.go | 1 + datacatalog/update_metastore_details.go | 1 + datacatalog/update_namespace_details.go | 1 + datacatalog/update_pattern_details.go | 1 + datacatalog/update_term_details.go | 1 + .../update_term_relationship_details.go | 1 + datacatalog/upload_credentials_details.go | 1 + datacatalog/validate_connection_details.go | 1 + datacatalog/validate_connection_result.go | 1 + datacatalog/validate_pattern_details.go | 1 + datacatalog/validate_pattern_result.go | 1 + datacatalog/work_request.go | 1 + datacatalog/work_request_error.go | 1 + datacatalog/work_request_log.go | 1 + datacatalog/work_request_resource.go | 1 + example/example_change_compartment_test.go | 1 - ...entually_consistent_retry_behavior_test.go | 280 ++++ example/example_retry_test.go | 204 ++- example/helpers/helper.go | 20 +- go.sum | 1 + identity/identity_client.go | 52 + objectstorage/transfer/upload_manager.go | 12 +- .../transfer/upload_manager_req_resp.go | 9 +- osmanagement/autonomous_settings.go | 26 + osmanagement/content_availability.go | 40 + .../crash_event_system_information.go | 44 + .../delete_event_content_request_response.go | 90 + osmanagement/event.go | 181 ++ osmanagement/event_collection.go | 26 + osmanagement/event_content.go | 32 + osmanagement/event_report.go | 26 + osmanagement/event_summary.go | 53 + osmanagement/event_type.go | 50 + .../get_event_content_request_response.go | 83 + .../get_event_report_request_response.go | 83 + osmanagement/get_event_request_response.go | 82 + .../get_managed_instance_request_response.go | 3 + ...es_on_managed_instance_request_response.go | 34 + ...managed_instance_group_request_response.go | 115 ++ ...es_on_managed_instance_request_response.go | 34 + osmanagement/kernel_crash_event.go | 142 ++ osmanagement/kernel_oops_event.go | 142 ++ osmanagement/kernel_vm_core_information.go | 29 + osmanagement/list_events_request_response.go | 193 +++ .../list_related_events_request_response.go | 150 ++ .../list_scheduled_jobs_request_response.go | 3 + osmanagement/managed_instance.go | 12 + osmanagement/osmanagement_client.go | 115 ++ osmanagement/osmanagement_event_client.go | 530 ++++++ osmanagement/package_update_types.go | 4 + osmanagement/related_event_collection.go | 26 + osmanagement/related_event_summary.go | 32 + osmanagement/scheduled_job.go | 3 + osmanagement/scheduled_job_summary.go | 3 + osmanagement/software_package_dependency.go | 2 +- osmanagement/update_event_details.go | 31 + osmanagement/update_event_request_response.go | 92 ++ .../update_managed_instance_details.go | 29 + ...pdate_managed_instance_request_response.go | 86 + .../upload_event_content_request_response.go | 90 + 234 files changed, 5924 insertions(+), 373 deletions(-) create mode 100644 common/regions.go create mode 100644 datacatalog/event_config.go create mode 100644 datacatalog/event_config_status.go create mode 100644 example/example_eventually_consistent_retry_behavior_test.go create mode 100644 osmanagement/autonomous_settings.go create mode 100644 osmanagement/content_availability.go create mode 100644 osmanagement/crash_event_system_information.go create mode 100644 osmanagement/delete_event_content_request_response.go create mode 100644 osmanagement/event.go create mode 100644 osmanagement/event_collection.go create mode 100644 osmanagement/event_content.go create mode 100644 osmanagement/event_report.go create mode 100644 osmanagement/event_summary.go create mode 100644 osmanagement/event_type.go create mode 100644 osmanagement/get_event_content_request_response.go create mode 100644 osmanagement/get_event_report_request_response.go create mode 100644 osmanagement/get_event_request_response.go create mode 100644 osmanagement/install_all_updates_on_managed_instance_group_request_response.go create mode 100644 osmanagement/kernel_crash_event.go create mode 100644 osmanagement/kernel_oops_event.go create mode 100644 osmanagement/kernel_vm_core_information.go create mode 100644 osmanagement/list_events_request_response.go create mode 100644 osmanagement/list_related_events_request_response.go create mode 100644 osmanagement/osmanagement_event_client.go create mode 100644 osmanagement/related_event_collection.go create mode 100644 osmanagement/related_event_summary.go create mode 100644 osmanagement/update_event_details.go create mode 100644 osmanagement/update_event_request_response.go create mode 100644 osmanagement/update_managed_instance_details.go create mode 100644 osmanagement/update_managed_instance_request_response.go create mode 100644 osmanagement/upload_event_content_request_response.go diff --git a/CHANGELOG.md b/CHANGELOG.md index b79006d342..0591861a9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) +## 46.2.0 - 2021-08-31 +### Added +- Support for Oracle Analytics Cloud and OCI Vault integration on connections in the Data Catalog service +- Support for critical event monitoring in the OS Management service + ## 46.1.0 - 2021-08-24 ### Added - Support for generating recommended VM cluster networks in the Database service diff --git a/Makefile b/Makefile index 7c8678eab8..afe20b6f1a 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ TARGETS_BUILD = $(patsubst %,build-%, $(TARGETS)) TARGETS_CLEAN = $(patsubst %,clean-%, $(GEN_TARGETS)) TARGETS_LINT = $(patsubst %,lint-%, $(TARGETS)) TARGETS_TEST = $(patsubst %,test-%, $(TARGETS_WITH_TESTS)) +TARGETS_TESTFILTERED = $(patsubst %,testfiltered-%, $(TARGETS_WITH_TESTS)) TARGETS_INTEG_TEST = $(patsubst %,test-%, $(TARGETS_WITH_INTEG_TESTS)) TARGETS_RELEASE= $(patsubst %,release-%, $(TARGETS)) GOLINT=$(GOPATH)/bin/golint @@ -59,6 +60,9 @@ $(TARGETS_BUILD): build-%:% $(TARGETS_TEST): test-%:% @(cd $< && go test -v) +$(TARGETS_TESTFILTERED): testfiltered-%:% + @(cd $< && go test -v -run $(TEST_NAME)) + $(TARGETS_INTEG_TEST): test-%:% @(cd $< && go test -v) diff --git a/common/common.go b/common/common.go index d08f732378..773ad4f700 100644 --- a/common/common.go +++ b/common/common.go @@ -21,79 +21,6 @@ type Region string const ( instanceMetadataRegionInfoURLV2 = "http://169.254.169.254/opc/v2/instance/regionInfo" - //RegionSEA region SEA - RegionSEA Region = "sea" - //RegionCAToronto1 region for Toronto - RegionCAToronto1 Region = "ca-toronto-1" - //RegionCAMontreal1 region for Montreal - RegionCAMontreal1 Region = "ca-montreal-1" - //RegionPHX region PHX - RegionPHX Region = "us-phoenix-1" - //RegionIAD region IAD - RegionIAD Region = "us-ashburn-1" - //RegionSJC1 region SJC - RegionSJC1 Region = "us-sanjose-1" - - //RegionFRA region FRA - RegionFRA Region = "eu-frankfurt-1" - - //RegionUKCardiff1 region for Cardiff - RegionUKCardiff1 Region = "uk-cardiff-1" - //RegionLHR region LHR - RegionLHR Region = "uk-london-1" - - //RegionAPTokyo1 region for Tokyo - RegionAPTokyo1 Region = "ap-tokyo-1" - //RegionAPOsaka1 region for Osaka - RegionAPOsaka1 Region = "ap-osaka-1" - //RegionAPChiyoda1 region for Chiyoda - RegionAPChiyoda1 Region = "ap-chiyoda-1" - //RegionAPSeoul1 region for Seoul - RegionAPSeoul1 Region = "ap-seoul-1" - //RegionAPChuncheon1 region for Chuncheon - RegionAPChuncheon1 Region = "ap-chuncheon-1" - //RegionAPMumbai1 region for Mumbai - RegionAPMumbai1 Region = "ap-mumbai-1" - //RegionAPHyderabad1 region for Hyderabad - RegionAPHyderabad1 Region = "ap-hyderabad-1" - //RegionAPMelbourne1 region for Melbourne - RegionAPMelbourne1 Region = "ap-melbourne-1" - //RegionAPSydney1 region for Sydney - RegionAPSydney1 Region = "ap-sydney-1" - - //RegionMEJeddah1 region for Jeddah - RegionMEJeddah1 Region = "me-jeddah-1" - //RegionMEDubai1 region for Dubai - RegionMEDubai1 Region = "me-dubai-1" - - //RegionEUZurich1 region for Zurich - RegionEUZurich1 Region = "eu-zurich-1" - //RegionEUAmsterdam1 region for Amsterdam - RegionEUAmsterdam1 Region = "eu-amsterdam-1" - - //RegionSASaopaulo1 region for Sao Paulo - RegionSASaopaulo1 Region = "sa-saopaulo-1" - //RegionSASantiago1 region for santiago - RegionSASantiago1 Region = "sa-santiago-1" - //RegionSAVinhedo1 region for vinhedo - RegionSAVinhedo1 Region = "sa-vinhedo-1" - - //RegionUSLangley1 region for Langley - RegionUSLangley1 Region = "us-langley-1" - //RegionUSLuke1 region for Luke - RegionUSLuke1 Region = "us-luke-1" - - //RegionUSGovAshburn1 gov region Ashburn - RegionUSGovAshburn1 Region = "us-gov-ashburn-1" - //RegionUSGovChicago1 gov region Chicago - RegionUSGovChicago1 Region = "us-gov-chicago-1" - //RegionUSGovPhoenix1 region for Phoenix - RegionUSGovPhoenix1 Region = "us-gov-phoenix-1" - //RegionUKGovLondon1 gov region London - RegionUKGovLondon1 Region = "uk-gov-london-1" - //RegionUKGovCardiff1 gov region Cardiff - RegionUKGovCardiff1 Region = "uk-gov-cardiff-1" - // Region Metadata Configuration File regionMetadataCfgDirName = ".oci" regionMetadataCfgFileName = "regions-config.json" @@ -108,87 +35,6 @@ const ( regionKeyPropertyName = "regionKey" // e.g. "SYD" ) -var shortNameRegion = map[string]Region{ - "sea": RegionSEA, - "phx": RegionPHX, - "iad": RegionIAD, - "fra": RegionFRA, - "lhr": RegionLHR, - "cwl": RegionUKCardiff1, - "ams": RegionEUAmsterdam1, - "zrh": RegionEUZurich1, - "mel": RegionAPMelbourne1, - "bom": RegionAPMumbai1, - "hyd": RegionAPHyderabad1, - "icn": RegionAPSeoul1, - "yny": RegionAPChuncheon1, - "nrt": RegionAPTokyo1, - "kix": RegionAPOsaka1, - "nja": RegionAPChiyoda1, - "jed": RegionMEJeddah1, - "dxb": RegionMEDubai1, - "syd": RegionAPSydney1, - "yul": RegionCAMontreal1, - "yyz": RegionCAToronto1, - "sjc": RegionSJC1, - "gru": RegionSASaopaulo1, - "scl": RegionSASantiago1, - "vcp": RegionSAVinhedo1, - "ltn": RegionUKGovLondon1, - "brs": RegionUKGovCardiff1, -} - -var realm = map[string]string{ - "oc1": "oraclecloud.com", - "oc2": "oraclegovcloud.com", - "oc3": "oraclegovcloud.com", - "oc4": "oraclegovcloud.uk", - "oc8": "oraclecloud8.com", -} - -var regionRealm = map[Region]string{ - RegionPHX: "oc1", - RegionIAD: "oc1", - RegionFRA: "oc1", - RegionLHR: "oc1", - RegionSJC1: "oc1", - - RegionUKCardiff1: "oc1", - - RegionCAToronto1: "oc1", - RegionCAMontreal1: "oc1", - - RegionAPTokyo1: "oc1", - RegionAPOsaka1: "oc1", - RegionAPSeoul1: "oc1", - RegionAPChuncheon1: "oc1", - RegionAPSydney1: "oc1", - RegionAPMumbai1: "oc1", - RegionAPHyderabad1: "oc1", - RegionAPMelbourne1: "oc1", - - RegionMEJeddah1: "oc1", - RegionMEDubai1: "oc1", - - RegionEUZurich1: "oc1", - RegionEUAmsterdam1: "oc1", - - RegionSASaopaulo1: "oc1", - RegionSASantiago1: "oc1", - RegionSAVinhedo1: "oc1", - - RegionUSLangley1: "oc2", - RegionUSLuke1: "oc2", - - RegionUSGovAshburn1: "oc3", - RegionUSGovChicago1: "oc3", - RegionUSGovPhoenix1: "oc3", - RegionUKGovCardiff1: "oc4", - RegionUKGovLondon1: "oc4", - - RegionAPChiyoda1: "oc8", -} - // External region metadata info flag, used to control adding these metadata region info only once. var readCfgFile, readEnvVar, visitIMDS bool = true, true, false diff --git a/common/regions.go b/common/regions.go new file mode 100644 index 0000000000..c1539c1fa1 --- /dev/null +++ b/common/regions.go @@ -0,0 +1,160 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. + +package common + +const ( + //RegionSEA region SEA + RegionSEA Region = "sea" + //RegionCAToronto1 region for Toronto + RegionCAToronto1 Region = "ca-toronto-1" + //RegionCAMontreal1 region for Montreal + RegionCAMontreal1 Region = "ca-montreal-1" + //RegionPHX region PHX + RegionPHX Region = "us-phoenix-1" + //RegionIAD region IAD + RegionIAD Region = "us-ashburn-1" + //RegionSJC1 region SJC + RegionSJC1 Region = "us-sanjose-1" + + //RegionFRA region FRA + RegionFRA Region = "eu-frankfurt-1" + + //RegionUKCardiff1 region for Cardiff + RegionUKCardiff1 Region = "uk-cardiff-1" + //RegionLHR region LHR + RegionLHR Region = "uk-london-1" + + //RegionAPTokyo1 region for Tokyo + RegionAPTokyo1 Region = "ap-tokyo-1" + //RegionAPOsaka1 region for Osaka + RegionAPOsaka1 Region = "ap-osaka-1" + //RegionAPChiyoda1 region for Chiyoda + RegionAPChiyoda1 Region = "ap-chiyoda-1" + //RegionAPSeoul1 region for Seoul + RegionAPSeoul1 Region = "ap-seoul-1" + //RegionAPChuncheon1 region for Chuncheon + RegionAPChuncheon1 Region = "ap-chuncheon-1" + //RegionAPMumbai1 region for Mumbai + RegionAPMumbai1 Region = "ap-mumbai-1" + //RegionAPHyderabad1 region for Hyderabad + RegionAPHyderabad1 Region = "ap-hyderabad-1" + //RegionAPMelbourne1 region for Melbourne + RegionAPMelbourne1 Region = "ap-melbourne-1" + //RegionAPSydney1 region for Sydney + RegionAPSydney1 Region = "ap-sydney-1" + + //RegionMEJeddah1 region for Jeddah + RegionMEJeddah1 Region = "me-jeddah-1" + //RegionMEDubai1 region for Dubai + RegionMEDubai1 Region = "me-dubai-1" + + //RegionEUZurich1 region for Zurich + RegionEUZurich1 Region = "eu-zurich-1" + //RegionEUAmsterdam1 region for Amsterdam + RegionEUAmsterdam1 Region = "eu-amsterdam-1" + + //RegionSASaopaulo1 region for Sao Paulo + RegionSASaopaulo1 Region = "sa-saopaulo-1" + //RegionSASantiago1 region for santiago + RegionSASantiago1 Region = "sa-santiago-1" + //RegionSAVinhedo1 region for vinhedo + RegionSAVinhedo1 Region = "sa-vinhedo-1" + + //RegionUSLangley1 region for Langley + RegionUSLangley1 Region = "us-langley-1" + //RegionUSLuke1 region for Luke + RegionUSLuke1 Region = "us-luke-1" + + //RegionUSGovAshburn1 gov region Ashburn + RegionUSGovAshburn1 Region = "us-gov-ashburn-1" + //RegionUSGovChicago1 gov region Chicago + RegionUSGovChicago1 Region = "us-gov-chicago-1" + //RegionUSGovPhoenix1 region for Phoenix + RegionUSGovPhoenix1 Region = "us-gov-phoenix-1" + //RegionUKGovLondon1 gov region London + RegionUKGovLondon1 Region = "uk-gov-london-1" + //RegionUKGovCardiff1 gov region Cardiff + RegionUKGovCardiff1 Region = "uk-gov-cardiff-1" +) + +var shortNameRegion = map[string]Region{ + "sea": RegionSEA, + "phx": RegionPHX, + "iad": RegionIAD, + "fra": RegionFRA, + "lhr": RegionLHR, + "cwl": RegionUKCardiff1, + "ams": RegionEUAmsterdam1, + "zrh": RegionEUZurich1, + "mel": RegionAPMelbourne1, + "bom": RegionAPMumbai1, + "hyd": RegionAPHyderabad1, + "icn": RegionAPSeoul1, + "yny": RegionAPChuncheon1, + "nrt": RegionAPTokyo1, + "kix": RegionAPOsaka1, + "nja": RegionAPChiyoda1, + "jed": RegionMEJeddah1, + "dxb": RegionMEDubai1, + "syd": RegionAPSydney1, + "yul": RegionCAMontreal1, + "yyz": RegionCAToronto1, + "sjc": RegionSJC1, + "gru": RegionSASaopaulo1, + "scl": RegionSASantiago1, + "vcp": RegionSAVinhedo1, + "ltn": RegionUKGovLondon1, + "brs": RegionUKGovCardiff1, +} + +var realm = map[string]string{ + "oc1": "oraclecloud.com", + "oc2": "oraclegovcloud.com", + "oc3": "oraclegovcloud.com", + "oc4": "oraclegovcloud.uk", + "oc8": "oraclecloud8.com", +} + +var regionRealm = map[Region]string{ + RegionPHX: "oc1", + RegionIAD: "oc1", + RegionFRA: "oc1", + RegionLHR: "oc1", + RegionSJC1: "oc1", + + RegionUKCardiff1: "oc1", + + RegionCAToronto1: "oc1", + RegionCAMontreal1: "oc1", + + RegionAPTokyo1: "oc1", + RegionAPOsaka1: "oc1", + RegionAPSeoul1: "oc1", + RegionAPChuncheon1: "oc1", + RegionAPSydney1: "oc1", + RegionAPMumbai1: "oc1", + RegionAPHyderabad1: "oc1", + RegionAPMelbourne1: "oc1", + + RegionMEJeddah1: "oc1", + RegionMEDubai1: "oc1", + + RegionEUZurich1: "oc1", + RegionEUAmsterdam1: "oc1", + + RegionSASaopaulo1: "oc1", + RegionSASantiago1: "oc1", + RegionSAVinhedo1: "oc1", + + RegionUSLangley1: "oc2", + RegionUSLuke1: "oc2", + + RegionUSGovAshburn1: "oc3", + RegionUSGovChicago1: "oc3", + RegionUSGovPhoenix1: "oc3", + RegionUKGovCardiff1: "oc4", + RegionUKGovLondon1: "oc4", + + RegionAPChiyoda1: "oc8", +} diff --git a/common/retry.go b/common/retry.go index bf0d913e91..9cb370f237 100644 --- a/common/retry.go +++ b/common/retry.go @@ -5,11 +5,15 @@ package common import ( "context" + "errors" "fmt" "io" "math" "math/rand" "runtime" + "strings" + "sync" + "sync/atomic" "time" ) @@ -46,17 +50,155 @@ type OCIOperationResponse struct { // Operation Attempt Number (one-based) AttemptNumber uint + + // End of eventually consistent effects, or nil if no such effects + EndOfWindowTime *time.Time + + // Backoff scaling factor (only used for dealing with eventual consistency) + BackoffScalingFactor float64 + + // Time of the initial attempt + InitialAttemptTime time.Time +} + +// EventuallyConsistentContext contains the information about the end of the eventually consistent window. +type EventuallyConsistentContext struct { + endOfWindow atomic.Value + lock sync.Mutex + timeNowProvider func() time.Time +} + +// GetEndOfWindow returns the end time an eventually consistent window, +// or nil if no eventually consistent requests were made +func (e *EventuallyConsistentContext) GetEndOfWindow() *time.Time { + untyped := e.endOfWindow.Load() // returns nil if there has been no call to Store for this Value + if untyped == nil { + return (*time.Time)(nil) + } + t := untyped.(*time.Time) + return t +} + +// UpdateEndOfWindow sets the end time of the eventually consistent window the specified +// duration into the future +func (e *EventuallyConsistentContext) UpdateEndOfWindow(windowSize time.Duration) *time.Time { + e.lock.Lock() // synchronize with other potential writers + defer e.lock.Unlock() + currentEndOfWindowTime := e.GetEndOfWindow() + var newEndOfWindowTime = e.timeNowProvider().Add(windowSize) + if currentEndOfWindowTime == nil || newEndOfWindowTime.After(*currentEndOfWindowTime) { + e.endOfWindow.Store(&newEndOfWindowTime) // atomically replace the current object with the new one + return &newEndOfWindowTime + } + return currentEndOfWindowTime +} + +// setEndTimeOfEventuallyConsistentWindow sets the last time an eventually consistent request was made +// to the specified time +func (e *EventuallyConsistentContext) setEndOfWindow(newTime *time.Time) *time.Time { + e.lock.Lock() // synchronize with other potential writers + defer e.lock.Unlock() + e.endOfWindow.Store(newTime) // atomically replace the current object with the new one + return newTime +} + +// EcContext contains the information about the end of the eventually consistent window for this process. +var EcContext = EventuallyConsistentContext{ + timeNowProvider: func() time.Time { return time.Now() }, +} + +type httpStatus struct { + code int + message string +} + +const ( + defaultMaximumNumberAttempts = uint(8) + defaultExponentialBackoffBase = 2.0 + defaultMinSleepBetween = 0.0 + defaultMaxSleepBetween = 30.0 + + ecMaximumNumberAttempts = uint(9) + ecExponentialBackoffBase = 3.52 + ecMinSleepBetween = 0.0 + ecMaxSleepBetween = 45.0 +) + +var ( + defaultRetryStatusCodeMap = map[httpStatus]bool{ + {409, "IncorrectState"}: true, + {429, "TooManyRequests"}: true, + + {501, "MethodNotImplemented"}: false, + } + affectedByEventualConsistencyRetryStatusCodeMap = map[httpStatus]bool{ + {400, "RelatedResourceNotAuthorizedOrNotFound"}: true, + {404, "NotAuthorizedOrNotFound"}: true, + {409, "NotAuthorizedOrResourceAlreadyExists"}: true, + } +) + +// IsErrorAffectedByEventualConsistency returns true if the error is affected by eventual consistency. +func IsErrorAffectedByEventualConsistency(Error error) bool { + if err, ok := IsServiceError(Error); ok { + return affectedByEventualConsistencyRetryStatusCodeMap[httpStatus{err.GetHTTPStatusCode(), err.GetCode()}] + } + return false +} + +// IsErrorRetryableByDefault returns true if the error is retryable by OCI default retry policy +func IsErrorRetryableByDefault(Error error) bool { + if Error == nil { + return false + } + + if IsNetworkError(Error) { + return true + } + + if err, ok := IsServiceError(Error); ok { + if shouldRetry, ok := defaultRetryStatusCodeMap[httpStatus{err.GetHTTPStatusCode(), err.GetCode()}]; ok { + return shouldRetry + } + + return 500 <= err.GetHTTPStatusCode() && err.GetHTTPStatusCode() < 600 + } + + return false } // NewOCIOperationResponse assembles an OCI Operation Response object. +// Note that InitialAttemptTime is not set, nor is EndOfWindowTime, and BackoffScalingFactor is set to 1.0. +// EndOfWindowTime and BackoffScalingFactor are only important for eventual consistency. +// InitialAttemptTime can be useful for time-based (as opposed to count-based) retry policies. func NewOCIOperationResponse(response OCIResponse, err error, attempt uint) OCIOperationResponse { return OCIOperationResponse{ - Response: response, - Error: err, - AttemptNumber: attempt, + Response: response, + Error: err, + AttemptNumber: attempt, + BackoffScalingFactor: 1.0, } } +// NewOCIOperationResponseExtended assembles an OCI Operation Response object, with the value for the EndOfWindowTime, BackoffScalingFactor, and InitialAttemptTime set. +// EndOfWindowTime and BackoffScalingFactor are only important for eventual consistency. +// InitialAttemptTime can be useful for time-based (as opposed to count-based) retry policies. +func NewOCIOperationResponseExtended(response OCIResponse, err error, attempt uint, endOfWindowTime *time.Time, backoffScalingFactor float64, + initialAttemptTime time.Time) OCIOperationResponse { + return OCIOperationResponse{ + Response: response, + Error: err, + AttemptNumber: attempt, + EndOfWindowTime: endOfWindowTime, + BackoffScalingFactor: backoffScalingFactor, + InitialAttemptTime: initialAttemptTime, + } +} + +// +// RetryPolicy +// + // RetryPolicy is the class that holds all relevant information for retrying operations. type RetryPolicy struct { // MaximumNumberAttempts is the maximum number of times to retry a request. Zero indicates an unlimited @@ -70,6 +212,191 @@ type RetryPolicy struct { // GetNextDuration computes the duration to pause between operation retries. NextDuration func(OCIOperationResponse) time.Duration + + // minimum sleep between attempts in seconds + MinSleepBetween float64 + + // maximum sleep between attempts in seconds + MaxSleepBetween float64 + + // the base for the exponential backoff + ExponentialBackoffBase float64 + + // DeterminePolicyToUse may modify the policy to handle eventual consistency; the return values are + // the retry policy to use, the end of the eventually consistent time window, and the backoff scaling factor + // If eventual consistency is not considered, this function should return the unmodified policy that was + // provided as input, along with (*time.Time)(nil) (no time window), and 1.0 (unscaled backoff). + DeterminePolicyToUse func(policy RetryPolicy) (RetryPolicy, *time.Time, float64) + + // if the retry policy considers eventual consistency, but there is no eventual consistency present + // the retries will fall back to the policy specified here; recommendation is to set this to DefaultRetryPolicyWithoutEventualConsistency() + NonEventuallyConsistentPolicy *RetryPolicy + + // Stores the maximum cumulative backoff in seconds. This can usually be calculated using + // MaximumNumberAttempts, MinSleepBetween, MaxSleepBetween, and ExponentialBackoffBase, + // but if MaximumNumberAttempts is 0 (unlimited attempts), then this needs to be set explicitly + // for Eventual Consistency retries to work. + MaximumCumulativeBackoffWithoutJitter float64 +} + +// RetryPolicyOption is the type of the options for NewRetryPolicy. +type RetryPolicyOption func(rp *RetryPolicy) + +// Convert retry policy to human-readable string representation +func (rp RetryPolicy) String() string { + return fmt.Sprintf("{MaximumNumberAttempts=%v, MinSleepBetween=%v, MaxSleepBetween=%v, ExponentialBackoffBase=%v, NonEventuallyConsistentPolicy=%v}", + rp.MaximumNumberAttempts, rp.MinSleepBetween, rp.MaxSleepBetween, rp.ExponentialBackoffBase, rp.NonEventuallyConsistentPolicy) +} + +// Validate returns true if the RetryPolicy is valid; if not, it also returns an error. +func (rp *RetryPolicy) validate() (success bool, err error) { + var errorStrings []string + if rp.ShouldRetryOperation == nil { + errorStrings = append(errorStrings, "ShouldRetryOperation may not be nil") + } + if rp.NextDuration == nil { + errorStrings = append(errorStrings, "NextDuration may not be nil") + } + if rp.NonEventuallyConsistentPolicy != nil { + if rp.MaximumNumberAttempts == 0 && rp.MaximumCumulativeBackoffWithoutJitter <= 0 { + errorStrings = append(errorStrings, "If eventual consistency is handled, and the MaximumNumberAttempts of the EC retry policy is 0 (unlimited attempts), then the MaximumCumulativeBackoffWithoutJitter of the EC retry policy must be positive; used WithUnlimitedAttempts instead") + } + nonEcRp := rp.NonEventuallyConsistentPolicy + if nonEcRp.MaximumNumberAttempts == 0 && nonEcRp.MaximumCumulativeBackoffWithoutJitter <= 0 { + errorStrings = append(errorStrings, "If eventual consistency is handled, and the MaximumNumberAttempts of the non-EC retry policy is 0 (unlimited attempts), then the MaximumCumulativeBackoffWithoutJitter of the non-EC retry policy must be positive; used WithUnlimitedAttempts instead") + } + } + if len(errorStrings) > 0 { + return false, errors.New(strings.Join(errorStrings, ", ")) + } + + // some legacy code constructing RetryPolicy instances directly may not have set DeterminePolicyToUse. + // In that case, just assume that it doesn't handle eventual consistency. + if rp.DeterminePolicyToUse == nil { + rp.DeterminePolicyToUse = returnSamePolicy + } + + return true, nil +} + +// GetMaximumCumulativeBackoffWithoutJitter returns the maximum cumulative backoff the retry policy would do, +// taking into account whether eventually consistency is considered or not. +// This function uses either GetMaximumCumulativeBackoffWithoutJitter or GetMaximumCumulativeEventuallyConsistentBackoffWithoutJitter, +// whichever is appropriate +func (rp RetryPolicy) GetMaximumCumulativeBackoffWithoutJitter() time.Duration { + if rp.NonEventuallyConsistentPolicy == nil { + return GetMaximumCumulativeBackoffWithoutJitter(rp) + } + return GetMaximumCumulativeEventuallyConsistentBackoffWithoutJitter(rp) +} + +// +// Functions to calculate backoff and maximum cumulative backoff +// + +// GetBackoffWithoutJitter calculates the backoff without jitter for the attempt, given the retry policy. +func GetBackoffWithoutJitter(policy RetryPolicy, attempt uint) time.Duration { + return time.Duration(getBackoffWithoutJitterHelper(policy.MinSleepBetween, policy.MaxSleepBetween, policy.ExponentialBackoffBase, attempt)) * time.Second +} + +// getBackoffWithoutJitterHelper calculates the backoff without jitter for the attempt, given the loose retry policy values. +func getBackoffWithoutJitterHelper(minSleepBetween float64, maxSleepBetween float64, exponentialBackoffBase float64, attempt uint) float64 { + sleepTime := math.Pow(exponentialBackoffBase, float64(attempt-1)) + if sleepTime < minSleepBetween { + sleepTime = minSleepBetween + } + if sleepTime > maxSleepBetween { + sleepTime = maxSleepBetween + } + return sleepTime +} + +// GetMaximumCumulativeBackoffWithoutJitter calculates the maximum backoff without jitter, according to the retry +// policy, if every retry attempt is made. +func GetMaximumCumulativeBackoffWithoutJitter(policy RetryPolicy) time.Duration { + return getMaximumCumulativeBackoffWithoutJitterHelper(policy.MinSleepBetween, policy.MaxSleepBetween, policy.ExponentialBackoffBase, policy.MaximumNumberAttempts, policy.MaximumCumulativeBackoffWithoutJitter) +} + +func getMaximumCumulativeBackoffWithoutJitterHelper(minSleepBetween float64, maxSleepBetween float64, exponentialBackoffBase float64, MaximumNumberAttempts uint, MaximumCumulativeBackoffWithoutJitter float64) time.Duration { + var cumulative time.Duration = 0 + + if MaximumNumberAttempts == 0 { + // unlimited + return time.Duration(MaximumCumulativeBackoffWithoutJitter) * time.Second + } + + // use a one-based counter because it's easier to think about operation retry in terms of attempt numbering + for currentOperationAttempt := uint(1); currentOperationAttempt < MaximumNumberAttempts; currentOperationAttempt++ { + cumulative += time.Duration(getBackoffWithoutJitterHelper(minSleepBetween, maxSleepBetween, exponentialBackoffBase, currentOperationAttempt)) * time.Second + } + return cumulative +} + +// +// Functions to calculate backoff and maximum cumulative backoff for eventual consistency +// + +// GetEventuallyConsistentBackoffWithoutJitter calculates the backoff without jitter for the attempt, given the retry policy +// and dealing with eventually consistent effects. The result is then multiplied by backoffScalingFactor. +func GetEventuallyConsistentBackoffWithoutJitter(policy RetryPolicy, attempt uint, backoffScalingFactor float64) time.Duration { + return time.Duration(getEventuallyConsistentBackoffWithoutJitterHelper(policy.MinSleepBetween, policy.MaxSleepBetween, policy.ExponentialBackoffBase, attempt, backoffScalingFactor, + func(minSleepBetween float64, maxSleepBetween float64, exponentialBackoffBase float64, attempt uint) float64 { + rp := policy.NonEventuallyConsistentPolicy + return getBackoffWithoutJitterHelper(rp.MinSleepBetween, rp.MaxSleepBetween, rp.ExponentialBackoffBase, attempt) + })*1000) * time.Millisecond +} + +// getEventuallyConsistentBackoffWithoutJitterHelper calculates the backoff without jitter for the attempt, given the loose retry policy values, +// and dealing with eventually consistent effects. The result is then multiplied by backoffScalingFactor. +func getEventuallyConsistentBackoffWithoutJitterHelper(minSleepBetween float64, maxSleepBetween float64, exponentialBackoffBase float64, attempt uint, backoffScalingFactor float64, + defaultBackoffWithoutJitterHelper func(minSleepBetween float64, maxSleepBetween float64, exponentialBackoffBase float64, attempt uint) float64) float64 { + var sleepTime = math.Pow(exponentialBackoffBase, float64(attempt-1)) + if sleepTime < minSleepBetween { + sleepTime = minSleepBetween + } + if sleepTime > maxSleepBetween { + sleepTime = maxSleepBetween + } + sleepTime = sleepTime * backoffScalingFactor + defaultSleepTime := defaultBackoffWithoutJitterHelper(minSleepBetween, maxSleepBetween, exponentialBackoffBase, attempt) + if defaultSleepTime > sleepTime { + sleepTime = defaultSleepTime + } + return sleepTime +} + +// GetMaximumCumulativeEventuallyConsistentBackoffWithoutJitter calculates the maximum backoff without jitter, according to the retry +// policy and taking eventually consistent effects into account, if every retry attempt is made. +func GetMaximumCumulativeEventuallyConsistentBackoffWithoutJitter(policy RetryPolicy) time.Duration { + return getMaximumCumulativeEventuallyConsistentBackoffWithoutJitterHelper(policy.MinSleepBetween, policy.MaxSleepBetween, policy.ExponentialBackoffBase, + policy.MaximumNumberAttempts, policy.MaximumCumulativeBackoffWithoutJitter, + func(minSleepBetween float64, maxSleepBetween float64, exponentialBackoffBase float64, attempt uint) float64 { + rp := policy.NonEventuallyConsistentPolicy + return getBackoffWithoutJitterHelper(rp.MinSleepBetween, rp.MaxSleepBetween, rp.ExponentialBackoffBase, attempt) + }) +} + +func getMaximumCumulativeEventuallyConsistentBackoffWithoutJitterHelper(minSleepBetween float64, maxSleepBetween float64, exponentialBackoffBase float64, MaximumNumberAttempts uint, + MaximumCumulativeBackoffWithoutJitter float64, + defaultBackoffWithoutJitterHelper func(minSleepBetween float64, maxSleepBetween float64, exponentialBackoffBase float64, attempt uint) float64) time.Duration { + if MaximumNumberAttempts == 0 { + // unlimited + return time.Duration(MaximumCumulativeBackoffWithoutJitter) * time.Second + } + + var cumulative time.Duration = 0 + // use a one-based counter because it's easier to think about operation retry in terms of attempt numbering + for currentOperationAttempt := uint(1); currentOperationAttempt < MaximumNumberAttempts; currentOperationAttempt++ { + cumulative += time.Duration(getEventuallyConsistentBackoffWithoutJitterHelper(minSleepBetween, maxSleepBetween, exponentialBackoffBase, currentOperationAttempt, 1.0, defaultBackoffWithoutJitterHelper)*1000) * time.Millisecond + } + return cumulative +} + +func returnSamePolicy(policy RetryPolicy) (RetryPolicy, *time.Time, float64) { + // we're returning the end of window time nonetheless, even though the default non-eventual consistency (EC) + // retry policy doesn't use it; this is useful in case developers wants to write an EC-aware retry policy + // on their own + return policy, EcContext.GetEndOfWindow(), 1.0 } // NoRetryPolicy is a helper method that assembles and returns a return policy that indicates an operation should @@ -77,56 +404,381 @@ type RetryPolicy struct { func NoRetryPolicy() RetryPolicy { dontRetryOperation := func(OCIOperationResponse) bool { return false } zeroNextDuration := func(OCIOperationResponse) time.Duration { return 0 * time.Second } - return NewRetryPolicy(uint(1), dontRetryOperation, zeroNextDuration) + return newRetryPolicyWithOptionsNoDefault( + WithMaximumNumberAttempts(1), + WithShouldRetryOperation(dontRetryOperation), + WithNextDuration(zeroNextDuration), + withMinSleepBetween(0.0*time.Second), + withMaxSleepBetween(0.0*time.Second), + withExponentialBackoffBase(0.0), + withDeterminePolicyToUse(returnSamePolicy), + withNonEventuallyConsistentPolicy(nil)) +} + +// DefaultShouldRetryOperation is the function that should be used for RetryPolicy.ShouldRetryOperation when +// not taking eventual consistency into account. +func DefaultShouldRetryOperation(r OCIOperationResponse) bool { + if r.Error == nil && 199 < r.Response.HTTPResponse().StatusCode && r.Response.HTTPResponse().StatusCode < 300 { + // success + return false + } + return IsErrorRetryableByDefault(r.Error) } // DefaultRetryPolicy is a helper method that assembles and returns a return policy that is defined to be a default one // The default retry policy will retry on (409, IncorrectState), (429, TooManyRequests) and any 5XX errors except (501, MethodNotImplemented) -// The default retry behavior is using exponential backoff with jitter, the maximum wait time is 30s +// The default retry behavior is using exponential backoff with jitter, the maximum wait time is 30s plus 1s jitter +// The maximum cumulative backoff after all 8 attempts have been made is about 1.5 minutes. +// It will also retry on errors affected by eventual consistency. +// The eventual consistency retry behavior is using exponential backoff with jitter, the maximum wait time is 45s plus 1s jitter +// Under eventual consistency, the maximum cumulative backoff after all 9 attempts have been made is about 4 minutes. func DefaultRetryPolicy() RetryPolicy { - defaultRetryPolicy := func(r OCIOperationResponse) bool { - type HTTPStatus struct { - code int - message string - } - defaultRetryStatusCodeMap := map[HTTPStatus]bool{ - {409, "IncorrectState"}: true, - {429, "TooManyRequests"}: true, + return NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(DefaultRetryPolicyWithoutEventualConsistency()), + WithEventualConsistency()) +} - {501, "MethodNotImplemented"}: false, - } +// DefaultRetryPolicyWithoutEventualConsistency is a helper method that assembles and returns a return policy that is defined to be a default one +// The default retry policy will retry on (409, IncorrectState), (429, TooManyRequests) and any 5XX errors except (501, MethodNotImplemented) +// It will not retry on errors affected by eventual consistency. +// The default retry behavior is using exponential backoff with jitter, the maximum wait time is 30s plus 1s jitter +func DefaultRetryPolicyWithoutEventualConsistency() RetryPolicy { + exponentialBackoffWithJitter := func(r OCIOperationResponse) time.Duration { + sleepTime := getBackoffWithoutJitterHelper(defaultMinSleepBetween, defaultMaxSleepBetween, defaultExponentialBackoffBase, r.AttemptNumber) + nextDuration := time.Duration(1000.0*(sleepTime+rand.Float64())) * time.Millisecond + return nextDuration + } + return newRetryPolicyWithOptionsNoDefault( + WithMaximumNumberAttempts(defaultMaximumNumberAttempts), + WithShouldRetryOperation(DefaultShouldRetryOperation), + WithNextDuration(exponentialBackoffWithJitter), + withMinSleepBetween(defaultMinSleepBetween*time.Second), + withMaxSleepBetween(defaultMaxSleepBetween*time.Second), + withExponentialBackoffBase(defaultExponentialBackoffBase), + withDeterminePolicyToUse(returnSamePolicy), + withNonEventuallyConsistentPolicy(nil)) +} - if r.Error == nil && 199 < r.Response.HTTPResponse().StatusCode && r.Response.HTTPResponse().StatusCode < 300 { +// EventuallyConsistentShouldRetryOperation is the function that should be used for RetryPolicy.ShouldRetryOperation when +// taking eventual consistency into account +func EventuallyConsistentShouldRetryOperation(r OCIOperationResponse) bool { + if r.Error == nil && 199 < r.Response.HTTPResponse().StatusCode && r.Response.HTTPResponse().StatusCode < 300 { + // success + Debugln(fmt.Sprintf("EC.ShouldRetryOperation, status = %v, 2xx, returning false", r.Response.HTTPResponse().StatusCode)) + return false + } + if IsErrorRetryableByDefault(r.Error) { + return true + } + // not retryable by default + if _, ok := IsServiceError(r.Error); ok { + now := EcContext.timeNowProvider() + if r.EndOfWindowTime == nil || r.EndOfWindowTime.Before(now) { + // either no eventually consistent effects, or they have disappeared by now + Debugln(fmt.Sprintf("EC.ShouldRetryOperation, no EC or in the past, returning false: endOfWindowTime = %v, now = %v", r.EndOfWindowTime, now)) return false } - if IsNetworkError(r.Error) { + // there were eventually consistent effects present at the time of the first request + // and they could still affect the retries + if IsErrorAffectedByEventualConsistency(r.Error) { + // and it's one of the three affected error codes + Debugln(fmt.Sprintf("EC.ShouldRetryOperation, affected by EC, EC is present: endOfWindowTime = %v, now = %v", r.EndOfWindowTime, now)) return true } - if err, ok := IsServiceError(r.Error); ok { - if shouldRetry, ok := defaultRetryStatusCodeMap[HTTPStatus{err.GetHTTPStatusCode(), err.GetCode()}]; ok { - return shouldRetry - } - return 500 <= r.Response.HTTPResponse().StatusCode && r.Response.HTTPResponse().StatusCode < 600 - } return false } - maxSleepBetween := 30.0 + + return false +} + +// EventuallyConsistentRetryPolicy is a helper method that assembles and returns a return policy that is defined to be a default one +// plus dealing with errors affected by eventual consistency. +// The default retry behavior is using exponential backoff with jitter, the maximum wait time is 45s plus 1s jitter +func EventuallyConsistentRetryPolicy(nonEventuallyConsistentPolicy RetryPolicy) RetryPolicy { + if nonEventuallyConsistentPolicy.NonEventuallyConsistentPolicy != nil { + // already deals with eventual consistency + return nonEventuallyConsistentPolicy + } exponentialBackoffWithJitter := func(r OCIOperationResponse) time.Duration { - sleepTime := math.Pow(float64(2), float64(r.AttemptNumber-1)) - if sleepTime < maxSleepBetween { - return time.Duration(sleepTime+rand.Float64()) * time.Second - } - return time.Duration(maxSleepBetween+rand.Float64()) * time.Second + sleepTime := getEventuallyConsistentBackoffWithoutJitterHelper(ecMinSleepBetween, ecMaxSleepBetween, ecExponentialBackoffBase, r.AttemptNumber, r.BackoffScalingFactor, + func(minSleepBetween float64, maxSleepBetween float64, exponentialBackoffBase float64, attempt uint) float64 { + rp := nonEventuallyConsistentPolicy + return getBackoffWithoutJitterHelper(rp.MinSleepBetween, rp.MaxSleepBetween, rp.ExponentialBackoffBase, attempt) + }) + nextDuration := time.Duration(1000.0*(sleepTime+rand.Float64())) * time.Millisecond + Debugln(fmt.Sprintf("EventuallyConsistentRetryPolicy.NextDuration for attempt %v: sleepTime = %.1fs, nextDuration = %v", r.AttemptNumber, sleepTime, nextDuration)) + return nextDuration } - return NewRetryPolicy(uint(8), defaultRetryPolicy, exponentialBackoffWithJitter) + returnModifiedPolicy := func(policy RetryPolicy) (RetryPolicy, *time.Time, float64) { return determinePolicyToUse(policy) } + nonEventuallyConsistentPolicyCopy := newRetryPolicyWithOptionsNoDefault( + ReplaceWithValuesFromRetryPolicy(nonEventuallyConsistentPolicy)) + return newRetryPolicyWithOptionsNoDefault( + WithMaximumNumberAttempts(ecMaximumNumberAttempts), + WithShouldRetryOperation(EventuallyConsistentShouldRetryOperation), + WithNextDuration(exponentialBackoffWithJitter), + withMinSleepBetween(ecMinSleepBetween*time.Second), + withMaxSleepBetween(ecMaxSleepBetween*time.Second), + withExponentialBackoffBase(ecExponentialBackoffBase), + withDeterminePolicyToUse(returnModifiedPolicy), + withNonEventuallyConsistentPolicy(&nonEventuallyConsistentPolicyCopy)) } -// NewRetryPolicy is a helper method for assembling a Retry Policy object. +// NewRetryPolicy is a helper method for assembling a Retry Policy object. It does not handle eventual consistency, so as to not break existing code. +// If you want to handle eventual consistency, the simplest way to do that is to replace the code +// NewRetryPolicy(a, r, n) +// with the code +// NewRetryPolicyWithOptions( +// WithMaximumNumberAttempts(a), +// WithFixedBackoff(fb) // fb is the fixed backoff duration +// WithShouldRetryOperation(r)) +// or +// NewRetryPolicyWithOptions( +// WithMaximumNumberAttempts(a), +// WithExponentialBackoff(mb, e) // mb is the maximum backoff duration, and e is the base for exponential backoff, e.g. 2.0 +// WithShouldRetryOperation(r)) +// or, if a == 0 (the maximum number of attempts is unlimited) +// NewRetryPolicyWithEventualConsistencyUnlimitedAttempts(a, r, n, mcb) // mcb is the maximum cumulative backoff duration without jitter func NewRetryPolicy(attempts uint, retryOperation func(OCIOperationResponse) bool, nextDuration func(OCIOperationResponse) time.Duration) RetryPolicy { - return RetryPolicy{ - MaximumNumberAttempts: attempts, - ShouldRetryOperation: retryOperation, - NextDuration: nextDuration, + return NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(DefaultRetryPolicyWithoutEventualConsistency()), + WithMaximumNumberAttempts(attempts), + WithShouldRetryOperation(retryOperation), + WithNextDuration(nextDuration), + ) +} + +// NewRetryPolicyWithEventualConsistencyUnlimitedAttempts is a helper method for assembling a Retry Policy object. +// It does handle eventual consistency, but other than that, it is very similar to NewRetryPolicy. +// NewRetryPolicyWithEventualConsistency does not support limited attempts, use NewRetryPolicyWithEventualConsistency instead. +func NewRetryPolicyWithEventualConsistencyUnlimitedAttempts(attempts uint, retryOperation func(OCIOperationResponse) bool, nextDuration func(OCIOperationResponse) time.Duration, + maximumCumulativeBackoffWithoutJitter time.Duration) (*RetryPolicy, error) { + + if attempts != 0 { + return nil, fmt.Errorf("NewRetryPolicyWithEventualConsistencyUnlimitedAttempts cannot be used with attempts != 0 (limited attempts), use NewRetryPolicyWithEventualConsistency instead") + } + + result := NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(DefaultRetryPolicyWithoutEventualConsistency()), + WithUnlimitedAttempts(maximumCumulativeBackoffWithoutJitter), + WithShouldRetryOperation(retryOperation), + WithNextDuration(nextDuration), + ) + return &result, nil +} + +// NewRetryPolicyWithOptions is a helper method for assembling a Retry Policy object. +// It starts out with the values returned by DefaultRetryPolicy() and does handle eventual consistency, +// unless you replace all options set using ReplaceWithValuesFromRetryPolicy(DefaultRetryPolicyWithoutEventualConsistency()). +func NewRetryPolicyWithOptions(opts ...RetryPolicyOption) RetryPolicy { + rp := &RetryPolicy{} + + // start with the default retry policy + ReplaceWithValuesFromRetryPolicy(DefaultRetryPolicyWithoutEventualConsistency())(rp) + WithEventualConsistency()(rp) + + // then allow changing values + for _, opt := range opts { + opt(rp) + } + + if rp.DeterminePolicyToUse == nil { + rp.DeterminePolicyToUse = returnSamePolicy + } + + return *rp +} + +// newRetryPolicyWithOptionsNoDefault is a helper method for assembling a Retry Policy object. +// Contrary to newRetryPolicyWithOptions, it does not start out with the values returned by +// DefaultRetryPolicy(). +func newRetryPolicyWithOptionsNoDefault(opts ...RetryPolicyOption) RetryPolicy { + rp := &RetryPolicy{} + + // then allow changing values + for _, opt := range opts { + opt(rp) + } + + if rp.DeterminePolicyToUse == nil { + rp.DeterminePolicyToUse = returnSamePolicy + } + + return *rp +} + +// WithMaximumNumberAttempts is the option for NewRetryPolicyWithOptions that sets the maximum number of attempts. +func WithMaximumNumberAttempts(attempts uint) RetryPolicyOption { + // this is the RetryPolicyOption function type + return func(rp *RetryPolicy) { + rp.MaximumNumberAttempts = attempts + } +} + +// WithUnlimitedAttempts is the option for NewRetryPolicyWithOptions that sets unlimited number of attempts, +// but it needs to set a MaximumCumulativeBackoffWithoutJitter duration. +// If you use WithUnlimitedAttempts, you should set your own NextDuration function using WithNextDuration. +func WithUnlimitedAttempts(maximumCumulativeBackoffWithoutJitter time.Duration) RetryPolicyOption { + // this is the RetryPolicyOption function type + return func(rp *RetryPolicy) { + rp.MaximumNumberAttempts = 0 + rp.MaximumCumulativeBackoffWithoutJitter = float64(maximumCumulativeBackoffWithoutJitter / time.Second) + } +} + +// WithShouldRetryOperation is the option for NewRetryPolicyWithOptions that sets the function that checks +// whether retries should be performed. +func WithShouldRetryOperation(retryOperation func(OCIOperationResponse) bool) RetryPolicyOption { + // this is the RetryPolicyOption function type + return func(rp *RetryPolicy) { + rp.ShouldRetryOperation = retryOperation + } +} + +// WithNextDuration is the option for NewRetryPolicyWithOptions that sets the function for computing the next +// backoff duration. +// It is preferred to use WithFixedBackoff or WithExponentialBackoff instead. +func WithNextDuration(nextDuration func(OCIOperationResponse) time.Duration) RetryPolicyOption { + // this is the RetryPolicyOption function type + return func(rp *RetryPolicy) { + rp.NextDuration = nextDuration + } +} + +// withMinSleepBetween is the option for NewRetryPolicyWithOptions that sets the minimum backoff duration. +func withMinSleepBetween(minSleepBetween time.Duration) RetryPolicyOption { + // this is the RetryPolicyOption function type + return func(rp *RetryPolicy) { + rp.MinSleepBetween = float64(minSleepBetween / time.Second) + } +} + +// withMaxsSleepBetween is the option for NewRetryPolicyWithOptions that sets the maximum backoff duration. +func withMaxSleepBetween(maxSleepBetween time.Duration) RetryPolicyOption { + // this is the RetryPolicyOption function type + return func(rp *RetryPolicy) { + rp.MaxSleepBetween = float64(maxSleepBetween / time.Second) + } +} + +// withExponentialBackoffBase is the option for NewRetryPolicyWithOptions that sets the base for the +// exponential backoff +func withExponentialBackoffBase(base float64) RetryPolicyOption { + // this is the RetryPolicyOption function type + return func(rp *RetryPolicy) { + rp.ExponentialBackoffBase = base + } +} + +// withDeterminePolicyToUse is the option for NewRetryPolicyWithOptions that sets the function that +// determines which polich should be used and if eventual consistency should be considered +func withDeterminePolicyToUse(determinePolicyToUse func(policy RetryPolicy) (RetryPolicy, *time.Time, float64)) RetryPolicyOption { + // this is the RetryPolicyOption function type + return func(rp *RetryPolicy) { + rp.DeterminePolicyToUse = determinePolicyToUse + } +} + +// withNonEventuallyConsistentPolicy is the option for NewRetryPolicyWithOptions that sets the fallback +// strategy if eventual consistency should not be considered +func withNonEventuallyConsistentPolicy(nonEventuallyConsistentPolicy *RetryPolicy) RetryPolicyOption { + // this is the RetryPolicyOption function type + return func(rp *RetryPolicy) { + // we want a non-EC policy for NonEventuallyConsistentPolicy; make sure that NonEventuallyConsistentPolicy is nil + for nonEventuallyConsistentPolicy != nil && nonEventuallyConsistentPolicy.NonEventuallyConsistentPolicy != nil { + nonEventuallyConsistentPolicy = nonEventuallyConsistentPolicy.NonEventuallyConsistentPolicy + } + rp.NonEventuallyConsistentPolicy = nonEventuallyConsistentPolicy + } +} + +// WithExponentialBackoff is an option for NewRetryPolicyWithOptions that sets the exponential backoff base, +// minimum and maximum sleep between attempts, and next duration function. +// Therefore, WithExponentialBackoff is a combination of WithNextDuration, withMinSleepBetween, withMaxSleepBetween, +// and withExponentialBackoffBase. +func WithExponentialBackoff(newMaxSleepBetween time.Duration, newExponentialBackoffBase float64) RetryPolicyOption { + exponentialBackoffWithJitter := func(r OCIOperationResponse) time.Duration { + sleepTime := getBackoffWithoutJitterHelper(defaultMinSleepBetween, newMaxSleepBetween.Seconds(), newExponentialBackoffBase, r.AttemptNumber) + nextDuration := time.Duration(1000.0*(sleepTime+rand.Float64())) * time.Millisecond + Debugln(fmt.Sprintf("NextDuration for attempt %v: sleepTime = %.1fs, nextDuration = %v", r.AttemptNumber, sleepTime, nextDuration)) + return nextDuration + } + + // this is the RetryPolicyOption function type + return func(rp *RetryPolicy) { + withMinSleepBetween(0)(rp) + withMaxSleepBetween(newMaxSleepBetween)(rp) + withExponentialBackoffBase(newExponentialBackoffBase)(rp) + WithNextDuration(exponentialBackoffWithJitter)(rp) + } +} + +// WithFixedBackoff is an option for NewRetryPolicyWithOptions that sets the backoff to always be exactly the same value. There is no jitter either. +// Therefore, WithFixedBackoff is a combination of WithNextDuration, withMinSleepBetween, withMaxSleepBetween, and withExponentialBackoffBase. +func WithFixedBackoff(newSleepBetween time.Duration) RetryPolicyOption { + fixedBackoffWithoutJitter := func(r OCIOperationResponse) time.Duration { + nextDuration := newSleepBetween + Debugln(fmt.Sprintf("NextDuration for attempt %v: nextDuration = %v", r.AttemptNumber, nextDuration)) + return nextDuration + } + + // this is the RetryPolicyOption function type + return func(rp *RetryPolicy) { + withMinSleepBetween(newSleepBetween)(rp) + withMaxSleepBetween(newSleepBetween)(rp) + withExponentialBackoffBase(1.0)(rp) + WithNextDuration(fixedBackoffWithoutJitter)(rp) + } +} + +// WithEventualConsistency is the option for NewRetryPolicyWithOptions that enables considering eventual backoff for the policy. +func WithEventualConsistency() RetryPolicyOption { + // this is the RetryPolicyOption function type + return func(rp *RetryPolicy) { + copy := RetryPolicy{ + MaximumNumberAttempts: rp.MaximumNumberAttempts, + ShouldRetryOperation: rp.ShouldRetryOperation, + NextDuration: rp.NextDuration, + MinSleepBetween: rp.MinSleepBetween, + MaxSleepBetween: rp.MaxSleepBetween, + ExponentialBackoffBase: rp.ExponentialBackoffBase, + DeterminePolicyToUse: rp.DeterminePolicyToUse, + NonEventuallyConsistentPolicy: rp.NonEventuallyConsistentPolicy, + } + ecrp := EventuallyConsistentRetryPolicy(copy) + rp.MaximumNumberAttempts = ecrp.MaximumNumberAttempts + rp.ShouldRetryOperation = ecrp.ShouldRetryOperation + rp.NextDuration = ecrp.NextDuration + rp.MinSleepBetween = ecrp.MinSleepBetween + rp.MaxSleepBetween = ecrp.MaxSleepBetween + rp.ExponentialBackoffBase = ecrp.ExponentialBackoffBase + rp.DeterminePolicyToUse = ecrp.DeterminePolicyToUse + rp.NonEventuallyConsistentPolicy = ecrp.NonEventuallyConsistentPolicy + } +} + +// WithConditionalOption is an option for NewRetryPolicyWithOptions that enables or disables another option. +func WithConditionalOption(enabled bool, otherOption RetryPolicyOption) RetryPolicyOption { + // this is the RetryPolicyOption function type + return func(rp *RetryPolicy) { + if enabled { + otherOption(rp) + } + } +} + +// ReplaceWithValuesFromRetryPolicy is an option for NewRetryPolicyWithOptions that copies over all settings from another RetryPolicy +func ReplaceWithValuesFromRetryPolicy(other RetryPolicy) RetryPolicyOption { + // this is the RetryPolicyOption function type + return func(rp *RetryPolicy) { + rp.MaximumNumberAttempts = other.MaximumNumberAttempts + rp.ShouldRetryOperation = other.ShouldRetryOperation + rp.NextDuration = other.NextDuration + rp.MinSleepBetween = other.MinSleepBetween + rp.MaxSleepBetween = other.MaxSleepBetween + rp.ExponentialBackoffBase = other.ExponentialBackoffBase + rp.DeterminePolicyToUse = other.DeterminePolicyToUse + rp.NonEventuallyConsistentPolicy = other.NonEventuallyConsistentPolicy + rp.MaximumCumulativeBackoffWithoutJitter = other.MaximumCumulativeBackoffWithoutJitter } } @@ -146,9 +798,57 @@ func RetryToken() string { return string(retryToken) } +func determinePolicyToUse(policy RetryPolicy) (RetryPolicy, *time.Time, float64) { + initialAttemptTime := EcContext.timeNowProvider() + var useDefaultTimingInstead = true + var endOfWindowTime = (*time.Time)(nil) + var backoffScalingFactor = 1.0 + var policyToUse RetryPolicy = policy + + eowt := EcContext.GetEndOfWindow() + if eowt != nil { + // there was an eventually consistent request + if eowt.After(initialAttemptTime) { + // and the eventually consistent effects may still be present + endOfWindowTime = eowt + // if the time between now and the end of the window is less than the time we normally would retry, use the default timing + durationToEndOfWindow := endOfWindowTime.Sub(initialAttemptTime) + maxCumulativeBackoffWithoutJitter := GetMaximumCumulativeBackoffWithoutJitter(*policy.NonEventuallyConsistentPolicy) + Debugln(fmt.Sprintf("durationToEndOfWindow = %v, maxCumulativeBackoffWithoutJitter = %v", durationToEndOfWindow, maxCumulativeBackoffWithoutJitter)) + if durationToEndOfWindow > maxCumulativeBackoffWithoutJitter { + // the end of the eventually consistent window is later than when default retries would end + // do not use default timing + maximumCumulativeBackoffWithoutJitter := GetMaximumCumulativeEventuallyConsistentBackoffWithoutJitter(policy) + backoffScalingFactor = float64(durationToEndOfWindow) / float64(maximumCumulativeBackoffWithoutJitter) + useDefaultTimingInstead = false + Debugln(fmt.Sprintf("Use eventually consistent timing, durationToEndOfWindow = %v, maximumCumulativeBackoffWithoutJitter = %v, backoffScalingFactor = %.2f", + durationToEndOfWindow, maximumCumulativeBackoffWithoutJitter, backoffScalingFactor)) + } else { + Debugln(fmt.Sprintf("Use default timing, end of EC window is sooner than default retries")) + } + } else { + useDefaultTimingInstead = false + policyToUse = *policy.NonEventuallyConsistentPolicy + Debugln(fmt.Sprintf("Use default timing and strategy, end of EC window is in the past")) + } + } else { + useDefaultTimingInstead = false + policyToUse = *policy.NonEventuallyConsistentPolicy + Debugln(fmt.Sprintf("Use default timing and strategy, no EC window set")) + } + + if useDefaultTimingInstead { + // use timing from defaultRetryPolicy, but whether to retry from the policy that was passed into this request + policyToUse = NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(*policy.NonEventuallyConsistentPolicy), + WithShouldRetryOperation(policy.ShouldRetryOperation)) + } + + return policyToUse, endOfWindowTime, backoffScalingFactor +} + // Retry is a package-level operation that executes the retryable request using the specified operation and retry policy. func Retry(ctx context.Context, request OCIRetryableRequest, operation OCIOperation, policy RetryPolicy) (OCIResponse, error) { - type retrierResult struct { response OCIResponse err error @@ -158,6 +858,13 @@ func Retry(ctx context.Context, request OCIRetryableRequest, operation OCIOperat var err error retrierChannel := make(chan retrierResult) + validated, validateError := policy.validate() + if !validated { + return nil, validateError + } + + initialAttemptTime := time.Now() + go func() { // Deal with panics more graciously @@ -166,7 +873,9 @@ func Retry(ctx context.Context, request OCIRetryableRequest, operation OCIOperat stackBuffer := make([]byte, 1024) bytesWritten := runtime.Stack(stackBuffer, false) stack := string(stackBuffer[:bytesWritten]) - retrierChannel <- retrierResult{nil, fmt.Errorf("panicked while retrying operation. Panic was: %s\nStack: %s", r, stack)} + error := fmt.Errorf("panicked while retrying operation. Panic was: %s\nStack: %s", r, stack) + Debugln(error) + retrierChannel <- retrierResult{nil, error} } }() @@ -174,7 +883,7 @@ func Retry(ctx context.Context, request OCIRetryableRequest, operation OCIOperat var curPos int64 = 0 isSeekable := false rsc, isBinaryRequest := request.BinaryRequestBody() - if rsc != nil { + if rsc != nil && rsc.rc != nil { defer rsc.rc.Close() } if policy.MaximumNumberAttempts != uint(1) { @@ -185,8 +894,20 @@ func Retry(ctx context.Context, request OCIRetryableRequest, operation OCIOperat } extraHeaders := make(map[string]string) + + // some legacy code constructing RetryPolicy instances directly may not have set DeterminePolicyToUse. + // In that case, just assume that it doesn't handle eventual consistency. + if policy.DeterminePolicyToUse == nil { + policy.DeterminePolicyToUse = returnSamePolicy + } + + // this determines which policy to use, when the eventual consistency window ends, and what the backoff + // scaling factor should be + policyToUse, endOfWindowTime, backoffScalingFactor := policy.DeterminePolicyToUse(policy) + Debugln(fmt.Sprintf("Retry policy to use: %v", policyToUse)) + // use a one-based counter because it's easier to think about operation retry in terms of attempt numbering - for currentOperationAttempt := uint(1); shouldContinueIssuingRequests(currentOperationAttempt, policy.MaximumNumberAttempts); currentOperationAttempt++ { + for currentOperationAttempt := uint(1); shouldContinueIssuingRequests(currentOperationAttempt, policyToUse.MaximumNumberAttempts); currentOperationAttempt++ { Debugln(fmt.Sprintf("operation attempt #%v", currentOperationAttempt)) // rewind body once needed if isSeekable { @@ -195,9 +916,9 @@ func Retry(ctx context.Context, request OCIRetryableRequest, operation OCIOperat } response, err = operation(ctx, request, rsc, extraHeaders) - operationResponse := NewOCIOperationResponse(response, err, currentOperationAttempt) + operationResponse := NewOCIOperationResponseExtended(response, err, currentOperationAttempt, endOfWindowTime, backoffScalingFactor, initialAttemptTime) - if !policy.ShouldRetryOperation(operationResponse) { + if !policyToUse.ShouldRetryOperation(operationResponse) { // we should NOT retry operation based on response and/or error => return retrierChannel <- retrierResult{response, err} return @@ -209,9 +930,9 @@ func Retry(ctx context.Context, request OCIRetryableRequest, operation OCIOperat return } - duration := policy.NextDuration(operationResponse) + duration := policyToUse.NextDuration(operationResponse) //The following condition is kept for backwards compatibility reasons - if deadline, ok := ctx.Deadline(); ok && time.Now().Add(duration).After(deadline) { + if deadline, ok := ctx.Deadline(); ok && EcContext.timeNowProvider().Add(duration).After(deadline) { // we want to retry the operation, but the policy is telling us to wait for a duration that exceeds // the specified overall deadline for the operation => instead of waiting for however long that // time period is and then aborting, abort now and save the cycles diff --git a/common/retry_test.go b/common/retry_test.go index bcb6f475e9..40bbf21454 100644 --- a/common/retry_test.go +++ b/common/retry_test.go @@ -8,6 +8,8 @@ import ( "context" "math" "net/http" + "reflect" + "strings" "testing" "time" @@ -32,10 +34,15 @@ func getMockedOCIOperationResponse(statusCode int, attemptNumber uint) OCIOperat response := mockedResponse{ RawResponse: &httpResponse, } - return NewOCIOperationResponse(response, nil, attemptNumber) + now := time.Now() + return NewOCIOperationResponseExtended(response, nil, attemptNumber, &now, 1.0, now) } func getMockedOCIOperationResponseWithError(status int, statusCode string) OCIOperationResponse { + return getMockedOCIOperationResponseWithErrorFull(status, statusCode, (*time.Time)(nil), 1.0) +} + +func getMockedOCIOperationResponseWithErrorFull(status int, statusCode string, endOfWindowTime *time.Time, backoffScalingFactor float64) OCIOperationResponse { httpResponse := http.Response{ Header: http.Header{}, StatusCode: status, @@ -47,10 +54,20 @@ func getMockedOCIOperationResponseWithError(status int, statusCode string) OCIOp StatusCode: status, Code: statusCode, } - return NewOCIOperationResponse(response, err, uint(1)) + return NewOCIOperationResponseExtended(response, err, uint(1), endOfWindowTime, backoffScalingFactor, time.Now()) } func getExponentialBackoffRetryPolicy(attempts uint) RetryPolicy { + // we don't want jitter here + exponentialBackoff := func(r OCIOperationResponse) time.Duration { + return time.Duration(math.Pow(float64(2), float64(r.AttemptNumber-1))) * time.Second + } + return NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(getExponentialBackoffRetryPolicyWithJitter(attempts)), + WithNextDuration(exponentialBackoff)) +} + +func getExponentialBackoffRetryPolicyWithJitter(attempts uint) RetryPolicy { shouldRetry := func(OCIOperationResponse) bool { return true } @@ -107,116 +124,161 @@ func TestRetryPolicyExponentialBackoffNextDurationUnrolled(t *testing.T) { assert.False(t, shouldContinueIssuingRequests(6, policy.MaximumNumberAttempts)) } -func TestDefaultRetryPolicy(t *testing.T) { +func TestRetryPolicyExponentialBackoffNextDurationUnrolledWithJitter(t *testing.T) { responses := []OCIOperationResponse{ - getMockedOCIOperationResponseWithError(400, "CannotParseRequest"), - getMockedOCIOperationResponseWithError(400, "InvalidParameter"), - getMockedOCIOperationResponseWithError(400, "MissingParameter"), - getMockedOCIOperationResponseWithError(400, "QuotaExceeded"), - getMockedOCIOperationResponseWithError(400, "LimitExceeded"), - getMockedOCIOperationResponseWithError(400, "RelatedResourceNotAuthorizedOrNotFound"), - getMockedOCIOperationResponseWithError(401, "NotAuthenticated"), - getMockedOCIOperationResponseWithError(403, "SignUpRequired"), - getMockedOCIOperationResponseWithError(403, "NotAllowed"), - getMockedOCIOperationResponseWithError(403, "NotAuthorized"), - - getMockedOCIOperationResponseWithError(404, "NotFound"), - getMockedOCIOperationResponseWithError(404, "InvalidParameter"), - getMockedOCIOperationResponseWithError(404, "NotAuthorizedOrNotFound"), - getMockedOCIOperationResponseWithError(405, "MethodNotAllowed"), - getMockedOCIOperationResponseWithError(409, "NotAuthorizedOrResourceAlreadyExists"), - getMockedOCIOperationResponseWithError(409, "InvalidatedRetryToken"), - getMockedOCIOperationResponseWithError(409, "IncorrectState"), - getMockedOCIOperationResponseWithError(409, "Conflict"), - getMockedOCIOperationResponseWithError(412, "NoEtagMatch"), - getMockedOCIOperationResponseWithError(413, "PayloadTooLarge"), - - getMockedOCIOperationResponseWithError(422, "UnprocessableEntity"), - getMockedOCIOperationResponseWithError(429, "TooManyRequests"), - getMockedOCIOperationResponseWithError(431, "RequestHeaderFieldsTooLarge"), - getMockedOCIOperationResponseWithError(500, "InternalServerError"), - getMockedOCIOperationResponseWithError(500, "OutOfCapacity"), - getMockedOCIOperationResponseWithError(501, "MethodNotImplemented"), - getMockedOCIOperationResponseWithError(503, "ServiceUnavailable"), - getMockedOCIOperationResponseWithError(599, "Unknown 500 Error"), - - getMockedOCIOperationResponse(200, 1), + getMockedOCIOperationResponse(500, 1), + getMockedOCIOperationResponse(500, 2), + getMockedOCIOperationResponse(500, 3), + getMockedOCIOperationResponse(500, 4), + getMockedOCIOperationResponse(500, 5), } - policy := DefaultRetryPolicy() + policy := getExponentialBackoffRetryPolicyWithJitter(5) // unroll an exponential retry policy with a specified maximum // number of attempts so it's more obvious what's happening + // request #1 assert.True(t, shouldContinueIssuingRequests(1, policy.MaximumNumberAttempts)) + assert.True(t, policy.ShouldRetryOperation(responses[0])) + assert.True(t, 1*time.Second <= policy.NextDuration(responses[0]) && policy.NextDuration(responses[0]) < 2*time.Second) + // request #2 assert.True(t, shouldContinueIssuingRequests(2, policy.MaximumNumberAttempts)) + assert.True(t, policy.ShouldRetryOperation(responses[1])) + assert.True(t, 2*time.Second <= policy.NextDuration(responses[1]) && policy.NextDuration(responses[1]) < 3*time.Second) + // request #3 assert.True(t, shouldContinueIssuingRequests(3, policy.MaximumNumberAttempts)) + assert.True(t, policy.ShouldRetryOperation(responses[2])) + assert.True(t, 4*time.Second <= policy.NextDuration(responses[2]) && policy.NextDuration(responses[2]) < 5*time.Second) + // request #4 assert.True(t, shouldContinueIssuingRequests(4, policy.MaximumNumberAttempts)) + assert.True(t, policy.ShouldRetryOperation(responses[3])) + assert.True(t, 8*time.Second <= policy.NextDuration(responses[3]) && policy.NextDuration(responses[3]) < 9*time.Second) + // request #5 assert.True(t, shouldContinueIssuingRequests(5, policy.MaximumNumberAttempts)) - assert.True(t, shouldContinueIssuingRequests(6, policy.MaximumNumberAttempts)) - assert.True(t, shouldContinueIssuingRequests(7, policy.MaximumNumberAttempts)) - assert.True(t, shouldContinueIssuingRequests(8, policy.MaximumNumberAttempts)) + assert.True(t, policy.ShouldRetryOperation(responses[4])) + assert.True(t, 16*time.Second <= policy.NextDuration(responses[4]) && policy.NextDuration(responses[4]) < 17*time.Second) + // done + assert.False(t, shouldContinueIssuingRequests(6, policy.MaximumNumberAttempts)) +} + +func buildResponsesNoRetry(endOfWindowTime *time.Time, backoffScalingFactor float64) []OCIOperationResponse { + responses := []OCIOperationResponse{ + getMockedOCIOperationResponseWithErrorFull(400, "CannotParseRequest", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(400, "InvalidParameter", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(400, "MissingParameter", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(400, "QuotaExceeded", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(400, "LimitExceeded", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(400, "RelatedResourceNotAuthorizedOrNotFound", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(401, "NotAuthenticated", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(403, "SignUpRequired", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(403, "NotAllowed", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(403, "NotAuthorized", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(404, "NotFound", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(404, "InvalidParameter", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(404, "NotAuthorizedOrNotFound", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(405, "MethodNotAllowed", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(409, "NotAuthorizedOrResourceAlreadyExists", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(409, "InvalidatedRetryToken", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(412, "NoEtagMatch", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(413, "PayloadTooLarge", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(422, "UnprocessableEntity", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(431, "RequestHeaderFieldsTooLarge", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(501, "MethodNotImplemented", endOfWindowTime, backoffScalingFactor), + + getMockedOCIOperationResponse(200, 1), + } + return responses +} + +func buildResponsesWantRetry(endOfWindowTime *time.Time, backoffScalingFactor float64) []OCIOperationResponse { + responses := []OCIOperationResponse{ + getMockedOCIOperationResponseWithErrorFull(409, "IncorrectState", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(429, "TooManyRequests", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(500, "InternalServerError", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(500, "OutOfCapacity", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(503, "ServiceUnavailable", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(599, "Unknown 500 Error", endOfWindowTime, backoffScalingFactor), + } + return responses +} + +func buildEcResponsesNoRetry(endOfWindowTime *time.Time, backoffScalingFactor float64) []OCIOperationResponse { + responses := []OCIOperationResponse{ + getMockedOCIOperationResponseWithErrorFull(400, "CannotParseRequest", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(400, "InvalidParameter", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(400, "MissingParameter", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(400, "QuotaExceeded", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(400, "LimitExceeded", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(401, "NotAuthenticated", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(403, "SignUpRequired", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(403, "NotAllowed", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(403, "NotAuthorized", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(404, "NotFound", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(404, "InvalidParameter", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(405, "MethodNotAllowed", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(409, "InvalidatedRetryToken", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(412, "NoEtagMatch", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(413, "PayloadTooLarge", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(422, "UnprocessableEntity", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(431, "RequestHeaderFieldsTooLarge", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(501, "MethodNotImplemented", endOfWindowTime, backoffScalingFactor), + + getMockedOCIOperationResponse(200, 1), + } + return responses +} + +func buildEcResponsesWantRetry(endOfWindowTime *time.Time, backoffScalingFactor float64) []OCIOperationResponse { + responses := []OCIOperationResponse{ + getMockedOCIOperationResponseWithErrorFull(400, "RelatedResourceNotAuthorizedOrNotFound", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(404, "NotAuthorizedOrNotFound", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(409, "IncorrectState", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(409, "NotAuthorizedOrResourceAlreadyExists", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(429, "TooManyRequests", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(500, "InternalServerError", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(500, "OutOfCapacity", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(503, "ServiceUnavailable", endOfWindowTime, backoffScalingFactor), + getMockedOCIOperationResponseWithErrorFull(599, "Unknown 500 Error", endOfWindowTime, backoffScalingFactor), + } + return responses +} +var ( + responsesNoRetry = buildResponsesNoRetry((*time.Time)(nil), 1.0) + responsesWantRetry = buildResponsesWantRetry((*time.Time)(nil), 1.0) +) + +func TestDefaultRetryPolicyWithoutEventualConsistency(t *testing.T) { + policy := DefaultRetryPolicyWithoutEventualConsistency() + // unroll an exponential retry policy with a specified maximum + // number of attempts so it's more obvious what's happening + for i := uint(1); i <= 8; i++ { + assert.True(t, shouldContinueIssuingRequests(i, policy.MaximumNumberAttempts)) + } assert.False(t, shouldContinueIssuingRequests(9, policy.MaximumNumberAttempts)) - // request #1 - assert.False(t, policy.ShouldRetryOperation(responses[0])) - // request #2 - assert.False(t, policy.ShouldRetryOperation(responses[1])) - // request #3 - assert.False(t, policy.ShouldRetryOperation(responses[2])) - // request #4 - assert.False(t, policy.ShouldRetryOperation(responses[3])) - // request #5 - assert.False(t, policy.ShouldRetryOperation(responses[4])) - // request #6 - assert.False(t, policy.ShouldRetryOperation(responses[5])) - // request #7 - assert.False(t, policy.ShouldRetryOperation(responses[6])) - // request #8 - assert.False(t, policy.ShouldRetryOperation(responses[7])) - // request #9 - assert.False(t, policy.ShouldRetryOperation(responses[8])) - // request #10 - assert.False(t, policy.ShouldRetryOperation(responses[9])) - - // request #11 - assert.False(t, policy.ShouldRetryOperation(responses[10])) - // request #12 - assert.False(t, policy.ShouldRetryOperation(responses[11])) - // request #13 - assert.False(t, policy.ShouldRetryOperation(responses[12])) - // request #14 - assert.False(t, policy.ShouldRetryOperation(responses[13])) - // request #15 - assert.False(t, policy.ShouldRetryOperation(responses[14])) - // request #16 - assert.False(t, policy.ShouldRetryOperation(responses[15])) - // request #17 - assert.True(t, policy.ShouldRetryOperation(responses[16])) - // request #18 - assert.False(t, policy.ShouldRetryOperation(responses[17])) - // request #19 - assert.False(t, policy.ShouldRetryOperation(responses[18])) - // request #20 - assert.False(t, policy.ShouldRetryOperation(responses[19])) - - // request #21 - assert.False(t, policy.ShouldRetryOperation(responses[20])) - // request #22 - assert.True(t, policy.ShouldRetryOperation(responses[21])) - // request #23 - assert.False(t, policy.ShouldRetryOperation(responses[22])) - // request #24 - assert.True(t, policy.ShouldRetryOperation(responses[23])) - // request #25 - assert.True(t, policy.ShouldRetryOperation(responses[24])) - // request #26 - assert.False(t, policy.ShouldRetryOperation(responses[25])) - // request #27 - assert.True(t, policy.ShouldRetryOperation(responses[26])) - // request #28 - assert.True(t, policy.ShouldRetryOperation(responses[27])) - - // request #29 - assert.False(t, policy.ShouldRetryOperation(responses[28])) + for _, r := range responsesNoRetry { + assert.False(t, policy.ShouldRetryOperation(r)) + } + for _, r := range responsesWantRetry { + assert.True(t, policy.ShouldRetryOperation(r)) + } +} + +func TestDefaultRetryPolicy(t *testing.T) { + policy := DefaultRetryPolicy() + + // unroll an exponential retry policy with a specified maximum + // number of attempts so it's more obvious what's happening + for i := uint(1); i <= 9; i++ { + assert.True(t, shouldContinueIssuingRequests(i, policy.MaximumNumberAttempts)) + } + assert.False(t, shouldContinueIssuingRequests(10, policy.MaximumNumberAttempts)) + + for _, r := range responsesNoRetry { + assert.False(t, policy.ShouldRetryOperation(r)) + } + for _, r := range responsesWantRetry { + assert.True(t, policy.ShouldRetryOperation(r)) + } } type mockedRequest struct { @@ -257,6 +319,7 @@ func TestRetryTokenPersists(t *testing.T) { Retry(context.Background(), r, operation, *r.Policy) } + func TestRetryWithPanicInOperation(t *testing.T) { body := bytes.NewBufferString("YES") req, _ := http.NewRequest("POST", "/some", body) @@ -282,3 +345,1207 @@ func TestRetryWithPanicInOperation(t *testing.T) { assert.Nil(t, resp) assert.Error(t, err) } + +const ( + eventuallyConsistentWindowSize = time.Duration(4 * time.Minute) +) + +func TestGetEndTimeOfEventuallyConsistentWindow(t *testing.T) { + assert.Equal(t, (*time.Time)(nil), EcContext.GetEndOfWindow()) + EcContext.UpdateEndOfWindow(eventuallyConsistentWindowSize) + assert.NotEqual(t, (*time.Time)(nil), EcContext.GetEndOfWindow()) + value1 := EcContext.GetEndOfWindow() + assert.True(t, value1.Before(time.Now().Add(eventuallyConsistentWindowSize))) + value2 := EcContext.GetEndOfWindow() + assert.Equal(t, value1, value2) + EcContext.UpdateEndOfWindow(eventuallyConsistentWindowSize) + value3 := EcContext.GetEndOfWindow() + assert.True(t, value3.Before(time.Now().Add(eventuallyConsistentWindowSize))) + assert.True(t, value1.Before(*value3)) + assert.True(t, value2.Before(*value3)) +} + +func TestIsErrorAffectedByEventualConsistency(t *testing.T) { + var error = servicefailure{ + StatusCode: 400, + Code: "InvalidParameter"} + assert.False(t, IsErrorAffectedByEventualConsistency(error)) + + error = servicefailure{ + StatusCode: 400, + Code: "RelatedResourceNotAuthorizedOrNotFound"} + assert.True(t, IsErrorAffectedByEventualConsistency(error)) + + error = servicefailure{ + StatusCode: 404, + Code: "NotFound"} + assert.False(t, IsErrorAffectedByEventualConsistency(error)) + + error = servicefailure{ + StatusCode: 404, + Code: "NotAuthorizedOrNotFound"} + assert.True(t, IsErrorAffectedByEventualConsistency(error)) + + error = servicefailure{ + StatusCode: 409, + Code: "Conflict"} + assert.False(t, IsErrorAffectedByEventualConsistency(error)) + + error = servicefailure{ + StatusCode: 409, + Code: "NotAuthorizedOrResourceAlreadyExists"} + assert.True(t, IsErrorAffectedByEventualConsistency(error)) +} + +func TestGetBackoffWithoutJitter(t *testing.T) { + rp := DefaultRetryPolicyWithoutEventualConsistency() + assert.Equal(t, time.Duration(1)*time.Second, GetBackoffWithoutJitter(rp, 1)) + assert.Equal(t, time.Duration(2)*time.Second, GetBackoffWithoutJitter(rp, 2)) + assert.Equal(t, time.Duration(4)*time.Second, GetBackoffWithoutJitter(rp, 3)) + assert.Equal(t, time.Duration(8)*time.Second, GetBackoffWithoutJitter(rp, 4)) + assert.Equal(t, time.Duration(16)*time.Second, GetBackoffWithoutJitter(rp, 5)) + assert.Equal(t, time.Duration(30)*time.Second, GetBackoffWithoutJitter(rp, 6)) + assert.Equal(t, time.Duration(30)*time.Second, GetBackoffWithoutJitter(rp, 7)) +} + +func TestGetMaximumCumulativeBackoffWithoutJitter(t *testing.T) { + rp := DefaultRetryPolicyWithoutEventualConsistency() + assert.Equal(t, time.Duration(91)*time.Second, GetMaximumCumulativeBackoffWithoutJitter(rp)) + assert.Equal(t, time.Duration(91)*time.Second, rp.GetMaximumCumulativeBackoffWithoutJitter()) +} + +func TestGetMaximumCumulativeBackoffWithoutJitter_UnlimitedAttempts(t *testing.T) { + var rp = NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(DefaultRetryPolicyWithoutEventualConsistency()), + WithMaximumNumberAttempts(0), + ) + var validated, validateError = rp.validate() + assert.True(t, validated) + assert.Equal(t, nil, validateError) + + rp = NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(DefaultRetryPolicyWithoutEventualConsistency()), + WithUnlimitedAttempts(time.Duration(10)*time.Minute), + ) + validated, validateError = rp.validate() + assert.True(t, validated) + assert.Equal(t, nil, validateError) + + assert.Equal(t, time.Duration(10)*time.Minute, GetMaximumCumulativeBackoffWithoutJitter(rp)) + assert.Equal(t, time.Duration(10)*time.Minute, rp.GetMaximumCumulativeBackoffWithoutJitter()) +} + +func TestGetEventuallyConsistentBackoffWithoutJitter(t *testing.T) { + rp := DefaultRetryPolicy() + assert.Equal(t, time.Duration(1)*time.Second, GetEventuallyConsistentBackoffWithoutJitter(rp, 1, 1.0)) + assert.Equal(t, time.Duration(3520)*time.Millisecond, GetEventuallyConsistentBackoffWithoutJitter(rp, 2, 1.0)) + assert.Equal(t, time.Duration(12390)*time.Millisecond, GetEventuallyConsistentBackoffWithoutJitter(rp, 3, 1.0)) + assert.Equal(t, time.Duration(43614)*time.Millisecond, GetEventuallyConsistentBackoffWithoutJitter(rp, 4, 1.0)) + assert.Equal(t, time.Duration(45)*time.Second, GetEventuallyConsistentBackoffWithoutJitter(rp, 5, 1.0)) + assert.Equal(t, time.Duration(45)*time.Second, GetEventuallyConsistentBackoffWithoutJitter(rp, 6, 1.0)) + assert.Equal(t, time.Duration(45)*time.Second, GetEventuallyConsistentBackoffWithoutJitter(rp, 7, 1.0)) + assert.Equal(t, time.Duration(45)*time.Second, GetEventuallyConsistentBackoffWithoutJitter(rp, 8, 1.0)) + + assert.Equal(t, time.Duration(1)*time.Second, GetEventuallyConsistentBackoffWithoutJitter(rp, 1, 0.5)) + assert.Equal(t, time.Duration(2)*time.Second, GetEventuallyConsistentBackoffWithoutJitter(rp, 2, 0.5)) + assert.Equal(t, time.Duration(12390/2)*time.Millisecond, GetEventuallyConsistentBackoffWithoutJitter(rp, 3, 0.5)) + assert.Equal(t, time.Duration(43614/2)*time.Millisecond, GetEventuallyConsistentBackoffWithoutJitter(rp, 4, 0.5)) + assert.Equal(t, time.Duration(45000/2)*time.Millisecond, GetEventuallyConsistentBackoffWithoutJitter(rp, 5, 0.5)) + assert.Equal(t, time.Duration(30)*time.Second, GetEventuallyConsistentBackoffWithoutJitter(rp, 6, 0.5)) + assert.Equal(t, time.Duration(30)*time.Second, GetEventuallyConsistentBackoffWithoutJitter(rp, 7, 0.5)) + assert.Equal(t, time.Duration(30)*time.Second, GetEventuallyConsistentBackoffWithoutJitter(rp, 8, 0.5)) +} + +func TestGetMaximumCumulativeEventuallyConsistentBackoffWithoutJitter(t *testing.T) { + rp := DefaultRetryPolicy() + assert.Equal(t, time.Duration(240524)*time.Millisecond, GetMaximumCumulativeEventuallyConsistentBackoffWithoutJitter(rp)) + assert.Equal(t, time.Duration(240524)*time.Millisecond, rp.GetMaximumCumulativeBackoffWithoutJitter()) +} + +func TestGetMaximumCumulativeEventuallyConsistentBackoffWithoutJitter_UnlimitedAttempts(t *testing.T) { + var rp = NewRetryPolicyWithOptions( + WithMaximumNumberAttempts(0), + ) + var validated, validateError = rp.validate() + assert.False(t, validated) + assert.True(t, strings.Contains(validateError.Error(), "Unlimited")) + + rp = NewRetryPolicyWithOptions( + WithUnlimitedAttempts(time.Duration(10) * time.Minute), + ) + validated, validateError = rp.validate() + assert.True(t, validated) + assert.Equal(t, nil, validateError) + + assert.Equal(t, time.Duration(10)*time.Minute, GetMaximumCumulativeEventuallyConsistentBackoffWithoutJitter(rp)) + assert.Equal(t, time.Duration(10)*time.Minute, rp.GetMaximumCumulativeBackoffWithoutJitter()) + + // non-EC policy has unlimited attempts + rp = NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(DefaultRetryPolicyWithoutEventualConsistency()), + WithMaximumNumberAttempts(0), + ) + rp = EventuallyConsistentRetryPolicy(rp) + validated, validateError = rp.validate() + assert.False(t, validated) + assert.True(t, strings.Contains(validateError.Error(), "Unlimited")) + + rp = NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(DefaultRetryPolicyWithoutEventualConsistency()), + WithUnlimitedAttempts(time.Duration(10)*time.Minute), + ) + rp = EventuallyConsistentRetryPolicy(rp) + validated, validateError = rp.validate() + assert.True(t, validated) + assert.Equal(t, nil, validateError) + + assert.Equal(t, time.Duration(10)*time.Minute, GetMaximumCumulativeEventuallyConsistentBackoffWithoutJitter(*rp.NonEventuallyConsistentPolicy)) + assert.Equal(t, time.Duration(10)*time.Minute, rp.NonEventuallyConsistentPolicy.GetMaximumCumulativeBackoffWithoutJitter()) +} + +func TestDeterminePolicyToUse_DefaultRetryPolicyWithoutEventualConsistency(t *testing.T) { + resetTimes() + + rp := DefaultRetryPolicyWithoutEventualConsistency() + var policyToUse, endOfWindowTime, backoffScalingFactor = rp.DeterminePolicyToUse(rp) + assertEqualRetryPolicies(t, rp, policyToUse) + assert.Equal(t, (*time.Time)(nil), endOfWindowTime) + assert.Equal(t, 1.0, backoffScalingFactor) + + currentEndOfWindowTime := EcContext.UpdateEndOfWindow(eventuallyConsistentWindowSize) + + policyToUse, endOfWindowTime, backoffScalingFactor = rp.DeterminePolicyToUse(rp) + assertEqualRetryPolicies(t, rp, policyToUse) + assert.Equal(t, currentEndOfWindowTime, endOfWindowTime) + assert.Equal(t, 1.0, backoffScalingFactor) +} + +func TestDeterminePolicyToUse_NoRetryPolicy(t *testing.T) { + resetTimes() + + rp := NoRetryPolicy() + var policyToUse, endOfWindowTime, backoffScalingFactor = rp.DeterminePolicyToUse(rp) + assertEqualRetryPolicies(t, rp, policyToUse) + assert.Equal(t, (*time.Time)(nil), endOfWindowTime) + assert.Equal(t, 1.0, backoffScalingFactor) + + currentEndOfWindowTime := EcContext.UpdateEndOfWindow(eventuallyConsistentWindowSize) + + policyToUse, endOfWindowTime, backoffScalingFactor = rp.DeterminePolicyToUse(rp) + assertEqualRetryPolicies(t, rp, policyToUse) + assert.Equal(t, currentEndOfWindowTime, endOfWindowTime) + assert.Equal(t, 1.0, backoffScalingFactor) +} + +// EC + +func TestDeterminePolicyToUse_EcRetryPolicy_NoEc(t *testing.T) { + resetTimes() + + drp := DefaultRetryPolicyWithoutEventualConsistency() + rp := EventuallyConsistentRetryPolicy(drp) + + // no eventually consistent effects + var policyToUse, endOfWindowTime, backoffScalingFactor = rp.DeterminePolicyToUse(rp) + assertEqualRetryPolicies(t, drp, policyToUse) + assert.Equal(t, (*time.Time)(nil), endOfWindowTime) + assert.Equal(t, 1.0, backoffScalingFactor) +} + +func TestDeterminePolicyToUse_EcRetryPolicy_EcEndsSoonerThanDefaultRetries(t *testing.T) { + resetTimes() + + drp := DefaultRetryPolicyWithoutEventualConsistency() + rp := EventuallyConsistentRetryPolicy(drp) + drpWithEc := NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(drp), + WithShouldRetryOperation(rp.ShouldRetryOperation)) + + now := setupTimesEcEndsSoonerThanDefaultRetries((*time.Time)(nil)) + + var policyToUse, endOfWindowTime, backoffScalingFactor = rp.DeterminePolicyToUse(rp) + assertEqualRetryPolicies(t, drpWithEc, policyToUse) + assert.Equal(t, now.Add(eventuallyConsistentWindowSize), *endOfWindowTime) + assert.Equal(t, 1.0, backoffScalingFactor) +} + +func TestDeterminePolicyToUse_EcRetryPolicy_NeedEcRetries(t *testing.T) { + resetTimes() + + rp := DefaultRetryPolicy() + + now := setupTimesNeedEcRetries((*time.Time)(nil), rp) + + var policyToUse, endOfWindowTime, backoffScalingFactor = rp.DeterminePolicyToUse(rp) + assertEqualRetryPolicies(t, rp, policyToUse) + assert.Equal(t, now.Add(eventuallyConsistentWindowSize), *endOfWindowTime) + // since the initial request is exactly half-way through the maximum, expect factor of 0.5 + assert.Equal(t, 0.5, backoffScalingFactor) +} + +func TestDeterminePolicyToUse_EcRetryPolicy_NeedFullEcRetries(t *testing.T) { + resetTimes() + + rp := DefaultRetryPolicy() + maxCumulativeBackoffWithoutJitter := GetMaximumCumulativeEventuallyConsistentBackoffWithoutJitter(rp) + assert.Equal(t, maxCumulativeBackoffWithoutJitter, rp.GetMaximumCumulativeBackoffWithoutJitter()) + + // EC window ends after default retries, with almost the full max cumulative backoff left + timeNowProviderValues := make(chan time.Time, 300) + now := time.Now() + // most recent EC + timeNowProviderValues <- now + // initial request + timeNowProviderValues <- now + EcContext.timeNowProvider = func() time.Time { + nextTime := <-timeNowProviderValues + return nextTime + } + EcContext.UpdateEndOfWindow(eventuallyConsistentWindowSize) + + var policyToUse, endOfWindowTime, backoffScalingFactor = rp.DeterminePolicyToUse(rp) + assertEqualRetryPolicies(t, rp, policyToUse) + assert.Equal(t, now.Add(eventuallyConsistentWindowSize), *endOfWindowTime) + // since the initial request is 4 minutes / (4 minutes 0.524 seconds), the factor + // should be really close to 1 + assert.Equal(t, float64(4*time.Minute)/float64(maxCumulativeBackoffWithoutJitter), backoffScalingFactor) + assert.True(t, backoffScalingFactor > 0.99) + assert.True(t, backoffScalingFactor < 1.0) +} + +func TestDeterminePolicyToUse_EcRetryPolicy_EndOfWindowInThePast(t *testing.T) { + resetTimes() + + drp := DefaultRetryPolicyWithoutEventualConsistency() + rp := EventuallyConsistentRetryPolicy(drp) + + setupTimesEndOfEcWindowInThePast((*time.Time)(nil)) + + var policyToUse, endOfWindowTime, backoffScalingFactor = rp.DeterminePolicyToUse(rp) + assertEqualRetryPolicies(t, drp, policyToUse) + assert.Equal(t, (*time.Time)(nil), endOfWindowTime) + assert.Equal(t, 1.0, backoffScalingFactor) +} + +// EC with unlimited attempts + +func TestDeterminePolicyToUse_EcRetryPolicy_NoEc_UnlimitedAttempts(t *testing.T) { + resetTimes() + + drp := NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(DefaultRetryPolicyWithoutEventualConsistency()), + WithUnlimitedAttempts(time.Duration(10)*time.Minute), + ) + rp := EventuallyConsistentRetryPolicy(drp) + + // no eventually consistent effects + var policyToUse, endOfWindowTime, backoffScalingFactor = rp.DeterminePolicyToUse(rp) + assertEqualRetryPolicies(t, drp, policyToUse) + assert.Equal(t, (*time.Time)(nil), endOfWindowTime) + assert.Equal(t, 1.0, backoffScalingFactor) +} + +func TestDeterminePolicyToUse_EcRetryPolicy_EcEndsSoonerThanDefaultRetries_UnlimitedAttempts(t *testing.T) { + resetTimes() + + drp := NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(DefaultRetryPolicyWithoutEventualConsistency()), + WithUnlimitedAttempts(time.Duration(10)*time.Minute), + ) + rp := EventuallyConsistentRetryPolicy(drp) + drpWithEc := NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(DefaultRetryPolicyWithoutEventualConsistency()), + WithUnlimitedAttempts(time.Duration(10)*time.Minute), + WithShouldRetryOperation(rp.ShouldRetryOperation)) + + now := setupTimesEcEndsSoonerThanDefaultRetries((*time.Time)(nil)) + + var policyToUse, endOfWindowTime, backoffScalingFactor = rp.DeterminePolicyToUse(rp) + assertEqualRetryPolicies(t, drpWithEc, policyToUse) + assert.Equal(t, now.Add(eventuallyConsistentWindowSize), *endOfWindowTime) + assert.Equal(t, 1.0, backoffScalingFactor) +} + +func TestDeterminePolicyToUse_EcRetryPolicy_NeedEcRetries_UnlimitedAttempts(t *testing.T) { + resetTimes() + + drp := NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(DefaultRetryPolicyWithoutEventualConsistency()), + WithUnlimitedAttempts(time.Duration(2)*time.Minute), + ) + rp := EventuallyConsistentRetryPolicy(drp) + + now := setupTimesNeedEcRetries((*time.Time)(nil), rp) + + var policyToUse, endOfWindowTime, backoffScalingFactor = rp.DeterminePolicyToUse(rp) + assertEqualRetryPolicies(t, rp, policyToUse) + assert.Equal(t, now.Add(eventuallyConsistentWindowSize), *endOfWindowTime) + // since the initial request is exactly half-way through the maximum, expect factor of 0.5 + assert.Equal(t, 0.5, backoffScalingFactor) +} + +func TestDeterminePolicyToUse_EcRetryPolicy_NeedFullEcRetries_UnlimitedAttempts(t *testing.T) { + resetTimes() + + drp := NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(DefaultRetryPolicyWithoutEventualConsistency()), + WithUnlimitedAttempts(time.Duration(2)*time.Minute), + ) + rp := EventuallyConsistentRetryPolicy(drp) + + maxCumulativeBackoffWithoutJitter := GetMaximumCumulativeEventuallyConsistentBackoffWithoutJitter(rp) + assert.Equal(t, maxCumulativeBackoffWithoutJitter, rp.GetMaximumCumulativeBackoffWithoutJitter()) + + // EC window ends after default retries, with almost the full max cumulative backoff left + timeNowProviderValues := make(chan time.Time, 300) + now := time.Now() + // most recent EC + timeNowProviderValues <- now + // initial request + timeNowProviderValues <- now + EcContext.timeNowProvider = func() time.Time { + nextTime := <-timeNowProviderValues + return nextTime + } + EcContext.UpdateEndOfWindow(eventuallyConsistentWindowSize) + + var policyToUse, endOfWindowTime, backoffScalingFactor = rp.DeterminePolicyToUse(rp) + assertEqualRetryPolicies(t, rp, policyToUse) + assert.Equal(t, now.Add(eventuallyConsistentWindowSize), *endOfWindowTime) + // since the initial request is 4 minutes / (4 minutes 0.524 seconds), the factor + // should be really close to 1 + assert.Equal(t, float64(4*time.Minute)/float64(maxCumulativeBackoffWithoutJitter), backoffScalingFactor) + assert.True(t, backoffScalingFactor > 0.99) + assert.True(t, backoffScalingFactor < 1.0) +} + +func TestDeterminePolicyToUse_EcRetryPolicy_EndOfWindowInThePast_UnlimitedAttempts(t *testing.T) { + resetTimes() + + drp := NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(DefaultRetryPolicyWithoutEventualConsistency()), + WithUnlimitedAttempts(time.Duration(2)*time.Minute), + ) + rp := EventuallyConsistentRetryPolicy(drp) + + setupTimesEndOfEcWindowInThePast((*time.Time)(nil)) + + var policyToUse, endOfWindowTime, backoffScalingFactor = rp.DeterminePolicyToUse(rp) + assertEqualRetryPolicies(t, drp, policyToUse) + assert.Equal(t, (*time.Time)(nil), endOfWindowTime) + assert.Equal(t, 1.0, backoffScalingFactor) +} + +// more tests + +func assertEqualRetryPolicies(t *testing.T, this RetryPolicy, that RetryPolicy) { + assert.Equal(t, this.MaximumNumberAttempts, that.MaximumNumberAttempts) + assert.Equal(t, this.MinSleepBetween, that.MinSleepBetween) + assert.Equal(t, this.MaxSleepBetween, that.MaxSleepBetween) + assert.Equal(t, this.ExponentialBackoffBase, that.ExponentialBackoffBase) + assert.Equal(t, this.MaximumCumulativeBackoffWithoutJitter, that.MaximumCumulativeBackoffWithoutJitter) + assert.True(t, reflect.ValueOf(this.NextDuration).Pointer() == reflect.ValueOf(that.NextDuration).Pointer()) + assert.True(t, reflect.ValueOf(this.ShouldRetryOperation).Pointer() == reflect.ValueOf(that.ShouldRetryOperation).Pointer()) + if this.NonEventuallyConsistentPolicy != nil && that.NonEventuallyConsistentPolicy != nil { + assertEqualRetryPolicies(t, *this.NonEventuallyConsistentPolicy, *that.NonEventuallyConsistentPolicy) + } else { + assert.True(t, reflect.ValueOf(this.NonEventuallyConsistentPolicy).Pointer() == reflect.ValueOf(that.NonEventuallyConsistentPolicy).Pointer()) + } +} + +func TestEventuallyConsistentRetryPolicy_AlreadyEC(t *testing.T) { + policy := DefaultRetryPolicy() + policy2 := EventuallyConsistentRetryPolicy(policy) + + assertEqualRetryPolicies(t, policy, policy2) +} + +func TestEventuallyConsistentRetryPolicy_NoEc(t *testing.T) { + resetTimes() + + policy := DefaultRetryPolicy() + assert.Equal(t, ecMaximumNumberAttempts, policy.MaximumNumberAttempts) + assert.Equal(t, ecExponentialBackoffBase, policy.ExponentialBackoffBase) + assert.Equal(t, ecMaxSleepBetween, policy.MaxSleepBetween) + + // unroll an exponential retry policy with a specified maximum + // number of attempts so it's more obvious what's happening + for i := uint(1); i <= 9; i++ { + assert.True(t, shouldContinueIssuingRequests(i, policy.MaximumNumberAttempts)) + } + assert.False(t, shouldContinueIssuingRequests(10, policy.MaximumNumberAttempts)) + + for _, r := range responsesNoRetry { + assert.False(t, policy.ShouldRetryOperation(r)) + } + for _, r := range responsesWantRetry { + assert.True(t, policy.ShouldRetryOperation(r)) + } +} + +func TestEventuallyConsistentRetryPolicy_EndOfEcWindowInThePast(t *testing.T) { + resetTimes() + + policy := DefaultRetryPolicy() + assert.Equal(t, ecMaximumNumberAttempts, policy.MaximumNumberAttempts) + assert.Equal(t, ecExponentialBackoffBase, policy.ExponentialBackoffBase) + assert.Equal(t, ecMaxSleepBetween, policy.MaxSleepBetween) + + // unroll an exponential retry policy with a specified maximum + // number of attempts so it's more obvious what's happening + for i := uint(1); i <= 9; i++ { + assert.True(t, shouldContinueIssuingRequests(i, policy.MaximumNumberAttempts)) + } + assert.False(t, shouldContinueIssuingRequests(10, policy.MaximumNumberAttempts)) + + now := time.Now() + nowPlusOne := now.Add(1 * time.Minute) + endOfWindowTime := now.Add(5 * time.Minute) + + for _, r := range buildResponsesNoRetry(&endOfWindowTime, 1.0) { + setupTimesEndOfEcWindowInThePast(&nowPlusOne) + assert.False(t, policy.ShouldRetryOperation(r)) + } + for _, r := range buildResponsesWantRetry(&endOfWindowTime, 1.0) { + setupTimesEndOfEcWindowInThePast(&nowPlusOne) + assert.True(t, policy.ShouldRetryOperation(r)) + } +} + +func TestEventuallyConsistentRetryPolicy_EcEndsSoonerThanDefaultRetries(t *testing.T) { + resetTimes() + + policy := DefaultRetryPolicy() + assert.Equal(t, ecMaximumNumberAttempts, policy.MaximumNumberAttempts) + assert.Equal(t, ecExponentialBackoffBase, policy.ExponentialBackoffBase) + assert.Equal(t, ecMaxSleepBetween, policy.MaxSleepBetween) + + // unroll an exponential retry policy with a specified maximum + // number of attempts so it's more obvious what's happening + for i := uint(1); i <= 9; i++ { + assert.True(t, shouldContinueIssuingRequests(i, policy.MaximumNumberAttempts)) + } + assert.False(t, shouldContinueIssuingRequests(10, policy.MaximumNumberAttempts)) + + now := time.Now() + endOfWindowTime := now.Add(5 * time.Minute) + + for _, r := range buildEcResponsesNoRetry(&endOfWindowTime, 1.0) { + setupTimesEcEndsSoonerThanDefaultRetries(&now) + assert.False(t, policy.ShouldRetryOperation(r)) + } + for _, r := range buildEcResponsesWantRetry(&endOfWindowTime, 1.0) { + setupTimesEcEndsSoonerThanDefaultRetries(&now) + assert.True(t, policy.ShouldRetryOperation(r)) + } +} + +func TestEventuallyConsistentRetryPolicy_NeedEcRetries(t *testing.T) { + resetTimes() + + policy := DefaultRetryPolicy() + assert.Equal(t, ecMaximumNumberAttempts, policy.MaximumNumberAttempts) + assert.Equal(t, ecExponentialBackoffBase, policy.ExponentialBackoffBase) + assert.Equal(t, ecMaxSleepBetween, policy.MaxSleepBetween) + + // unroll an exponential retry policy with a specified maximum + // number of attempts so it's more obvious what's happening + for i := uint(1); i <= 9; i++ { + assert.True(t, shouldContinueIssuingRequests(i, policy.MaximumNumberAttempts)) + } + assert.False(t, shouldContinueIssuingRequests(10, policy.MaximumNumberAttempts)) + + now := time.Now() + endOfWindowTime := now.Add(5 * time.Minute) + + for _, r := range buildEcResponsesNoRetry(&endOfWindowTime, 1.0) { + setupTimesNeedEcRetries(&now, policy) + assert.False(t, policy.ShouldRetryOperation(r)) + } + for _, r := range buildEcResponsesWantRetry(&endOfWindowTime, 1.0) { + setupTimesNeedEcRetries(&now, policy) + assert.True(t, policy.ShouldRetryOperation(r)) + } +} + +func resetTimes() { + EcContext.setEndOfWindow((*time.Time)(nil)) + EcContext.timeNowProvider = func() time.Time { return time.Now() } +} + +func setupTimesEndOfEcWindowInThePast(now *time.Time) time.Time { + // EC window ends in the past + timeNowProviderValues := make(chan time.Time, 300) + + if now == (*time.Time)(nil) { + n := time.Now() + now = &n + } + + // most recent EC + timeNowProviderValues <- *now + // initial request + timeNowProviderValues <- now.Add(5 * time.Minute) + EcContext.timeNowProvider = func() time.Time { + nextTime := <-timeNowProviderValues + return nextTime + } + EcContext.UpdateEndOfWindow(eventuallyConsistentWindowSize) + + return *now +} + +func setupTimesEcEndsSoonerThanDefaultRetries(now *time.Time) time.Time { + // EC window ends sooner than default retries + timeNowProviderValues := make(chan time.Time, 300) + + if now == (*time.Time)(nil) { + n := time.Now() + now = &n + } + + // most recent EC + timeNowProviderValues <- *now + // initial request, set up to be 90 seconds before the end of the EC period + // the default backoff is 91 seconds long, so it's longer + timeNowProviderValues <- now.Add((240 - 90) * time.Second) + // checking after first attempt + timeNowProviderValues <- now.Add((240 - 89) * time.Second) + EcContext.timeNowProvider = func() time.Time { + nextTime := <-timeNowProviderValues + return nextTime + } + EcContext.UpdateEndOfWindow(eventuallyConsistentWindowSize) + + return *now +} + +func setupTimesNeedEcRetries(now *time.Time, policy RetryPolicy) time.Time { + // EC window ends after default retries, with half the maximum cumulative backoff left + timeNowProviderValues := make(chan time.Time, 300) + + if now == (*time.Time)(nil) { + n := time.Now() + now = &n + } + + maxCumulativeBackoffWithoutJitter := GetMaximumCumulativeEventuallyConsistentBackoffWithoutJitter(policy) + + // most recent EC + timeNowProviderValues <- *now + // initial request, set up to be exactly half-way through the max cumulative backoff + timeNowProviderValues <- now.Add(240*time.Second - maxCumulativeBackoffWithoutJitter/2) + EcContext.timeNowProvider = func() time.Time { + nextTime := <-timeNowProviderValues + return nextTime + } + EcContext.UpdateEndOfWindow(eventuallyConsistentWindowSize) + + return *now +} + +// EC + +func TestEcRetry_NoEc(t *testing.T) { + resetTimes() + + body := bytes.NewBufferString("YES") + req, _ := http.NewRequest("POST", "/some", body) + policy := DefaultRetryPolicy() + r := mockedRequest{Request: *req, Policy: &policy} + + var timesCalled = 0 + + operation := func(i context.Context, request OCIRequest, binaryRequestBody *OCIReadSeekCloser, extraHeaders map[string]string) (OCIResponse, error) { + timesCalled++ + + request.HTTPRequest("POST", "/some", NewOCIReadSeekCloser(nil), nil) + + httpResponse := http.Response{ + Header: http.Header{}, + StatusCode: 404, + } + response := mockedResponse{ + RawResponse: &httpResponse, + } + err := servicefailure{ + StatusCode: 404, + Code: "NotAuthorizedOrNotFound", + } + + return response, err + } + + Retry(context.Background(), r, operation, *r.Policy) + + assert.Equal(t, 1, timesCalled) +} + +func TestEcRetry_EndOfEcWindowInThePast(t *testing.T) { + resetTimes() + setupTimesEndOfEcWindowInThePast((*time.Time)(nil)) + + body := bytes.NewBufferString("YES") + req, _ := http.NewRequest("POST", "/some", body) + policy := DefaultRetryPolicy() + r := mockedRequest{Request: *req, Policy: &policy} + + var timesCalled = 0 + + operation := func(i context.Context, request OCIRequest, binaryRequestBody *OCIReadSeekCloser, extraHeaders map[string]string) (OCIResponse, error) { + timesCalled++ + + request.HTTPRequest("POST", "/some", NewOCIReadSeekCloser(nil), nil) + + httpResponse := http.Response{ + Header: http.Header{}, + StatusCode: 404, + } + response := mockedResponse{ + RawResponse: &httpResponse, + } + err := servicefailure{ + StatusCode: 404, + Code: "NotAuthorizedOrNotFound", + } + + return response, err + } + + Retry(context.Background(), r, operation, *r.Policy) + + assert.Equal(t, 1, timesCalled) +} + +func TestDefaultRetryWithoutEventualConsistency_NoRetryOn404(t *testing.T) { + body := bytes.NewBufferString("YES") + req, _ := http.NewRequest("POST", "/some", body) + policy := DefaultRetryPolicyWithoutEventualConsistency() + r := mockedRequest{Request: *req, Policy: &policy} + + var timesCalled = 0 + + operation := func(i context.Context, request OCIRequest, binaryRequestBody *OCIReadSeekCloser, extraHeaders map[string]string) (OCIResponse, error) { + timesCalled++ + + request.HTTPRequest("POST", "/some", NewOCIReadSeekCloser(nil), nil) + + if timesCalled == 1 { + httpResponse := http.Response{ + Header: http.Header{}, + StatusCode: 404, + } + response := mockedResponse{ + RawResponse: &httpResponse, + } + err := servicefailure{ + StatusCode: 404, + Code: "NotAuthorizedOrNotFound", + } + return response, err + } + httpResponse := http.Response{ + Header: http.Header{}, + StatusCode: 200, + } + return mockedResponse{RawResponse: &httpResponse}, nil + } + + Retry(context.Background(), r, operation, *r.Policy) + + assert.Equal(t, 1, timesCalled) +} + +func TestEcRetry_EcEndsSoonerThanDefaultRetries(t *testing.T) { + resetTimes() + setupTimesEcEndsSoonerThanDefaultRetries((*time.Time)(nil)) + + body := bytes.NewBufferString("YES") + req, _ := http.NewRequest("POST", "/some", body) + policy := DefaultRetryPolicy() + r := mockedRequest{Request: *req, Policy: &policy} + + var timesCalled = 0 + + operation := func(i context.Context, request OCIRequest, binaryRequestBody *OCIReadSeekCloser, extraHeaders map[string]string) (OCIResponse, error) { + timesCalled++ + + request.HTTPRequest("POST", "/some", NewOCIReadSeekCloser(nil), nil) + + if timesCalled == 1 { + httpResponse := http.Response{ + Header: http.Header{}, + StatusCode: 404, + } + response := mockedResponse{ + RawResponse: &httpResponse, + } + err := servicefailure{ + StatusCode: 404, + Code: "NotAuthorizedOrNotFound", + } + return response, err + } + httpResponse := http.Response{ + Header: http.Header{}, + StatusCode: 200, + } + return mockedResponse{RawResponse: &httpResponse}, nil + } + + Retry(context.Background(), r, operation, *r.Policy) + + assert.Equal(t, 2, timesCalled) +} + +// EC with unlimited attempts + +func TestEcRetry_NoEc_UnlimitedAttempts(t *testing.T) { + resetTimes() + + body := bytes.NewBufferString("YES") + req, _ := http.NewRequest("POST", "/some", body) + policy := NewRetryPolicyWithOptions( + WithUnlimitedAttempts(time.Duration(10)*time.Minute), + WithNextDuration(func(r OCIOperationResponse) time.Duration { + return time.Duration(math.Pow(float64(2), float64(r.AttemptNumber-1))) * time.Second + }), + ) + r := mockedRequest{Request: *req, Policy: &policy} + + var timesCalled = 0 + + operation := func(i context.Context, request OCIRequest, binaryRequestBody *OCIReadSeekCloser, extraHeaders map[string]string) (OCIResponse, error) { + timesCalled++ + + request.HTTPRequest("POST", "/some", NewOCIReadSeekCloser(nil), nil) + + httpResponse := http.Response{ + Header: http.Header{}, + StatusCode: 404, + } + response := mockedResponse{ + RawResponse: &httpResponse, + } + err := servicefailure{ + StatusCode: 404, + Code: "NotAuthorizedOrNotFound", + } + + return response, err + } + + Retry(context.Background(), r, operation, *r.Policy) + + assert.Equal(t, 1, timesCalled) +} + +func TestEcRetry_EndOfEcWindowInThePast_UnlimitedAttempts(t *testing.T) { + resetTimes() + setupTimesEndOfEcWindowInThePast((*time.Time)(nil)) + + body := bytes.NewBufferString("YES") + req, _ := http.NewRequest("POST", "/some", body) + policy := NewRetryPolicyWithOptions( + WithUnlimitedAttempts(time.Duration(10)*time.Minute), + WithNextDuration(func(r OCIOperationResponse) time.Duration { + return time.Duration(math.Pow(float64(2), float64(r.AttemptNumber-1))) * time.Second + }), + ) + r := mockedRequest{Request: *req, Policy: &policy} + + var timesCalled = 0 + + operation := func(i context.Context, request OCIRequest, binaryRequestBody *OCIReadSeekCloser, extraHeaders map[string]string) (OCIResponse, error) { + timesCalled++ + + request.HTTPRequest("POST", "/some", NewOCIReadSeekCloser(nil), nil) + + httpResponse := http.Response{ + Header: http.Header{}, + StatusCode: 404, + } + response := mockedResponse{ + RawResponse: &httpResponse, + } + err := servicefailure{ + StatusCode: 404, + Code: "NotAuthorizedOrNotFound", + } + + return response, err + } + + Retry(context.Background(), r, operation, *r.Policy) + + assert.Equal(t, 1, timesCalled) +} + +func TestDefaultRetryWithoutEventualConsistency_NoRetryOn404_UnlimitedAttempts(t *testing.T) { + body := bytes.NewBufferString("YES") + req, _ := http.NewRequest("POST", "/some", body) + policy := NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(DefaultRetryPolicyWithoutEventualConsistency()), + WithUnlimitedAttempts(time.Duration(10)*time.Minute), + WithNextDuration(func(r OCIOperationResponse) time.Duration { + return time.Duration(math.Pow(float64(2), float64(r.AttemptNumber-1))) * time.Second + }), + ) + + r := mockedRequest{Request: *req, Policy: &policy} + + var timesCalled = 0 + + operation := func(i context.Context, request OCIRequest, binaryRequestBody *OCIReadSeekCloser, extraHeaders map[string]string) (OCIResponse, error) { + timesCalled++ + + request.HTTPRequest("POST", "/some", NewOCIReadSeekCloser(nil), nil) + + if timesCalled == 1 { + httpResponse := http.Response{ + Header: http.Header{}, + StatusCode: 404, + } + response := mockedResponse{ + RawResponse: &httpResponse, + } + err := servicefailure{ + StatusCode: 404, + Code: "NotAuthorizedOrNotFound", + } + return response, err + } + httpResponse := http.Response{ + Header: http.Header{}, + StatusCode: 200, + } + return mockedResponse{RawResponse: &httpResponse}, nil + } + + Retry(context.Background(), r, operation, *r.Policy) + + assert.Equal(t, 1, timesCalled) +} + +func TestEcRetry_EcEndsSoonerThanDefaultRetries_UnlimitedAttempts(t *testing.T) { + resetTimes() + setupTimesEcEndsSoonerThanDefaultRetries((*time.Time)(nil)) + + body := bytes.NewBufferString("YES") + req, _ := http.NewRequest("POST", "/some", body) + policy := NewRetryPolicyWithOptions( + WithUnlimitedAttempts(time.Duration(2)*time.Minute), + WithNextDuration(func(r OCIOperationResponse) time.Duration { + return time.Duration(math.Pow(float64(2), float64(r.AttemptNumber-1))) * time.Second + }), + ) + r := mockedRequest{Request: *req, Policy: &policy} + + var timesCalled = 0 + + operation := func(i context.Context, request OCIRequest, binaryRequestBody *OCIReadSeekCloser, extraHeaders map[string]string) (OCIResponse, error) { + timesCalled++ + + request.HTTPRequest("POST", "/some", NewOCIReadSeekCloser(nil), nil) + + if timesCalled == 1 { + httpResponse := http.Response{ + Header: http.Header{}, + StatusCode: 404, + } + response := mockedResponse{ + RawResponse: &httpResponse, + } + err := servicefailure{ + StatusCode: 404, + Code: "NotAuthorizedOrNotFound", + } + return response, err + } + httpResponse := http.Response{ + Header: http.Header{}, + StatusCode: 200, + } + return mockedResponse{RawResponse: &httpResponse}, nil + } + + Retry(context.Background(), r, operation, *r.Policy) + + assert.Equal(t, 2, timesCalled) +} + +// more tests + +func TestRetryPolicyBuilder(t *testing.T) { + var rp = DefaultRetryPolicyWithoutEventualConsistency() + assert.Equal(t, defaultMaximumNumberAttempts, rp.MaximumNumberAttempts) + assert.Equal(t, defaultMinSleepBetween, rp.MinSleepBetween) + assert.Equal(t, defaultMaxSleepBetween, rp.MaxSleepBetween) + assert.Equal(t, defaultExponentialBackoffBase, rp.ExponentialBackoffBase) + assert.Equal(t, (*RetryPolicy)(nil), rp.NonEventuallyConsistentPolicy) + + rp = NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(rp), + WithConditionalOption(true, WithMaximumNumberAttempts(4))) + assert.Equal(t, uint(4), rp.MaximumNumberAttempts) + assert.Equal(t, defaultMinSleepBetween, rp.MinSleepBetween) + assert.Equal(t, defaultMaxSleepBetween, rp.MaxSleepBetween) + assert.Equal(t, defaultExponentialBackoffBase, rp.ExponentialBackoffBase) + assert.Equal(t, (*RetryPolicy)(nil), rp.NonEventuallyConsistentPolicy) + + rp = NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(rp), + WithConditionalOption(false, WithMaximumNumberAttempts(5))) + assert.Equal(t, uint(4), rp.MaximumNumberAttempts) + assert.Equal(t, defaultMinSleepBetween, rp.MinSleepBetween) + assert.Equal(t, defaultMaxSleepBetween, rp.MaxSleepBetween) + assert.Equal(t, defaultExponentialBackoffBase, rp.ExponentialBackoffBase) + assert.Equal(t, (*RetryPolicy)(nil), rp.NonEventuallyConsistentPolicy) + + rp = NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(rp), + WithMaximumNumberAttempts(5)) + assert.Equal(t, uint(5), rp.MaximumNumberAttempts) + assert.Equal(t, defaultMinSleepBetween, rp.MinSleepBetween) + assert.Equal(t, defaultMaxSleepBetween, rp.MaxSleepBetween) + assert.Equal(t, defaultExponentialBackoffBase, rp.ExponentialBackoffBase) + assert.Equal(t, (*RetryPolicy)(nil), rp.NonEventuallyConsistentPolicy) + + assertNextDurationIsBetween(t, rp, 1, 1*time.Second, 2*time.Second) + assertNextDurationIsBetween(t, rp, 2, 2*time.Second, 3*time.Second) + assertNextDurationIsBetween(t, rp, 3, 4*time.Second, 5*time.Second) + assertNextDurationIsBetween(t, rp, 4, 8*time.Second, 9*time.Second) + assertNextDurationIsBetween(t, rp, 5, 16*time.Second, 17*time.Second) + assertNextDurationIsBetween(t, rp, 6, 30*time.Second, 31*time.Second) // hit the max + assertNextDurationIsBetween(t, rp, 7, 30*time.Second, 31*time.Second) + + rp = NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(rp), + WithExponentialBackoff(45*time.Second, rp.ExponentialBackoffBase)) + assert.Equal(t, uint(5), rp.MaximumNumberAttempts) + assert.Equal(t, float64(45), rp.MaxSleepBetween) + assert.Equal(t, defaultExponentialBackoffBase, rp.ExponentialBackoffBase) + assert.Equal(t, (*RetryPolicy)(nil), rp.NonEventuallyConsistentPolicy) + + assertNextDurationIsBetween(t, rp, 1, 1*time.Second, 2*time.Second) + assertNextDurationIsBetween(t, rp, 2, 2*time.Second, 3*time.Second) + assertNextDurationIsBetween(t, rp, 3, 4*time.Second, 5*time.Second) + assertNextDurationIsBetween(t, rp, 4, 8*time.Second, 9*time.Second) + assertNextDurationIsBetween(t, rp, 5, 16*time.Second, 17*time.Second) + assertNextDurationIsBetween(t, rp, 6, 32*time.Second, 33*time.Second) + assertNextDurationIsBetween(t, rp, 7, 45*time.Second, 46*time.Second) // hit the max + + rp = NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(rp), + WithExponentialBackoff(45*time.Second, 3)) + assert.Equal(t, uint(5), rp.MaximumNumberAttempts) + assert.Equal(t, defaultMinSleepBetween, rp.MinSleepBetween) + assert.Equal(t, float64(45), rp.MaxSleepBetween) + assert.Equal(t, 3.0, rp.ExponentialBackoffBase) + assert.Equal(t, (*RetryPolicy)(nil), rp.NonEventuallyConsistentPolicy) + + assertNextDurationIsBetween(t, rp, 1, 1*time.Second, 2*time.Second) + assertNextDurationIsBetween(t, rp, 2, 3*time.Second, 4*time.Second) + assertNextDurationIsBetween(t, rp, 3, 9*time.Second, 10*time.Second) + assertNextDurationIsBetween(t, rp, 4, 27*time.Second, 28*time.Second) + assertNextDurationIsBetween(t, rp, 5, 45*time.Second, 46*time.Second) // hit the max + assertNextDurationIsBetween(t, rp, 6, 45*time.Second, 46*time.Second) + assertNextDurationIsBetween(t, rp, 7, 45*time.Second, 46*time.Second) + + assert.Equal(t, (1+3+9+27)*time.Second, GetMaximumCumulativeBackoffWithoutJitter(rp)) + assert.Equal(t, (1+3+9+27)*time.Second, rp.GetMaximumCumulativeBackoffWithoutJitter()) + + rp = NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(rp), + WithFixedBackoff(5*time.Second)) + assert.Equal(t, uint(5), rp.MaximumNumberAttempts) + assert.Equal(t, float64(5), rp.MinSleepBetween) + assert.Equal(t, float64(5), rp.MaxSleepBetween) + assert.Equal(t, 1.0, rp.ExponentialBackoffBase) + assert.Equal(t, (*RetryPolicy)(nil), rp.NonEventuallyConsistentPolicy) + + assertNextDurationIsEqual(t, rp, 1, 5*time.Second) + assertNextDurationIsEqual(t, rp, 2, 5*time.Second) + assertNextDurationIsEqual(t, rp, 3, 5*time.Second) + assertNextDurationIsEqual(t, rp, 4, 5*time.Second) + assertNextDurationIsEqual(t, rp, 5, 5*time.Second) + assertNextDurationIsEqual(t, rp, 6, 5*time.Second) + assertNextDurationIsEqual(t, rp, 7, 5*time.Second) + + assert.Equal(t, (5+5+5+5)*time.Second, GetMaximumCumulativeBackoffWithoutJitter(rp)) + assert.Equal(t, (5+5+5+5)*time.Second, rp.GetMaximumCumulativeBackoffWithoutJitter()) + + rp = NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(rp), + WithExponentialBackoff(45*time.Second, defaultExponentialBackoffBase)) + + var ecrp = NewRetryPolicyWithOptions( + ReplaceWithValuesFromRetryPolicy(rp), + WithEventualConsistency()) + assert.Equal(t, ecMaximumNumberAttempts, ecrp.MaximumNumberAttempts) + assert.Equal(t, ecMinSleepBetween, ecrp.MinSleepBetween) + assert.Equal(t, ecMaxSleepBetween, ecrp.MaxSleepBetween) + assert.Equal(t, ecExponentialBackoffBase, ecrp.ExponentialBackoffBase) + assertEqualRetryPolicies(t, rp, *ecrp.NonEventuallyConsistentPolicy) + + rp = NewRetryPolicyWithOptions() + assertEqualRetryPolicies(t, DefaultRetryPolicy(), rp) +} + +func assertNextDurationIsBetween(t *testing.T, rp RetryPolicy, attempt uint, min time.Duration, max time.Duration) { + response := getMockedOCIOperationResponse(500, attempt) + nextDuration := rp.NextDuration(response) + assert.True(t, min <= nextDuration && nextDuration < max) +} + +func assertNextDurationIsEqual(t *testing.T, rp RetryPolicy, attempt uint, duration time.Duration) { + response := getMockedOCIOperationResponse(500, attempt) + nextDuration := rp.NextDuration(response) + assert.Equal(t, duration, nextDuration) +} + +func TestRetryPolicy_DeterminePolicyToUseNil(t *testing.T) { + var shouldRetry = true + retryPolicy := &RetryPolicy{ + MaximumNumberAttempts: 0, + ShouldRetryOperation: func(response OCIOperationResponse) bool { + prev := shouldRetry + shouldRetry = false + return prev + }, + NextDuration: func(response OCIOperationResponse) time.Duration { + return 1 * time.Second + }, + } + + resetTimes() + + body := bytes.NewBufferString("YES") + req, _ := http.NewRequest("POST", "/some", body) + r := mockedRequest{Request: *req, Policy: retryPolicy} + + var timesCalled = 0 + + operation := func(i context.Context, request OCIRequest, binaryRequestBody *OCIReadSeekCloser, extraHeaders map[string]string) (OCIResponse, error) { + timesCalled++ + + request.HTTPRequest("POST", "/some", NewOCIReadSeekCloser(nil), nil) + + httpResponse := http.Response{ + Header: http.Header{}, + StatusCode: 404, + } + response := mockedResponse{ + RawResponse: &httpResponse, + } + err := servicefailure{ + StatusCode: 404, + Code: "NotAuthorizedOrNotFound", + } + + return response, err + } + + Retry(context.Background(), r, operation, *r.Policy) + + assert.Equal(t, 2, timesCalled) +} + +func TestRetryPolicy_Validate(t *testing.T) { + var rp = DefaultRetryPolicyWithoutEventualConsistency() + var result, err = rp.validate() + assert.True(t, result) + assert.Equal(t, nil, err) + + rp = NoRetryPolicy() + result, err = rp.validate() + assert.True(t, result) + assert.Equal(t, nil, err) + + rp = DefaultRetryPolicy() + result, err = rp.validate() + assert.True(t, result) + assert.Equal(t, nil, err) + + rp = RetryPolicy{ + MaximumNumberAttempts: 0, + ShouldRetryOperation: func(response OCIOperationResponse) bool { + return false + }, + NextDuration: func(response OCIOperationResponse) time.Duration { + return 0 * time.Second + }, + } + result, err = rp.validate() + assert.True(t, result) + assert.Equal(t, nil, err) + + rp = RetryPolicy{ + MaximumNumberAttempts: 0, + NextDuration: func(response OCIOperationResponse) time.Duration { + return 0 * time.Second + }, + } + result, err = rp.validate() + assert.False(t, result) + assert.True(t, strings.Contains(err.Error(), "ShouldRetryOperation")) + + rp = RetryPolicy{ + MaximumNumberAttempts: 0, + ShouldRetryOperation: func(response OCIOperationResponse) bool { + return false + }, + } + result, err = rp.validate() + assert.False(t, result) + assert.True(t, strings.Contains(err.Error(), "NextDuration")) + + rp = RetryPolicy{ + MaximumNumberAttempts: 0, + } + result, err = rp.validate() + assert.False(t, result) + assert.True(t, strings.Contains(err.Error(), "ShouldRetryOperation")) + assert.True(t, strings.Contains(err.Error(), "NextDuration")) +} + +func TestRetryPolicy_RetryWithBadRetryPolicy(t *testing.T) { + retryPolicy := &RetryPolicy{ + MaximumNumberAttempts: 0, + NextDuration: func(response OCIOperationResponse) time.Duration { + return 1 * time.Second + }, + } + + resetTimes() + + body := bytes.NewBufferString("YES") + req, _ := http.NewRequest("POST", "/some", body) + r := mockedRequest{Request: *req, Policy: retryPolicy} + + var timesCalled = 0 + + operation := func(i context.Context, request OCIRequest, binaryRequestBody *OCIReadSeekCloser, extraHeaders map[string]string) (OCIResponse, error) { + timesCalled++ + + request.HTTPRequest("POST", "/some", NewOCIReadSeekCloser(nil), nil) + + httpResponse := http.Response{ + Header: http.Header{}, + StatusCode: 404, + } + response := mockedResponse{ + RawResponse: &httpResponse, + } + err := servicefailure{ + StatusCode: 404, + Code: "NotAuthorizedOrNotFound", + } + + return response, err + } + + _, error := Retry(context.Background(), r, operation, *r.Policy) + + assert.True(t, strings.Contains(error.Error(), "ShouldRetryOperation")) +} diff --git a/common/version.go b/common/version.go index c99d29e677..968501cb96 100644 --- a/common/version.go +++ b/common/version.go @@ -12,7 +12,7 @@ import ( const ( major = "46" - minor = "1" + minor = "2" patch = "0" tag = "" ) diff --git a/datacatalog/attach_catalog_private_endpoint_details.go b/datacatalog/attach_catalog_private_endpoint_details.go index bdb7417858..2ec56693b0 100644 --- a/datacatalog/attach_catalog_private_endpoint_details.go +++ b/datacatalog/attach_catalog_private_endpoint_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/attribute.go b/datacatalog/attribute.go index 4b1c3027c0..e3348e47f0 100644 --- a/datacatalog/attribute.go +++ b/datacatalog/attribute.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/attribute_collection.go b/datacatalog/attribute_collection.go index 63ed61dd00..0951873383 100644 --- a/datacatalog/attribute_collection.go +++ b/datacatalog/attribute_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/attribute_summary.go b/datacatalog/attribute_summary.go index 0e6c3d9432..57587805a1 100644 --- a/datacatalog/attribute_summary.go +++ b/datacatalog/attribute_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog @@ -38,6 +39,9 @@ type AttributeSummary struct { // Max allowed length of the attribute value. Length *int64 `mandatory:"false" json:"length"` + // Position of the attribute in the record definition. + Position *int `mandatory:"false" json:"position"` + // Precision of the attribute value usually applies to float data type. Precision *int `mandatory:"false" json:"precision"` @@ -94,6 +98,13 @@ type AttributeSummary struct { // The last time that any change was made to the attribute. An RFC3339 (https://tools.ietf.org/html/rfc3339) formatted datetime string. TimeUpdated *common.SDKTime `mandatory:"false" json:"timeUpdated"` + + // A map of maps that contains the properties which are specific to the attribute type. Each attribute type + // definition defines it's set of required and optional properties. The map keys are category names and the + // values are maps of property name to property value. Every property is contained inside of a category. Most + // attributes have required properties within the "default" category. + // Example: `{"properties": { "default": { "key1": "value1"}}}` + Properties map[string]map[string]string `mandatory:"false" json:"properties"` } func (m AttributeSummary) String() string { diff --git a/datacatalog/attribute_tag.go b/datacatalog/attribute_tag.go index 3e22ed8738..24c2372c51 100644 --- a/datacatalog/attribute_tag.go +++ b/datacatalog/attribute_tag.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/attribute_tag_collection.go b/datacatalog/attribute_tag_collection.go index 00147ebbd8..fa00ac96d1 100644 --- a/datacatalog/attribute_tag_collection.go +++ b/datacatalog/attribute_tag_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/attribute_tag_summary.go b/datacatalog/attribute_tag_summary.go index 5f6233673c..0ae5ebe620 100644 --- a/datacatalog/attribute_tag_summary.go +++ b/datacatalog/attribute_tag_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/base_permissions_summary.go b/datacatalog/base_permissions_summary.go index d46f76c904..0d419f5a7b 100644 --- a/datacatalog/base_permissions_summary.go +++ b/datacatalog/base_permissions_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/base_tag.go b/datacatalog/base_tag.go index 0165bd5daa..2075fdaed6 100644 --- a/datacatalog/base_tag.go +++ b/datacatalog/base_tag.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/base_tag_summary.go b/datacatalog/base_tag_summary.go index 93efadb3be..d9c669fec0 100644 --- a/datacatalog/base_tag_summary.go +++ b/datacatalog/base_tag_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/catalog.go b/datacatalog/catalog.go index e8a5753d53..95a64f6c8d 100644 --- a/datacatalog/catalog.go +++ b/datacatalog/catalog.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/catalog_permissions_summary.go b/datacatalog/catalog_permissions_summary.go index 3a4939835d..b060d5a246 100644 --- a/datacatalog/catalog_permissions_summary.go +++ b/datacatalog/catalog_permissions_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/catalog_private_endpoint.go b/datacatalog/catalog_private_endpoint.go index 57cdf2f5cf..d5f919b54b 100644 --- a/datacatalog/catalog_private_endpoint.go +++ b/datacatalog/catalog_private_endpoint.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/catalog_private_endpoint_summary.go b/datacatalog/catalog_private_endpoint_summary.go index c11748d50e..09aa4688ad 100644 --- a/datacatalog/catalog_private_endpoint_summary.go +++ b/datacatalog/catalog_private_endpoint_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/catalog_summary.go b/datacatalog/catalog_summary.go index 3748bc2e3c..a67c1f5357 100644 --- a/datacatalog/catalog_summary.go +++ b/datacatalog/catalog_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/change_catalog_compartment_details.go b/datacatalog/change_catalog_compartment_details.go index 564f43deeb..2d131e9bfd 100644 --- a/datacatalog/change_catalog_compartment_details.go +++ b/datacatalog/change_catalog_compartment_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/change_catalog_private_endpoint_compartment_details.go b/datacatalog/change_catalog_private_endpoint_compartment_details.go index e01227ebc1..c3ff0f8a26 100644 --- a/datacatalog/change_catalog_private_endpoint_compartment_details.go +++ b/datacatalog/change_catalog_private_endpoint_compartment_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/change_metastore_compartment_details.go b/datacatalog/change_metastore_compartment_details.go index 7d712af856..41a029b6cd 100644 --- a/datacatalog/change_metastore_compartment_details.go +++ b/datacatalog/change_metastore_compartment_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/connection.go b/datacatalog/connection.go index 44196ae180..2a8909fdc8 100644 --- a/datacatalog/connection.go +++ b/datacatalog/connection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/connection_alias_summary.go b/datacatalog/connection_alias_summary.go index 4384edf8c9..990b9d6216 100644 --- a/datacatalog/connection_alias_summary.go +++ b/datacatalog/connection_alias_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/connection_collection.go b/datacatalog/connection_collection.go index 6c4cc31a48..5527ac308d 100644 --- a/datacatalog/connection_collection.go +++ b/datacatalog/connection_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/connection_result.go b/datacatalog/connection_result.go index f1afd422c1..7139aed2b6 100644 --- a/datacatalog/connection_result.go +++ b/datacatalog/connection_result.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/connection_summary.go b/datacatalog/connection_summary.go index 6613e9b953..6c206b055e 100644 --- a/datacatalog/connection_summary.go +++ b/datacatalog/connection_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_attribute_details.go b/datacatalog/create_attribute_details.go index 23957a2d53..aef1c0c800 100644 --- a/datacatalog/create_attribute_details.go +++ b/datacatalog/create_attribute_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_catalog_details.go b/datacatalog/create_catalog_details.go index 81ede3b5ca..d504146c92 100644 --- a/datacatalog/create_catalog_details.go +++ b/datacatalog/create_catalog_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_catalog_private_endpoint_details.go b/datacatalog/create_catalog_private_endpoint_details.go index 2eac868b95..8c5413ce11 100644 --- a/datacatalog/create_catalog_private_endpoint_details.go +++ b/datacatalog/create_catalog_private_endpoint_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_connection_details.go b/datacatalog/create_connection_details.go index ed50cdb408..551bf26c67 100644 --- a/datacatalog/create_connection_details.go +++ b/datacatalog/create_connection_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_custom_property_details.go b/datacatalog/create_custom_property_details.go index b1e64ae757..791a3a07b6 100644 --- a/datacatalog/create_custom_property_details.go +++ b/datacatalog/create_custom_property_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_data_asset_details.go b/datacatalog/create_data_asset_details.go index a96efa1433..9af7c69cf1 100644 --- a/datacatalog/create_data_asset_details.go +++ b/datacatalog/create_data_asset_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_entity_details.go b/datacatalog/create_entity_details.go index 8cfd575c25..9b575b4a14 100644 --- a/datacatalog/create_entity_details.go +++ b/datacatalog/create_entity_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_folder_details.go b/datacatalog/create_folder_details.go index 60c2114ff5..bfef9e1c07 100644 --- a/datacatalog/create_folder_details.go +++ b/datacatalog/create_folder_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_glossary_details.go b/datacatalog/create_glossary_details.go index 77847a9546..18d796bff6 100644 --- a/datacatalog/create_glossary_details.go +++ b/datacatalog/create_glossary_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_job_definition_details.go b/datacatalog/create_job_definition_details.go index 83bf043cb8..9772a667d3 100644 --- a/datacatalog/create_job_definition_details.go +++ b/datacatalog/create_job_definition_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_job_details.go b/datacatalog/create_job_details.go index 07007b39d8..9c61c9710d 100644 --- a/datacatalog/create_job_details.go +++ b/datacatalog/create_job_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_job_execution_details.go b/datacatalog/create_job_execution_details.go index 1670e7a890..ed928977be 100644 --- a/datacatalog/create_job_execution_details.go +++ b/datacatalog/create_job_execution_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_metastore_details.go b/datacatalog/create_metastore_details.go index e40805202f..4e04e1c610 100644 --- a/datacatalog/create_metastore_details.go +++ b/datacatalog/create_metastore_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_namespace_details.go b/datacatalog/create_namespace_details.go index ed0028fcfb..231a854147 100644 --- a/datacatalog/create_namespace_details.go +++ b/datacatalog/create_namespace_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_pattern_details.go b/datacatalog/create_pattern_details.go index e30ceccbfb..3418f10ffe 100644 --- a/datacatalog/create_pattern_details.go +++ b/datacatalog/create_pattern_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_tag_details.go b/datacatalog/create_tag_details.go index fe0b4f4304..abaca6579b 100644 --- a/datacatalog/create_tag_details.go +++ b/datacatalog/create_tag_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_term_details.go b/datacatalog/create_term_details.go index 16e1d28025..97d7a5c8d3 100644 --- a/datacatalog/create_term_details.go +++ b/datacatalog/create_term_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/create_term_relationship_details.go b/datacatalog/create_term_relationship_details.go index c0ed5d64cc..99fceeb598 100644 --- a/datacatalog/create_term_relationship_details.go +++ b/datacatalog/create_term_relationship_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/custom_property.go b/datacatalog/custom_property.go index 8ecf45a376..710064c7ff 100644 --- a/datacatalog/custom_property.go +++ b/datacatalog/custom_property.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog @@ -80,12 +81,15 @@ type CustomProperty struct { // If an OCI Event will be emitted when the custom property is modified. IsEventEnabled *bool `mandatory:"false" json:"isEventEnabled"` - // Type or scope of the custom property belongs to. This will be an array of type id it will be belongs to + // The set of object types to which the custom property applies. Scope []CustomPropertyTypeUsage `mandatory:"false" json:"scope"` // Allowed values for the custom property if any AllowedValues []string `mandatory:"false" json:"allowedValues"` + // Event configuration for this custom property, against the desired subset of object types to which the property applies. + Events []EventConfig `mandatory:"false" json:"events"` + // A map of maps that contains the properties which are specific to the asset type. Each data asset type // definition defines it's set of required and optional properties. The map keys are category names and the // values are maps of property name to property value. Every property is contained inside of a category. Most diff --git a/datacatalog/custom_property_collection.go b/datacatalog/custom_property_collection.go index 2d29b464d9..8f77a7bc7b 100644 --- a/datacatalog/custom_property_collection.go +++ b/datacatalog/custom_property_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/custom_property_data_type.go b/datacatalog/custom_property_data_type.go index 788698ccb6..f6c73db7b5 100644 --- a/datacatalog/custom_property_data_type.go +++ b/datacatalog/custom_property_data_type.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/custom_property_get_usage.go b/datacatalog/custom_property_get_usage.go index bc0ad9bbd9..df498961c6 100644 --- a/datacatalog/custom_property_get_usage.go +++ b/datacatalog/custom_property_get_usage.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/custom_property_set_usage.go b/datacatalog/custom_property_set_usage.go index 61034b587a..644dc60533 100644 --- a/datacatalog/custom_property_set_usage.go +++ b/datacatalog/custom_property_set_usage.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/custom_property_summary.go b/datacatalog/custom_property_summary.go index cdc88b701c..745aa34984 100644 --- a/datacatalog/custom_property_summary.go +++ b/datacatalog/custom_property_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog @@ -82,6 +83,9 @@ type CustomPropertySummary struct { // If an OCI Event will be emitted when the custom property is modified. IsEventEnabled *bool `mandatory:"false" json:"isEventEnabled"` + + // Event configuration for this custom property, against the desired subset of object types to which the property applies. + Events []EventConfig `mandatory:"false" json:"events"` } func (m CustomPropertySummary) String() string { diff --git a/datacatalog/custom_property_type_usage.go b/datacatalog/custom_property_type_usage.go index 231b81f330..c4068ff1a0 100644 --- a/datacatalog/custom_property_type_usage.go +++ b/datacatalog/custom_property_type_usage.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/data_asset.go b/datacatalog/data_asset.go index d2c65af943..f2617bfbfb 100644 --- a/datacatalog/data_asset.go +++ b/datacatalog/data_asset.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/data_asset_collection.go b/datacatalog/data_asset_collection.go index 930f2475bd..d567cb5701 100644 --- a/datacatalog/data_asset_collection.go +++ b/datacatalog/data_asset_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/data_asset_export_scope.go b/datacatalog/data_asset_export_scope.go index 85ff4bbafa..3fd2be1a1e 100644 --- a/datacatalog/data_asset_export_scope.go +++ b/datacatalog/data_asset_export_scope.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/data_asset_import_export_type_filter.go b/datacatalog/data_asset_import_export_type_filter.go index f0b5d93a56..cdabf2baf8 100644 --- a/datacatalog/data_asset_import_export_type_filter.go +++ b/datacatalog/data_asset_import_export_type_filter.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/data_asset_permissions_summary.go b/datacatalog/data_asset_permissions_summary.go index e62237f8f8..6e48e12829 100644 --- a/datacatalog/data_asset_permissions_summary.go +++ b/datacatalog/data_asset_permissions_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/data_asset_summary.go b/datacatalog/data_asset_summary.go index ab41c6959c..32a4acb2da 100644 --- a/datacatalog/data_asset_summary.go +++ b/datacatalog/data_asset_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/data_asset_tag.go b/datacatalog/data_asset_tag.go index 16d5ea18b6..036503cfe2 100644 --- a/datacatalog/data_asset_tag.go +++ b/datacatalog/data_asset_tag.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/data_asset_tag_collection.go b/datacatalog/data_asset_tag_collection.go index 20612434f1..4fea254681 100644 --- a/datacatalog/data_asset_tag_collection.go +++ b/datacatalog/data_asset_tag_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/data_asset_tag_summary.go b/datacatalog/data_asset_tag_summary.go index 051e214df7..d76236f3f6 100644 --- a/datacatalog/data_asset_tag_summary.go +++ b/datacatalog/data_asset_tag_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/data_selector_pattern_details.go b/datacatalog/data_selector_pattern_details.go index 745bc91b50..9f718268c5 100644 --- a/datacatalog/data_selector_pattern_details.go +++ b/datacatalog/data_selector_pattern_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/datacatalog_client.go b/datacatalog/datacatalog_client.go index d79cf43228..b9e3066753 100644 --- a/datacatalog/datacatalog_client.go +++ b/datacatalog/datacatalog_client.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/derived_logical_entities.go b/datacatalog/derived_logical_entities.go index b63d8833f7..fb327acdce 100644 --- a/datacatalog/derived_logical_entities.go +++ b/datacatalog/derived_logical_entities.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/detach_catalog_private_endpoint_details.go b/datacatalog/detach_catalog_private_endpoint_details.go index 92d190c424..7bddc9e21c 100644 --- a/datacatalog/detach_catalog_private_endpoint_details.go +++ b/datacatalog/detach_catalog_private_endpoint_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/entity.go b/datacatalog/entity.go index f8abf007c0..e36b9267b0 100644 --- a/datacatalog/entity.go +++ b/datacatalog/entity.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/entity_collection.go b/datacatalog/entity_collection.go index 2d24cfd325..a18d9340a7 100644 --- a/datacatalog/entity_collection.go +++ b/datacatalog/entity_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/entity_summary.go b/datacatalog/entity_summary.go index 0830dfecc8..1feb7c8b60 100644 --- a/datacatalog/entity_summary.go +++ b/datacatalog/entity_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/entity_tag.go b/datacatalog/entity_tag.go index df9421cea4..bb167ebd05 100644 --- a/datacatalog/entity_tag.go +++ b/datacatalog/entity_tag.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/entity_tag_collection.go b/datacatalog/entity_tag_collection.go index 26164b57a2..4e41c5bf71 100644 --- a/datacatalog/entity_tag_collection.go +++ b/datacatalog/entity_tag_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/entity_tag_summary.go b/datacatalog/entity_tag_summary.go index b9ba64c6fe..e7a74b7e9d 100644 --- a/datacatalog/entity_tag_summary.go +++ b/datacatalog/entity_tag_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/event_config.go b/datacatalog/event_config.go new file mode 100644 index 0000000000..2b89a74043 --- /dev/null +++ b/datacatalog/event_config.go @@ -0,0 +1,51 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Data Catalog API +// +// Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). +// + +package datacatalog + +import ( + "github.com/oracle/oci-go-sdk/v46/common" +) + +// EventConfig Describes an event configuration, for a given object type and property. Primarily, whether a property change will result in an event being emitted. +type EventConfig struct { + + // Unique type key identifier. + TypeId *string `mandatory:"false" json:"typeId"` + + // Name of the type. + TypeName *string `mandatory:"false" json:"typeName"` + + // Unique property key identifier. + PropertyId *string `mandatory:"false" json:"propertyId"` + + // Name of the property. + PropertyName *string `mandatory:"false" json:"propertyName"` + + // Status of the configuration. + EventConfigStatus EventConfigStatusEnum `mandatory:"false" json:"eventConfigStatus,omitempty"` + + // The date and time the event was configured, in the format defined by RFC3339 (https://tools.ietf.org/html/rfc3339). + // Example: `2019-03-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // The last time that any change was made to the configuration. An RFC3339 (https://tools.ietf.org/html/rfc3339) formatted datetime string. + TimeUpdated *common.SDKTime `mandatory:"false" json:"timeUpdated"` + + // OCID of the user who created the configuration. + CreatedById *string `mandatory:"false" json:"createdById"` + + // OCID of the user who last modified the configuration. + UpdatedById *string `mandatory:"false" json:"updatedById"` +} + +func (m EventConfig) String() string { + return common.PointerString(m) +} diff --git a/datacatalog/event_config_status.go b/datacatalog/event_config_status.go new file mode 100644 index 0000000000..9760904a8d --- /dev/null +++ b/datacatalog/event_config_status.go @@ -0,0 +1,34 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Data Catalog API +// +// Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). +// + +package datacatalog + +// EventConfigStatusEnum Enum with underlying type: string +type EventConfigStatusEnum string + +// Set of constants representing the allowable values for EventConfigStatusEnum +const ( + EventConfigStatusEnabled EventConfigStatusEnum = "ENABLED" + EventConfigStatusDisabled EventConfigStatusEnum = "DISABLED" +) + +var mappingEventConfigStatus = map[string]EventConfigStatusEnum{ + "ENABLED": EventConfigStatusEnabled, + "DISABLED": EventConfigStatusDisabled, +} + +// GetEventConfigStatusEnumValues Enumerates the set of values for EventConfigStatusEnum +func GetEventConfigStatusEnumValues() []EventConfigStatusEnum { + values := make([]EventConfigStatusEnum, 0) + for _, v := range mappingEventConfigStatus { + values = append(values, v) + } + return values +} diff --git a/datacatalog/export_data_asset_details.go b/datacatalog/export_data_asset_details.go index cc181e87b8..adf6f60e72 100644 --- a/datacatalog/export_data_asset_details.go +++ b/datacatalog/export_data_asset_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/faceted_search_aggregation.go b/datacatalog/faceted_search_aggregation.go index a40c3c5f60..5a291fb1c9 100644 --- a/datacatalog/faceted_search_aggregation.go +++ b/datacatalog/faceted_search_aggregation.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/faceted_search_custom_property.go b/datacatalog/faceted_search_custom_property.go index b0686021cd..df4e29c4cf 100644 --- a/datacatalog/faceted_search_custom_property.go +++ b/datacatalog/faceted_search_custom_property.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/faceted_search_date_filter_request.go b/datacatalog/faceted_search_date_filter_request.go index ae04c226ba..6c34a663fc 100644 --- a/datacatalog/faceted_search_date_filter_request.go +++ b/datacatalog/faceted_search_date_filter_request.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/faceted_search_filter_request.go b/datacatalog/faceted_search_filter_request.go index 503bab6121..d363b019f1 100644 --- a/datacatalog/faceted_search_filter_request.go +++ b/datacatalog/faceted_search_filter_request.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/faceted_search_sort_request.go b/datacatalog/faceted_search_sort_request.go index 13cbb80efb..84665f3291 100644 --- a/datacatalog/faceted_search_sort_request.go +++ b/datacatalog/faceted_search_sort_request.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/faceted_search_string_filter_request.go b/datacatalog/faceted_search_string_filter_request.go index a7b038d7be..c225f4e68b 100644 --- a/datacatalog/faceted_search_string_filter_request.go +++ b/datacatalog/faceted_search_string_filter_request.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/folder.go b/datacatalog/folder.go index 4299c5f4af..e6d43970c3 100644 --- a/datacatalog/folder.go +++ b/datacatalog/folder.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/folder_collection.go b/datacatalog/folder_collection.go index 4aeac13df9..f7d2cee475 100644 --- a/datacatalog/folder_collection.go +++ b/datacatalog/folder_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/folder_summary.go b/datacatalog/folder_summary.go index 80b0219f9a..3236a51dfd 100644 --- a/datacatalog/folder_summary.go +++ b/datacatalog/folder_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/folder_tag.go b/datacatalog/folder_tag.go index 18b86f8ad0..cb211a29fc 100644 --- a/datacatalog/folder_tag.go +++ b/datacatalog/folder_tag.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/folder_tag_collection.go b/datacatalog/folder_tag_collection.go index 9a99f0fe51..7feb76ced3 100644 --- a/datacatalog/folder_tag_collection.go +++ b/datacatalog/folder_tag_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/folder_tag_summary.go b/datacatalog/folder_tag_summary.go index e0bc3b7e6d..ccbc372334 100644 --- a/datacatalog/folder_tag_summary.go +++ b/datacatalog/folder_tag_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/glossary.go b/datacatalog/glossary.go index 60cec71ce8..3d567c0792 100644 --- a/datacatalog/glossary.go +++ b/datacatalog/glossary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/glossary_collection.go b/datacatalog/glossary_collection.go index a09fbce10a..9c0d12cc86 100644 --- a/datacatalog/glossary_collection.go +++ b/datacatalog/glossary_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/glossary_permissions_summary.go b/datacatalog/glossary_permissions_summary.go index c67f65e023..c70c15007c 100644 --- a/datacatalog/glossary_permissions_summary.go +++ b/datacatalog/glossary_permissions_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/glossary_summary.go b/datacatalog/glossary_summary.go index df00e78430..25c301ee46 100644 --- a/datacatalog/glossary_summary.go +++ b/datacatalog/glossary_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/glossary_tree_element.go b/datacatalog/glossary_tree_element.go index 3524d39fb1..df2f816ad7 100644 --- a/datacatalog/glossary_tree_element.go +++ b/datacatalog/glossary_tree_element.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/harvest_status.go b/datacatalog/harvest_status.go index 8fd2dbc7cb..435a088739 100644 --- a/datacatalog/harvest_status.go +++ b/datacatalog/harvest_status.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/import_connection_details.go b/datacatalog/import_connection_details.go index 979ea8dcc1..652c2be6bf 100644 --- a/datacatalog/import_connection_details.go +++ b/datacatalog/import_connection_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/import_data_asset_details.go b/datacatalog/import_data_asset_details.go index 7b40d54f25..10eb5a7c28 100644 --- a/datacatalog/import_data_asset_details.go +++ b/datacatalog/import_data_asset_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/import_data_asset_job_result.go b/datacatalog/import_data_asset_job_result.go index f35e6c9040..9c4bded3fb 100644 --- a/datacatalog/import_data_asset_job_result.go +++ b/datacatalog/import_data_asset_job_result.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/import_glossary_details.go b/datacatalog/import_glossary_details.go index 40f8c19f3b..a152bcfef8 100644 --- a/datacatalog/import_glossary_details.go +++ b/datacatalog/import_glossary_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job.go b/datacatalog/job.go index 3324492b7d..7c8b2958ab 100644 --- a/datacatalog/job.go +++ b/datacatalog/job.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_collection.go b/datacatalog/job_collection.go index 49b4a7ab41..c9165710df 100644 --- a/datacatalog/job_collection.go +++ b/datacatalog/job_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_definition.go b/datacatalog/job_definition.go index 9323783f4e..cd35156d1f 100644 --- a/datacatalog/job_definition.go +++ b/datacatalog/job_definition.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_definition_collection.go b/datacatalog/job_definition_collection.go index fa9ca112d8..1eb477a6aa 100644 --- a/datacatalog/job_definition_collection.go +++ b/datacatalog/job_definition_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_definition_permissions_summary.go b/datacatalog/job_definition_permissions_summary.go index 8106dd3ac1..5b6f69b071 100644 --- a/datacatalog/job_definition_permissions_summary.go +++ b/datacatalog/job_definition_permissions_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_definition_scope.go b/datacatalog/job_definition_scope.go index df2592d1eb..b32c0d0806 100644 --- a/datacatalog/job_definition_scope.go +++ b/datacatalog/job_definition_scope.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_definition_summary.go b/datacatalog/job_definition_summary.go index 1622476469..a748066e46 100644 --- a/datacatalog/job_definition_summary.go +++ b/datacatalog/job_definition_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_execution.go b/datacatalog/job_execution.go index c248b73fa3..56661fb5e5 100644 --- a/datacatalog/job_execution.go +++ b/datacatalog/job_execution.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_execution_collection.go b/datacatalog/job_execution_collection.go index 2c8bce8327..0290d5fa06 100644 --- a/datacatalog/job_execution_collection.go +++ b/datacatalog/job_execution_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_execution_state.go b/datacatalog/job_execution_state.go index 5ecdd1e051..41a531273c 100644 --- a/datacatalog/job_execution_state.go +++ b/datacatalog/job_execution_state.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_execution_summary.go b/datacatalog/job_execution_summary.go index 69186a08a7..8681a98e37 100644 --- a/datacatalog/job_execution_summary.go +++ b/datacatalog/job_execution_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_lifecycle_state.go b/datacatalog/job_lifecycle_state.go index b738191f83..9b2cb81cb4 100644 --- a/datacatalog/job_lifecycle_state.go +++ b/datacatalog/job_lifecycle_state.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_log.go b/datacatalog/job_log.go index 4d93472a46..2f79578ecf 100644 --- a/datacatalog/job_log.go +++ b/datacatalog/job_log.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_log_collection.go b/datacatalog/job_log_collection.go index 2314a9f1ae..f401f7eebb 100644 --- a/datacatalog/job_log_collection.go +++ b/datacatalog/job_log_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_log_summary.go b/datacatalog/job_log_summary.go index 166aee5a70..294fdbbf1d 100644 --- a/datacatalog/job_log_summary.go +++ b/datacatalog/job_log_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_metric.go b/datacatalog/job_metric.go index 575b0ea61f..f5e4310181 100644 --- a/datacatalog/job_metric.go +++ b/datacatalog/job_metric.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_metric_collection.go b/datacatalog/job_metric_collection.go index 96b74c445b..65818678cc 100644 --- a/datacatalog/job_metric_collection.go +++ b/datacatalog/job_metric_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_metric_summary.go b/datacatalog/job_metric_summary.go index 47204923f5..38d10d7aa0 100644 --- a/datacatalog/job_metric_summary.go +++ b/datacatalog/job_metric_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_schedule_type.go b/datacatalog/job_schedule_type.go index 71a09e5f3a..5f7b436c9e 100644 --- a/datacatalog/job_schedule_type.go +++ b/datacatalog/job_schedule_type.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_summary.go b/datacatalog/job_summary.go index e42405266b..bb2a396d88 100644 --- a/datacatalog/job_summary.go +++ b/datacatalog/job_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/job_type.go b/datacatalog/job_type.go index 68cbf581dd..6800884de2 100644 --- a/datacatalog/job_type.go +++ b/datacatalog/job_type.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/lifecycle_state.go b/datacatalog/lifecycle_state.go index 137529dd73..854d08b528 100644 --- a/datacatalog/lifecycle_state.go +++ b/datacatalog/lifecycle_state.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/list_attributes_request_response.go b/datacatalog/list_attributes_request_response.go index c2f5e9508f..07cefc74bd 100644 --- a/datacatalog/list_attributes_request_response.go +++ b/datacatalog/list_attributes_request_response.go @@ -86,7 +86,7 @@ type ListAttributesRequest struct { // Specifies the fields to return in an entity attribute summary response. Fields []ListAttributesFieldsEnum `contributesTo:"query" name:"fields" omitEmpty:"true" collectionFormat:"multi"` - // The field to sort by. Only one sort order may be provided. Default order for TIMECREATED is descending. Default order for DISPLAYNAME is ascending. If no value is specified TIMECREATED is default. + // The field to sort by. Only one sort order may be provided. Default order for TIMECREATED is descending. Default order for DISPLAYNAME is ascending. Default order for POSITION is ascending. If no value is specified POSITION is default. SortBy ListAttributesSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` // The sort order to use, either 'asc' or 'desc'. @@ -214,6 +214,7 @@ const ( ListAttributesFieldsExternaldatatypeentitykey ListAttributesFieldsEnum = "externalDatatypeEntityKey" ListAttributesFieldsParentattributekey ListAttributesFieldsEnum = "parentAttributeKey" ListAttributesFieldsExternalparentattributekey ListAttributesFieldsEnum = "externalParentAttributeKey" + ListAttributesFieldsPosition ListAttributesFieldsEnum = "position" ) var mappingListAttributesFields = map[string]ListAttributesFieldsEnum{ @@ -237,6 +238,7 @@ var mappingListAttributesFields = map[string]ListAttributesFieldsEnum{ "externalDatatypeEntityKey": ListAttributesFieldsExternaldatatypeentitykey, "parentAttributeKey": ListAttributesFieldsParentattributekey, "externalParentAttributeKey": ListAttributesFieldsExternalparentattributekey, + "position": ListAttributesFieldsPosition, } // GetListAttributesFieldsEnumValues Enumerates the set of values for ListAttributesFieldsEnum @@ -255,11 +257,13 @@ type ListAttributesSortByEnum string const ( ListAttributesSortByTimecreated ListAttributesSortByEnum = "TIMECREATED" ListAttributesSortByDisplayname ListAttributesSortByEnum = "DISPLAYNAME" + ListAttributesSortByPosition ListAttributesSortByEnum = "POSITION" ) var mappingListAttributesSortBy = map[string]ListAttributesSortByEnum{ "TIMECREATED": ListAttributesSortByTimecreated, "DISPLAYNAME": ListAttributesSortByDisplayname, + "POSITION": ListAttributesSortByPosition, } // GetListAttributesSortByEnumValues Enumerates the set of values for ListAttributesSortByEnum diff --git a/datacatalog/list_custom_properties_request_response.go b/datacatalog/list_custom_properties_request_response.go index 3098b2f8c2..0ce7ba0f2a 100644 --- a/datacatalog/list_custom_properties_request_response.go +++ b/datacatalog/list_custom_properties_request_response.go @@ -145,6 +145,10 @@ const ( ListCustomPropertiesTypeNameView ListCustomPropertiesTypeNameEnum = "VIEW" ListCustomPropertiesTypeNameAttribute ListCustomPropertiesTypeNameEnum = "ATTRIBUTE" ListCustomPropertiesTypeNameFolder ListCustomPropertiesTypeNameEnum = "FOLDER" + ListCustomPropertiesTypeNameOracleAnalyticsSubjectAreaColumn ListCustomPropertiesTypeNameEnum = "ORACLE_ANALYTICS_SUBJECT_AREA_COLUMN" + ListCustomPropertiesTypeNameOracleAnalyticsLogicalColumn ListCustomPropertiesTypeNameEnum = "ORACLE_ANALYTICS_LOGICAL_COLUMN" + ListCustomPropertiesTypeNameOracleAnalyticsPhysicalColumn ListCustomPropertiesTypeNameEnum = "ORACLE_ANALYTICS_PHYSICAL_COLUMN" + ListCustomPropertiesTypeNameOracleAnalyticsAnalysisColumn ListCustomPropertiesTypeNameEnum = "ORACLE_ANALYTICS_ANALYSIS_COLUMN" ListCustomPropertiesTypeNameOracleAnalyticsServer ListCustomPropertiesTypeNameEnum = "ORACLE_ANALYTICS_SERVER" ListCustomPropertiesTypeNameOracleAnalyticsCloud ListCustomPropertiesTypeNameEnum = "ORACLE_ANALYTICS_CLOUD" ListCustomPropertiesTypeNameOracleAnalyticsSubjectArea ListCustomPropertiesTypeNameEnum = "ORACLE_ANALYTICS_SUBJECT_AREA" @@ -169,45 +173,49 @@ const ( ) var mappingListCustomPropertiesTypeName = map[string]ListCustomPropertiesTypeNameEnum{ - "DATA_ASSET": ListCustomPropertiesTypeNameDataAsset, - "AUTONOMOUS_DATA_WAREHOUSE": ListCustomPropertiesTypeNameAutonomousDataWarehouse, - "HIVE": ListCustomPropertiesTypeNameHive, - "KAFKA": ListCustomPropertiesTypeNameKafka, - "MYSQL": ListCustomPropertiesTypeNameMysql, - "ORACLE_OBJECT_STORAGE": ListCustomPropertiesTypeNameOracleObjectStorage, - "AUTONOMOUS_TRANSACTION_PROCESSING": ListCustomPropertiesTypeNameAutonomousTransactionProcessing, - "ORACLE": ListCustomPropertiesTypeNameOracle, - "POSTGRESQL": ListCustomPropertiesTypeNamePostgresql, - "MICROSOFT_AZURE_SQL_DATABASE": ListCustomPropertiesTypeNameMicrosoftAzureSqlDatabase, - "MICROSOFT_SQL_SERVER": ListCustomPropertiesTypeNameMicrosoftSqlServer, - "IBM_DB2": ListCustomPropertiesTypeNameIbmDb2, - "DATA_ENTITY": ListCustomPropertiesTypeNameDataEntity, - "LOGICAL_ENTITY": ListCustomPropertiesTypeNameLogicalEntity, - "TABLE": ListCustomPropertiesTypeNameTable, - "VIEW": ListCustomPropertiesTypeNameView, - "ATTRIBUTE": ListCustomPropertiesTypeNameAttribute, - "FOLDER": ListCustomPropertiesTypeNameFolder, - "ORACLE_ANALYTICS_SERVER": ListCustomPropertiesTypeNameOracleAnalyticsServer, - "ORACLE_ANALYTICS_CLOUD": ListCustomPropertiesTypeNameOracleAnalyticsCloud, - "ORACLE_ANALYTICS_SUBJECT_AREA": ListCustomPropertiesTypeNameOracleAnalyticsSubjectArea, - "ORACLE_ANALYTICS_DASHBOARD": ListCustomPropertiesTypeNameOracleAnalyticsDashboard, - "ORACLE_ANALYTICS_BUSINESS_MODEL": ListCustomPropertiesTypeNameOracleAnalyticsBusinessModel, - "ORACLE_ANALYTICS_PHYSICAL_DATABASE": ListCustomPropertiesTypeNameOracleAnalyticsPhysicalDatabase, - "ORACLE_ANALYTICS_PHYSICAL_SCHEMA": ListCustomPropertiesTypeNameOracleAnalyticsPhysicalSchema, - "ORACLE_ANALYTICS_PRESENTATION_TABLE": ListCustomPropertiesTypeNameOracleAnalyticsPresentationTable, - "ORACLE_ANALYTICS_LOGICAL_TABLE": ListCustomPropertiesTypeNameOracleAnalyticsLogicalTable, - "ORACLE_ANALYTICS_PHYSICAL_TABLE": ListCustomPropertiesTypeNameOracleAnalyticsPhysicalTable, - "ORACLE_ANALYTICS_ANALYSIS": ListCustomPropertiesTypeNameOracleAnalyticsAnalysis, - "DATABASE_SCHEMA": ListCustomPropertiesTypeNameDatabaseSchema, - "TOPIC": ListCustomPropertiesTypeNameTopic, - "CONNECTION": ListCustomPropertiesTypeNameConnection, - "GLOSSARY": ListCustomPropertiesTypeNameGlossary, - "TERM": ListCustomPropertiesTypeNameTerm, - "CATEGORY": ListCustomPropertiesTypeNameCategory, - "FILE": ListCustomPropertiesTypeNameFile, - "BUCKET": ListCustomPropertiesTypeNameBucket, - "MESSAGE": ListCustomPropertiesTypeNameMessage, - "UNRECOGNIZED_FILE": ListCustomPropertiesTypeNameUnrecognizedFile, + "DATA_ASSET": ListCustomPropertiesTypeNameDataAsset, + "AUTONOMOUS_DATA_WAREHOUSE": ListCustomPropertiesTypeNameAutonomousDataWarehouse, + "HIVE": ListCustomPropertiesTypeNameHive, + "KAFKA": ListCustomPropertiesTypeNameKafka, + "MYSQL": ListCustomPropertiesTypeNameMysql, + "ORACLE_OBJECT_STORAGE": ListCustomPropertiesTypeNameOracleObjectStorage, + "AUTONOMOUS_TRANSACTION_PROCESSING": ListCustomPropertiesTypeNameAutonomousTransactionProcessing, + "ORACLE": ListCustomPropertiesTypeNameOracle, + "POSTGRESQL": ListCustomPropertiesTypeNamePostgresql, + "MICROSOFT_AZURE_SQL_DATABASE": ListCustomPropertiesTypeNameMicrosoftAzureSqlDatabase, + "MICROSOFT_SQL_SERVER": ListCustomPropertiesTypeNameMicrosoftSqlServer, + "IBM_DB2": ListCustomPropertiesTypeNameIbmDb2, + "DATA_ENTITY": ListCustomPropertiesTypeNameDataEntity, + "LOGICAL_ENTITY": ListCustomPropertiesTypeNameLogicalEntity, + "TABLE": ListCustomPropertiesTypeNameTable, + "VIEW": ListCustomPropertiesTypeNameView, + "ATTRIBUTE": ListCustomPropertiesTypeNameAttribute, + "FOLDER": ListCustomPropertiesTypeNameFolder, + "ORACLE_ANALYTICS_SUBJECT_AREA_COLUMN": ListCustomPropertiesTypeNameOracleAnalyticsSubjectAreaColumn, + "ORACLE_ANALYTICS_LOGICAL_COLUMN": ListCustomPropertiesTypeNameOracleAnalyticsLogicalColumn, + "ORACLE_ANALYTICS_PHYSICAL_COLUMN": ListCustomPropertiesTypeNameOracleAnalyticsPhysicalColumn, + "ORACLE_ANALYTICS_ANALYSIS_COLUMN": ListCustomPropertiesTypeNameOracleAnalyticsAnalysisColumn, + "ORACLE_ANALYTICS_SERVER": ListCustomPropertiesTypeNameOracleAnalyticsServer, + "ORACLE_ANALYTICS_CLOUD": ListCustomPropertiesTypeNameOracleAnalyticsCloud, + "ORACLE_ANALYTICS_SUBJECT_AREA": ListCustomPropertiesTypeNameOracleAnalyticsSubjectArea, + "ORACLE_ANALYTICS_DASHBOARD": ListCustomPropertiesTypeNameOracleAnalyticsDashboard, + "ORACLE_ANALYTICS_BUSINESS_MODEL": ListCustomPropertiesTypeNameOracleAnalyticsBusinessModel, + "ORACLE_ANALYTICS_PHYSICAL_DATABASE": ListCustomPropertiesTypeNameOracleAnalyticsPhysicalDatabase, + "ORACLE_ANALYTICS_PHYSICAL_SCHEMA": ListCustomPropertiesTypeNameOracleAnalyticsPhysicalSchema, + "ORACLE_ANALYTICS_PRESENTATION_TABLE": ListCustomPropertiesTypeNameOracleAnalyticsPresentationTable, + "ORACLE_ANALYTICS_LOGICAL_TABLE": ListCustomPropertiesTypeNameOracleAnalyticsLogicalTable, + "ORACLE_ANALYTICS_PHYSICAL_TABLE": ListCustomPropertiesTypeNameOracleAnalyticsPhysicalTable, + "ORACLE_ANALYTICS_ANALYSIS": ListCustomPropertiesTypeNameOracleAnalyticsAnalysis, + "DATABASE_SCHEMA": ListCustomPropertiesTypeNameDatabaseSchema, + "TOPIC": ListCustomPropertiesTypeNameTopic, + "CONNECTION": ListCustomPropertiesTypeNameConnection, + "GLOSSARY": ListCustomPropertiesTypeNameGlossary, + "TERM": ListCustomPropertiesTypeNameTerm, + "CATEGORY": ListCustomPropertiesTypeNameCategory, + "FILE": ListCustomPropertiesTypeNameFile, + "BUCKET": ListCustomPropertiesTypeNameBucket, + "MESSAGE": ListCustomPropertiesTypeNameMessage, + "UNRECOGNIZED_FILE": ListCustomPropertiesTypeNameUnrecognizedFile, } // GetListCustomPropertiesTypeNameEnumValues Enumerates the set of values for ListCustomPropertiesTypeNameEnum diff --git a/datacatalog/metastore.go b/datacatalog/metastore.go index 17c7ac643e..b9c94fb5ad 100644 --- a/datacatalog/metastore.go +++ b/datacatalog/metastore.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/metastore_summary.go b/datacatalog/metastore_summary.go index 13782523ca..64675c388d 100644 --- a/datacatalog/metastore_summary.go +++ b/datacatalog/metastore_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/model_type.go b/datacatalog/model_type.go index 2fead289b9..f6d2660233 100644 --- a/datacatalog/model_type.go +++ b/datacatalog/model_type.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog @@ -73,6 +74,12 @@ type ModelType struct { // Custom properties associated with this Type. CustomProperties []CustomPropertySummary `mandatory:"false" json:"customProperties"` + + // Unique key of the parent type. + ParentTypeKey *string `mandatory:"false" json:"parentTypeKey"` + + // Name of the parent type. + ParentTypeName *string `mandatory:"false" json:"parentTypeName"` } func (m ModelType) String() string { diff --git a/datacatalog/namespace.go b/datacatalog/namespace.go index 3cf6b0b7dd..918460539a 100644 --- a/datacatalog/namespace.go +++ b/datacatalog/namespace.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/namespace_collection.go b/datacatalog/namespace_collection.go index 7e6f1953fe..2fbd6f6ca8 100644 --- a/datacatalog/namespace_collection.go +++ b/datacatalog/namespace_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/namespace_summary.go b/datacatalog/namespace_summary.go index 643a538c5e..2d3ef30635 100644 --- a/datacatalog/namespace_summary.go +++ b/datacatalog/namespace_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/object_relationship.go b/datacatalog/object_relationship.go index be4cc2371c..6f7d95e3ae 100644 --- a/datacatalog/object_relationship.go +++ b/datacatalog/object_relationship.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog @@ -37,6 +38,15 @@ type ObjectRelationship struct { // The last time a change was made to this reference. An RFC3339 (https://tools.ietf.org/html/rfc3339) formatted datetime string. TimeUpdated *common.SDKTime `mandatory:"false" json:"timeUpdated"` + + // Full path of the object. + Path *string `mandatory:"false" json:"path"` + + // Key of the parent object for the resource. + ParentKey *string `mandatory:"false" json:"parentKey"` + + // Full path of the parent object. + ParentPath *string `mandatory:"false" json:"parentPath"` } func (m ObjectRelationship) String() string { diff --git a/datacatalog/parse_connection_details.go b/datacatalog/parse_connection_details.go index 696f1a7d9b..caa2745462 100644 --- a/datacatalog/parse_connection_details.go +++ b/datacatalog/parse_connection_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog @@ -13,12 +14,19 @@ import ( "github.com/oracle/oci-go-sdk/v46/common" ) -// ParseConnectionDetails Parse connections from the connection metadata and oracle wallet file. +// ParseConnectionDetails Parse connections from the connection metadata and Oracle wallet file. +// An error will be returned if more than one of connectionPayload, walletSecretId or walletSecretName are present in the request. type ParseConnectionDetails struct { ConnectionDetail *Connection `mandatory:"false" json:"connectionDetail"` // The information used to parse the connection from the wallet file payload. ConnectionPayload []byte `mandatory:"false" json:"connectionPayload"` + + // OCID of the OCI Vault secret holding the Oracle wallet to parse. + WalletSecretId *string `mandatory:"false" json:"walletSecretId"` + + // Name of the OCI Vault secret holding the Oracle wallet to parse. + WalletSecretName *string `mandatory:"false" json:"walletSecretName"` } func (m ParseConnectionDetails) String() string { diff --git a/datacatalog/pattern.go b/datacatalog/pattern.go index bc2ce0d0a7..50712a7a79 100644 --- a/datacatalog/pattern.go +++ b/datacatalog/pattern.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/pattern_collection.go b/datacatalog/pattern_collection.go index 63559356ef..09d70738b9 100644 --- a/datacatalog/pattern_collection.go +++ b/datacatalog/pattern_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/pattern_summary.go b/datacatalog/pattern_summary.go index 44941209ad..1354364284 100644 --- a/datacatalog/pattern_summary.go +++ b/datacatalog/pattern_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/process_recommendation_details.go b/datacatalog/process_recommendation_details.go index 9262a09087..2095b18f2d 100644 --- a/datacatalog/process_recommendation_details.go +++ b/datacatalog/process_recommendation_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/property_definition.go b/datacatalog/property_definition.go index 0ffdfc7b34..2a383ae8e0 100644 --- a/datacatalog/property_definition.go +++ b/datacatalog/property_definition.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/recommendation_collection.go b/datacatalog/recommendation_collection.go index 37b428b2d2..c0bdd917f0 100644 --- a/datacatalog/recommendation_collection.go +++ b/datacatalog/recommendation_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/recommendation_details.go b/datacatalog/recommendation_details.go index 4a3564448f..b882895f20 100644 --- a/datacatalog/recommendation_details.go +++ b/datacatalog/recommendation_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/recommendation_resource_type.go b/datacatalog/recommendation_resource_type.go index 2f05e1b65e..bef0db5271 100644 --- a/datacatalog/recommendation_resource_type.go +++ b/datacatalog/recommendation_resource_type.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/recommendation_status.go b/datacatalog/recommendation_status.go index 12891d4537..6081979b0a 100644 --- a/datacatalog/recommendation_status.go +++ b/datacatalog/recommendation_status.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/recommendation_type.go b/datacatalog/recommendation_type.go index d71ed5cbc6..3dd20d15f2 100644 --- a/datacatalog/recommendation_type.go +++ b/datacatalog/recommendation_type.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/rule_attribute.go b/datacatalog/rule_attribute.go index ada973469e..6fa9c1ed61 100644 --- a/datacatalog/rule_attribute.go +++ b/datacatalog/rule_attribute.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/rule_collection.go b/datacatalog/rule_collection.go index 4be39112b0..43e868b730 100644 --- a/datacatalog/rule_collection.go +++ b/datacatalog/rule_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/rule_origin_type.go b/datacatalog/rule_origin_type.go index c3c07ff24c..2bee52aea8 100644 --- a/datacatalog/rule_origin_type.go +++ b/datacatalog/rule_origin_type.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/rule_summary.go b/datacatalog/rule_summary.go index d4a94f2818..26629773ca 100644 --- a/datacatalog/rule_summary.go +++ b/datacatalog/rule_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/rule_type.go b/datacatalog/rule_type.go index 271a255f66..f10c645b2e 100644 --- a/datacatalog/rule_type.go +++ b/datacatalog/rule_type.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/search_criteria.go b/datacatalog/search_criteria.go index 24a9d2c50a..0ba4bd568a 100644 --- a/datacatalog/search_criteria.go +++ b/datacatalog/search_criteria.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/search_result.go b/datacatalog/search_result.go index 91892f3a27..cff7f7f542 100644 --- a/datacatalog/search_result.go +++ b/datacatalog/search_result.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/search_result_collection.go b/datacatalog/search_result_collection.go index 5db182cb1b..2f88acf699 100644 --- a/datacatalog/search_result_collection.go +++ b/datacatalog/search_result_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/search_tag_summary.go b/datacatalog/search_tag_summary.go index f340350889..e8d2fb6a24 100644 --- a/datacatalog/search_tag_summary.go +++ b/datacatalog/search_tag_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/search_term_summary.go b/datacatalog/search_term_summary.go index 967bbeadc6..c0a950c2f4 100644 --- a/datacatalog/search_term_summary.go +++ b/datacatalog/search_term_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/suggest_list_item.go b/datacatalog/suggest_list_item.go index d0ac6ddabd..c1ec21a250 100644 --- a/datacatalog/suggest_list_item.go +++ b/datacatalog/suggest_list_item.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/suggest_results.go b/datacatalog/suggest_results.go index 8eb5e74dfd..b4be17f7f7 100644 --- a/datacatalog/suggest_results.go +++ b/datacatalog/suggest_results.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/term.go b/datacatalog/term.go index 9201585853..b56b09f67e 100644 --- a/datacatalog/term.go +++ b/datacatalog/term.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/term_associated_object.go b/datacatalog/term_associated_object.go index 7e488bc2d3..008b90e0cc 100644 --- a/datacatalog/term_associated_object.go +++ b/datacatalog/term_associated_object.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/term_collection.go b/datacatalog/term_collection.go index 02871100a7..c5882999ae 100644 --- a/datacatalog/term_collection.go +++ b/datacatalog/term_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/term_relationship.go b/datacatalog/term_relationship.go index 5e21d85ed4..8c72b37f5b 100644 --- a/datacatalog/term_relationship.go +++ b/datacatalog/term_relationship.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/term_relationship_collection.go b/datacatalog/term_relationship_collection.go index d3fdab3a66..451dd32104 100644 --- a/datacatalog/term_relationship_collection.go +++ b/datacatalog/term_relationship_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/term_relationship_summary.go b/datacatalog/term_relationship_summary.go index 93d4aaa9a2..5a02a210ec 100644 --- a/datacatalog/term_relationship_summary.go +++ b/datacatalog/term_relationship_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/term_summary.go b/datacatalog/term_summary.go index 5e822412d4..09b29e43c1 100644 --- a/datacatalog/term_summary.go +++ b/datacatalog/term_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/term_workflow_status.go b/datacatalog/term_workflow_status.go index e9d3b1082b..0b9d85d170 100644 --- a/datacatalog/term_workflow_status.go +++ b/datacatalog/term_workflow_status.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/type_collection.go b/datacatalog/type_collection.go index c4788a82cc..c548094c53 100644 --- a/datacatalog/type_collection.go +++ b/datacatalog/type_collection.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/type_custom_property_details.go b/datacatalog/type_custom_property_details.go index 9b3182fe08..c07e627ce7 100644 --- a/datacatalog/type_custom_property_details.go +++ b/datacatalog/type_custom_property_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/type_summary.go b/datacatalog/type_summary.go index 71e1f1279a..ca42948cfb 100644 --- a/datacatalog/type_summary.go +++ b/datacatalog/type_summary.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog @@ -37,6 +38,12 @@ type TypeSummary struct { // State of the folder. LifecycleState LifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"` + + // Unique key of the parent type. + ParentTypeKey *string `mandatory:"false" json:"parentTypeKey"` + + // Name of the parent type. + ParentTypeName *string `mandatory:"false" json:"parentTypeName"` } func (m TypeSummary) String() string { diff --git a/datacatalog/update_attribute_details.go b/datacatalog/update_attribute_details.go index 222baa80e5..9f970f5d55 100644 --- a/datacatalog/update_attribute_details.go +++ b/datacatalog/update_attribute_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/update_catalog_details.go b/datacatalog/update_catalog_details.go index 55d57b431c..5689006806 100644 --- a/datacatalog/update_catalog_details.go +++ b/datacatalog/update_catalog_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/update_catalog_private_endpoint_details.go b/datacatalog/update_catalog_private_endpoint_details.go index 672d2a7128..9c1cdbbb09 100644 --- a/datacatalog/update_catalog_private_endpoint_details.go +++ b/datacatalog/update_catalog_private_endpoint_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/update_connection_details.go b/datacatalog/update_connection_details.go index 07b076249f..3b86880e32 100644 --- a/datacatalog/update_connection_details.go +++ b/datacatalog/update_connection_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/update_custom_property_details.go b/datacatalog/update_custom_property_details.go index 4960bdf487..12c140e0a0 100644 --- a/datacatalog/update_custom_property_details.go +++ b/datacatalog/update_custom_property_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/update_data_asset_details.go b/datacatalog/update_data_asset_details.go index dc48511c78..8f1dfefb26 100644 --- a/datacatalog/update_data_asset_details.go +++ b/datacatalog/update_data_asset_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/update_entity_details.go b/datacatalog/update_entity_details.go index 3c94d655b7..de25213225 100644 --- a/datacatalog/update_entity_details.go +++ b/datacatalog/update_entity_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/update_folder_details.go b/datacatalog/update_folder_details.go index f6f032b6f6..64f05dfe63 100644 --- a/datacatalog/update_folder_details.go +++ b/datacatalog/update_folder_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/update_glossary_details.go b/datacatalog/update_glossary_details.go index 32d4187b55..f3ce089155 100644 --- a/datacatalog/update_glossary_details.go +++ b/datacatalog/update_glossary_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/update_job_definition_details.go b/datacatalog/update_job_definition_details.go index ac2d896419..05d82be1fa 100644 --- a/datacatalog/update_job_definition_details.go +++ b/datacatalog/update_job_definition_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/update_job_details.go b/datacatalog/update_job_details.go index 9c9fb2ca84..d1f958f0d7 100644 --- a/datacatalog/update_job_details.go +++ b/datacatalog/update_job_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/update_metastore_details.go b/datacatalog/update_metastore_details.go index 94e78c3b23..78706c0c97 100644 --- a/datacatalog/update_metastore_details.go +++ b/datacatalog/update_metastore_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/update_namespace_details.go b/datacatalog/update_namespace_details.go index d4de0e054d..7b3910ac51 100644 --- a/datacatalog/update_namespace_details.go +++ b/datacatalog/update_namespace_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/update_pattern_details.go b/datacatalog/update_pattern_details.go index f104f11c63..e7e7e23c21 100644 --- a/datacatalog/update_pattern_details.go +++ b/datacatalog/update_pattern_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/update_term_details.go b/datacatalog/update_term_details.go index 83d47c35fe..432e5965f9 100644 --- a/datacatalog/update_term_details.go +++ b/datacatalog/update_term_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/update_term_relationship_details.go b/datacatalog/update_term_relationship_details.go index 2b5ba5dcca..c2c1737844 100644 --- a/datacatalog/update_term_relationship_details.go +++ b/datacatalog/update_term_relationship_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/upload_credentials_details.go b/datacatalog/upload_credentials_details.go index 598cf1e4eb..33cd6af870 100644 --- a/datacatalog/upload_credentials_details.go +++ b/datacatalog/upload_credentials_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/validate_connection_details.go b/datacatalog/validate_connection_details.go index 31902b947d..376e95890a 100644 --- a/datacatalog/validate_connection_details.go +++ b/datacatalog/validate_connection_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/validate_connection_result.go b/datacatalog/validate_connection_result.go index edaaeb6b0f..3334f0e769 100644 --- a/datacatalog/validate_connection_result.go +++ b/datacatalog/validate_connection_result.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/validate_pattern_details.go b/datacatalog/validate_pattern_details.go index baab228427..a41124e301 100644 --- a/datacatalog/validate_pattern_details.go +++ b/datacatalog/validate_pattern_details.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/validate_pattern_result.go b/datacatalog/validate_pattern_result.go index 64cc1e8828..a51ce1a795 100644 --- a/datacatalog/validate_pattern_result.go +++ b/datacatalog/validate_pattern_result.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/work_request.go b/datacatalog/work_request.go index df95081702..7f9b705316 100644 --- a/datacatalog/work_request.go +++ b/datacatalog/work_request.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/work_request_error.go b/datacatalog/work_request_error.go index 3ecde4efe1..89e62ef82c 100644 --- a/datacatalog/work_request_error.go +++ b/datacatalog/work_request_error.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/work_request_log.go b/datacatalog/work_request_log.go index 5d8eff23c7..4a5ebb552e 100644 --- a/datacatalog/work_request_log.go +++ b/datacatalog/work_request_log.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/datacatalog/work_request_resource.go b/datacatalog/work_request_resource.go index bdd3a1e1a3..4db3a8e3db 100644 --- a/datacatalog/work_request_resource.go +++ b/datacatalog/work_request_resource.go @@ -5,6 +5,7 @@ // Data Catalog API // // Use the Data Catalog APIs to collect, organize, find, access, understand, enrich, and activate technical, business, and operational metadata. +// For more information, see Data Catalog (https://docs.oracle.com/iaas/data-catalog/home.htm). // package datacatalog diff --git a/example/example_change_compartment_test.go b/example/example_change_compartment_test.go index 1b9cd90452..2b377f156e 100644 --- a/example/example_change_compartment_test.go +++ b/example/example_change_compartment_test.go @@ -288,7 +288,6 @@ func getRetryPolicy() common.RetryPolicy { } return common.NewRetryPolicy(attempts, shouldRetry, nextDuration) - } func usage() { diff --git a/example/example_eventually_consistent_retry_behavior_test.go b/example/example_eventually_consistent_retry_behavior_test.go new file mode 100644 index 0000000000..4d039c61e3 --- /dev/null +++ b/example/example_eventually_consistent_retry_behavior_test.go @@ -0,0 +1,280 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. + +// Example code for using retry for SDK APIs + +package example + +import ( + "context" + "fmt" + "math" + "time" + + "github.com/oracle/oci-go-sdk/v46/common" + "github.com/oracle/oci-go-sdk/v46/core" + "github.com/oracle/oci-go-sdk/v46/example/helpers" + "github.com/oracle/oci-go-sdk/v46/identity" +) + +// This is a pretend OCID, an instance with this OCID does not actually exist. +// Therefore, GetInstance requests are guaranteed to fail with 404-NotAuthorizedOrNotFound. +const missingInstanceOcid = "ocid1.instance.oc1.phx." + +// This example simulates the behaviors of retry strategies with respect to eventual consistency. +// The operation that is called that is eventually consistent is CreateGroup in the Identity service. +// After that, this example is making a number of GetInstance requests in the Compute service, which +// are guaranteed to fail with a 404-NotAuthorizedOrNotFound, because the OCID is not a real OCID +// of an instance. +// But it does simulate the behavior of the retries you would see if there were a replication delay +// due to the eventual consistency of the group. +// +// Note: This is a long running example, it takes over 4 minutes. That's why the "Output:" line has +// been changed to prevent the example from automatically running as a test. +func ExampleEventuallyConsistentRetryBehavior_Default() { + // setup + ctx := context.Background() + + coreClient, clerr := core.NewComputeClientWithConfigurationProvider(common.DefaultConfigProvider()) + helpers.FatalIfError(clerr) + compartmentID, _ := common.DefaultConfigProvider().TenancyOCID() + + // this will set the eventually consistent timestamp, because the CreateGroup is eventually consistent and sets the timestamp + groupId := createGroup(ctx, compartmentID) + deleteGroup(ctx, groupId) + + // test + + defaultRetryPolicy := common.DefaultRetryPolicy() + nonEcRetryPolicy := common.DefaultRetryPolicyWithoutEventualConsistency() + + fmt.Printf("EC retry policy: %v\n", defaultRetryPolicy) + fmt.Printf("Non-EC retry policy: %v\n", nonEcRetryPolicy) + + // Without retry policy, we do not see retries + fmt.Printf("\nNo retry policy (expect immediate error):\n") + var elapsed = getInstance(ctx, coreClient, missingInstanceOcid, nil) + fmt.Printf("No retry policy (expect immediate error), elapsed less than three seconds? %v\n", + getComparisonMessage(elapsed.String(), elapsed < time.Duration(3)*time.Second)) + + // With the non-EC retry policy, we do not see a retry, because it doesn't consider eventual consistency. + // Without eventual consistency, 404-NotAuthorizedOrNotFound are not retried. + fmt.Printf("\nNon-EC retry policy (expect immediate error):\n") + elapsed = getInstance(ctx, coreClient, missingInstanceOcid, &nonEcRetryPolicy) + fmt.Printf("Non-EC retry policy (expect immediate error), elapsed less than three seconds? %v\n", + getComparisonMessage(elapsed.String(), elapsed < time.Duration(3)*time.Second)) + + // With the default retry policy, we do see retries, and this part takes a long time (about 4 minutes). + // These retries on 404-NotAuthorizedOrNotFound only happen because there was an eventually consistent + // operation in the recent past (CreateGroup). + fmt.Printf("\nDefault retry policy (expect long wait, then error):\n") + elapsed = getInstance(ctx, coreClient, missingInstanceOcid, &defaultRetryPolicy) + fmt.Printf("Default retry policy (expect long wait, then error), elapsed about 4 minutes? %v\n", + getComparisonMessage(elapsed.String(), (time.Duration(239)*time.Second < elapsed) && (elapsed < time.Duration(250)*time.Second))) + + // We use the the EC retry policy again, but by now we're outside the eventually consistent window, so we don't see retries anymore. + fmt.Printf("\nDefault retry policy, but no more EC (end of window in the past? %v) (expect immediate error):\n", + getComparisonMessage(fmt.Sprintf("now=%v, eow=%v", time.Now(), common.EcContext.GetEndOfWindow()), + time.Now().After(*common.EcContext.GetEndOfWindow()))) + elapsed = getInstance(ctx, coreClient, missingInstanceOcid, &defaultRetryPolicy) + fmt.Printf("Default retry policy, but no more EC (expect immediate error), elapsed less than three seconds? %v\n", + getComparisonMessage(elapsed.String(), elapsed < time.Duration(3)*time.Second)) + + // Output -- to enable this example as a test, change this line to "// Output:" + // EC retry policy: {MaximumNumberAttempts=9, MinSleepBetween=0, MaxSleepBetween=45, ExponentialBackoffBase=3.52, NonEventuallyConsistentPolicy={MaximumNumberAttempts=8, MinSleepBetween=0, MaxSleepBetween=30, ExponentialBackoffBase=2, NonEventuallyConsistentPolicy=}} + // Non-EC retry policy: {MaximumNumberAttempts=8, MinSleepBetween=0, MaxSleepBetween=30, ExponentialBackoffBase=2, NonEventuallyConsistentPolicy=} + // + // No retry policy (expect immediate error): + // Service error: NotAuthorizedOrNotFound. Authorization failed or requested resource not found. http status code: 404. + // No retry policy (expect immediate error), elapsed less than three seconds? true + // + // Non-EC retry policy (expect immediate error): + // Setting retry policy: {MaximumNumberAttempts=8, MinSleepBetween=0, MaxSleepBetween=30, ExponentialBackoffBase=2, NonEventuallyConsistentPolicy=} + // Service error: NotAuthorizedOrNotFound. Authorization failed or requested resource not found. http status code: 404. + // Non-EC retry policy (expect immediate error), elapsed less than three seconds? true + // + // Default retry policy (expect long wait, then error): + // Setting retry policy: {MaximumNumberAttempts=9, MinSleepBetween=0, MaxSleepBetween=45, ExponentialBackoffBase=3.52, NonEventuallyConsistentPolicy={MaximumNumberAttempts=8, MinSleepBetween=0, MaxSleepBetween=30, ExponentialBackoffBase=2, NonEventuallyConsistentPolicy=}} + // Service error: NotAuthorizedOrNotFound. Authorization failed or requested resource not found. http status code: 404. + // Default retry policy (expect long wait, then error), elapsed about 4 minutes? true + // + // Default retry policy, but no more EC (end of window in the past? true) (expect immediate error): + // Setting retry policy: {MaximumNumberAttempts=9, MinSleepBetween=0, MaxSleepBetween=45, ExponentialBackoffBase=3.52, NonEventuallyConsistentPolicy={MaximumNumberAttempts=8, MinSleepBetween=0, MaxSleepBetween=30, ExponentialBackoffBase=2, NonEventuallyConsistentPolicy=}} + // Service error: NotAuthorizedOrNotFound. Authorization failed or requested resource not found. http status code: 404. + // Default retry policy, but no more EC (expect immediate error), elapsed less than three seconds? true +} + +// This example simulates the behaviors of retry strategies with respect to eventual consistency. +// The operation that is called that is eventually consistent is CreateGroup in the Identity service. +// After that, this example is making a number of GetInstance requests in the Compute service, which +// are guaranteed to fail with a 404-NotAuthorizedOrNotFound, because the OCID is not a real OCID +// of an instance. +// But it does simulate the behavior of the retries you would see if there were a replication delay +// due to the eventual consistency of the group. +// Instead of using the default retry strategy, which uses exponential backoff and a limited number of +// attempts, the retry strategy here uses unlimited attempts, but a limited amount of time. +// +// Note: This is a long running example, it takes over 4 minutes. That's why the "Output:" line has +// been changed to prevent the example from automatically running as a test. +func ExampleEventuallyConsistentRetryBehavior_UnlimitedAttempts() { + // setup + ctx := context.Background() + + coreClient, clerr := core.NewComputeClientWithConfigurationProvider(common.DefaultConfigProvider()) + helpers.FatalIfError(clerr) + compartmentID, _ := common.DefaultConfigProvider().TenancyOCID() + + // this will set the eventually consistent timestamp, because the CreateGroup is eventually consistent and sets the timestamp + groupId := createGroup(ctx, compartmentID) + deleteGroup(ctx, groupId) + + // test + + maximumCumulativeBackoff := time.Duration(2) * time.Minute + + // retry unlimited number of times, up to two minutes + nonEcRetryPolicy := common.NewRetryPolicyWithOptions( + common.ReplaceWithValuesFromRetryPolicy(common.DefaultRetryPolicyWithoutEventualConsistency()), + common.WithUnlimitedAttempts(maximumCumulativeBackoff), + common.WithShouldRetryOperation(func(r common.OCIOperationResponse) bool { + durationSinceInitialAttempt := time.Now().Sub(r.InitialAttemptTime) + tooLong := durationSinceInitialAttempt > maximumCumulativeBackoff + return common.DefaultShouldRetryOperation(r) && !tooLong + }), + common.WithNextDuration(func(r common.OCIOperationResponse) time.Duration { + return time.Duration(math.Pow(float64(2), float64(r.AttemptNumber-1))) * time.Second + }), + ) + + ecRetryPolicy := common.EventuallyConsistentRetryPolicy(nonEcRetryPolicy) + + fmt.Printf("EC retry policy : %v\n", ecRetryPolicy) + fmt.Printf("Non-EC retry policy: %v\n", nonEcRetryPolicy) + + // Without retry policy, we do not see retries + fmt.Printf("\nNo retry policy (expect immediate error):\n") + var elapsed = getInstance(ctx, coreClient, missingInstanceOcid, nil) + fmt.Printf("No retry policy (expect immediate error), elapsed less than three seconds? %v\n", + getComparisonMessage(elapsed.String(), elapsed < time.Duration(3)*time.Second)) + + // With the non-EC retry policy, we do not see a retry, because it doesn't consider eventual consistency. + // Without eventual consistency, 404-NotAuthorizedOrNotFound are not retried. + fmt.Printf("\nNon-EC retry policy (expect immediate error):\n") + elapsed = getInstance(ctx, coreClient, missingInstanceOcid, &nonEcRetryPolicy) + fmt.Printf("Non-EC retry policy (expect immediate error), elapsed less than three seconds? %v\n", + getComparisonMessage(elapsed.String(), elapsed < time.Duration(3)*time.Second)) + + // With the EC retry policy, we do see retries, and this part takes a long time (about 4 minutes). + // These retries on 404-NotAuthorizedOrNotFound only happen because there was an eventually consistent + // operation in the recent past (CreateGroup). + fmt.Printf("\nEC retry policy (expect long wait, then error):\n") + elapsed = getInstance(ctx, coreClient, missingInstanceOcid, &ecRetryPolicy) + fmt.Printf("EC retry policy (expect long wait, then error), elapsed about 4 minutes? %v\n", + getComparisonMessage(elapsed.String(), (time.Duration(239)*time.Second < elapsed) && (elapsed < time.Duration(250)*time.Second))) + + // We use the the EC retry policy again, but by now we're outside the eventually consistent window, so we don't see retries anymore. + fmt.Printf("\nEC retry policy, but no more EC (end of window in the past? %v) (expect immediate error):\n", + getComparisonMessage(fmt.Sprintf("now=%v, eow=%v", time.Now(), common.EcContext.GetEndOfWindow()), + time.Now().After(*common.EcContext.GetEndOfWindow()))) + elapsed = getInstance(ctx, coreClient, missingInstanceOcid, &ecRetryPolicy) + fmt.Printf("EC retry policy, but no more EC (expect immediate error), elapsed less than three seconds? %v\n", + getComparisonMessage(elapsed.String(), elapsed < time.Duration(3)*time.Second)) + + // Output -- to enable this example as a test, change this line to "// Output:" + // EC retry policy : {MaximumNumberAttempts=9, MinSleepBetween=0, MaxSleepBetween=45, ExponentialBackoffBase=3.52, NonEventuallyConsistentPolicy={MaximumNumberAttempts=0, MinSleepBetween=0, MaxSleepBetween=30, ExponentialBackoffBase=2, NonEventuallyConsistentPolicy=}} + // Non-EC retry policy: {MaximumNumberAttempts=0, MinSleepBetween=0, MaxSleepBetween=30, ExponentialBackoffBase=2, NonEventuallyConsistentPolicy=} + // + // No retry policy (expect immediate error): + // Service error: NotAuthorizedOrNotFound. Authorization failed or requested resource not found. http status code: 404. + // No retry policy (expect immediate error), elapsed less than three seconds? true + // + // Non-EC retry policy (expect immediate error): + // Setting retry policy: {MaximumNumberAttempts=0, MinSleepBetween=0, MaxSleepBetween=30, ExponentialBackoffBase=2, NonEventuallyConsistentPolicy=} + // Service error: NotAuthorizedOrNotFound. Authorization failed or requested resource not found. http status code: 404. + // Non-EC retry policy (expect immediate error), elapsed less than three seconds? true + // + // EC retry policy (expect long wait, then error): + // Setting retry policy: {MaximumNumberAttempts=9, MinSleepBetween=0, MaxSleepBetween=45, ExponentialBackoffBase=3.52, NonEventuallyConsistentPolicy={MaximumNumberAttempts=0, MinSleepBetween=0, MaxSleepBetween=30, ExponentialBackoffBase=2, NonEventuallyConsistentPolicy=}} + // Service error: NotAuthorizedOrNotFound. Authorization failed or requested resource not found. http status code: 404. + // EC retry policy (expect long wait, then error), elapsed about 4 minutes? true + // + // EC retry policy, but no more EC (end of window in the past? true) (expect immediate error): + // Setting retry policy: {MaximumNumberAttempts=9, MinSleepBetween=0, MaxSleepBetween=45, ExponentialBackoffBase=3.52, NonEventuallyConsistentPolicy={MaximumNumberAttempts=0, MinSleepBetween=0, MaxSleepBetween=30, ExponentialBackoffBase=2, NonEventuallyConsistentPolicy=}} + // Service error: NotAuthorizedOrNotFound. Authorization failed or requested resource not found. http status code: 404. + // EC retry policy, but no more EC (expect immediate error), elapsed less than three seconds? true +} + +func createGroup(ctx context.Context, compartmentID string) string { + // Create a default authentication provider that uses the DEFAULT + // profile in the configuration file. + // Refer to ExampleLaunchInstance for more examples func ExampleRetry() { // create and delete group with retry @@ -29,6 +29,88 @@ func ExampleRetry() { request.Name = common.String("GoSDK_Sample_Group") request.Description = common.String("GoSDK Sample Group Description") + // use SDK's default retry policy which deals with eventual consistency + defaultRetryPolicy := common.DefaultRetryPolicy() + + // create request metadata for retry + request.RequestMetadata = common.RequestMetadata{ + RetryPolicy: &defaultRetryPolicy, + } + + resp, err := client.CreateGroup(ctx, request) + helpers.FatalIfError(err) + fmt.Println("Creating Group") + + // Get with polling + shouldRetry := func(r common.OCIOperationResponse) bool { + if _, isServiceError := common.IsServiceError(r.Error); isServiceError { + // not service error, could be network error or other errors which prevents + // request send to server, will do retry here + return true + } + + if converted, ok := r.Response.(identity.GetGroupResponse); ok { + // do the retry until lifecycle state become active + return converted.LifecycleState != identity.GroupLifecycleStateActive + } + + return true + } + + // maximum times of retry + attempts := uint(10) + + lifecycleStateCheckRetryPolicy := common.NewRetryPolicyWithOptions( + // since this retries on ANY error response, we don't need special handling for eventual consistency + common.ReplaceWithValuesFromRetryPolicy(common.DefaultRetryPolicyWithoutEventualConsistency()), + common.WithMaximumNumberAttempts(attempts), + common.WithShouldRetryOperation(shouldRetry), + ) + + getRequest := identity.GetGroupRequest{ + GroupId: resp.Id, + RequestMetadata: common.RequestMetadata{ + RetryPolicy: &lifecycleStateCheckRetryPolicy, + }, + } + + _, errAfterPolling := client.GetGroup(ctx, getRequest) + helpers.FatalIfError(errAfterPolling) + fmt.Println("Group Created") + + defer func() { + // if we've successfully created a group, make sure that we delete it + rDel := identity.DeleteGroupRequest{ + GroupId: resp.Id, + RequestMetadata: common.RequestMetadata{ + RetryPolicy: &defaultRetryPolicy, + }, + } + + _, err = client.DeleteGroup(ctx, rDel) + helpers.FatalIfError(err) + fmt.Println("Group Deleted") + }() + + // Output: + // Creating Group + // Group Created + // Group Deleted +} + +// ExampleCustomRetry shows how to use retry for Create and Delete groups, please +// refer to example_core_test.go->ExampleLaunchInstance for more examples +func ExampleCustomRetry() { + // create and delete group with retry + client, clerr := identity.NewIdentityClientWithConfigurationProvider(common.DefaultConfigProvider()) + ctx := context.Background() + helpers.FatalIfError(clerr) + + request := identity.CreateGroupRequest{} + request.CompartmentId = helpers.RootCompartmentID() + request.Name = common.String("GoSDK_Sample_Group") + request.Description = common.String("GoSDK Sample Group Description") + // maximum times of retry attempts := uint(10) @@ -37,18 +119,107 @@ func ExampleRetry() { return !(r.Error == nil && 199 < r.Response.HTTPResponse().StatusCode && r.Response.HTTPResponse().StatusCode < 300) } - nextDuration := func(r common.OCIOperationResponse) time.Duration { - // you might want wait longer for next retry when your previous one failed - // this function will return the duration as: - // 1s, 2s, 4s, 8s, 16s, 32s, 64s etc... - return time.Duration(math.Pow(float64(2), float64(r.AttemptNumber-1))) * time.Second + customRetryPolicy := common.NewRetryPolicyWithOptions( + // since this retries on ANY non-2xx response, we don't need special handling for eventual consistency + common.ReplaceWithValuesFromRetryPolicy(common.DefaultRetryPolicyWithoutEventualConsistency()), + common.WithMaximumNumberAttempts(attempts), + common.WithShouldRetryOperation(retryOnAllNon200ResponseCodes), + ) + + // create request metadata for retry + request.RequestMetadata = common.RequestMetadata{ + RetryPolicy: &customRetryPolicy, } - defaultRetryPolicy := common.NewRetryPolicy(attempts, retryOnAllNon200ResponseCodes, nextDuration) + resp, err := client.CreateGroup(ctx, request) + helpers.FatalIfError(err) + fmt.Println("Creating Group") + + // Get with polling + shouldRetry := func(r common.OCIOperationResponse) bool { + if _, isServiceError := common.IsServiceError(r.Error); isServiceError { + // not service error, could be network error or other errors which prevents + // request send to server, will do retry here + return true + } + + if converted, ok := r.Response.(identity.GetGroupResponse); ok { + // do the retry until lifecycle state become active + return converted.LifecycleState != identity.GroupLifecycleStateActive + } + + return true + } + + lifecycleStateCheckRetryPolicy := common.NewRetryPolicyWithOptions( + // since this retries on ANY error response, we don't need special handling for eventual consistency + common.ReplaceWithValuesFromRetryPolicy(common.DefaultRetryPolicyWithoutEventualConsistency()), + common.WithMaximumNumberAttempts(attempts), + common.WithShouldRetryOperation(shouldRetry), + ) + + getRequest := identity.GetGroupRequest{ + GroupId: resp.Id, + RequestMetadata: common.RequestMetadata{ + RetryPolicy: &lifecycleStateCheckRetryPolicy, + }, + } + + _, errAfterPolling := client.GetGroup(ctx, getRequest) + helpers.FatalIfError(errAfterPolling) + fmt.Println("Group Created") + + defer func() { + // if we've successfully created a group, make sure that we delete it + rDel := identity.DeleteGroupRequest{ + GroupId: resp.Id, + RequestMetadata: common.RequestMetadata{ + RetryPolicy: &customRetryPolicy, + }, + } + + _, err = client.DeleteGroup(ctx, rDel) + helpers.FatalIfError(err) + fmt.Println("Group Deleted") + }() + + // Output: + // Creating Group + // Group Created + // Group Deleted +} + +// ExampleUnlimitedAttemptsRetry shows how to use retry with unlimited retries, only limited by time, +// for Create and Delete groups, please refer to example_core_test.go->ExampleLaunchInstance for more examples +func ExampleUnlimitedAttemptsRetry() { + // create and delete group with retry + client, clerr := identity.NewIdentityClientWithConfigurationProvider(common.DefaultConfigProvider()) + ctx := context.Background() + helpers.FatalIfError(clerr) + + request := identity.CreateGroupRequest{} + request.CompartmentId = helpers.RootCompartmentID() + request.Name = common.String("GoSDK_Sample_Group") + request.Description = common.String("GoSDK Sample Group Description") + + maximumCumulativeBackoff := time.Duration(2) * time.Minute + + // retry unlimited number of times, up to two minutes + customRetryPolicy := common.NewRetryPolicyWithOptions( + common.WithUnlimitedAttempts(maximumCumulativeBackoff), + common.WithShouldRetryOperation(func(r common.OCIOperationResponse) bool { + durationSinceInitialAttempt := time.Now().Sub(r.InitialAttemptTime) + tooLong := durationSinceInitialAttempt > maximumCumulativeBackoff + return common.DefaultShouldRetryOperation(r) && !tooLong + }), + common.WithNextDuration(func(r common.OCIOperationResponse) time.Duration { + return time.Duration(math.Pow(float64(2), float64(r.AttemptNumber-1))) * time.Second + }), + ) // create request metadata for retry request.RequestMetadata = common.RequestMetadata{ - RetryPolicy: &defaultRetryPolicy, + RetryPolicy: &customRetryPolicy, } resp, err := client.CreateGroup(ctx, request) @@ -71,7 +242,20 @@ func ExampleRetry() { return true } - lifecycleStateCheckRetryPolicy := common.NewRetryPolicy(attempts, shouldRetry, nextDuration) + // retry unlimited number of times, up to two minutes, until lifecycle state is active + lifecycleStateCheckRetryPolicy := common.NewRetryPolicyWithOptions( + // since this retries on ANY error response, we don't need special handling for eventual consistency + common.ReplaceWithValuesFromRetryPolicy(common.DefaultRetryPolicyWithoutEventualConsistency()), + common.WithUnlimitedAttempts(maximumCumulativeBackoff), + common.WithShouldRetryOperation(func(r common.OCIOperationResponse) bool { + durationSinceInitialAttempt := time.Now().Sub(r.InitialAttemptTime) + tooLong := durationSinceInitialAttempt > maximumCumulativeBackoff + return shouldRetry(r) && !tooLong + }), + common.WithNextDuration(func(r common.OCIOperationResponse) time.Duration { + return time.Duration(math.Pow(float64(2), float64(r.AttemptNumber-1))) * time.Second + }), + ) getRequest := identity.GetGroupRequest{ GroupId: resp.Id, @@ -89,7 +273,7 @@ func ExampleRetry() { rDel := identity.DeleteGroupRequest{ GroupId: resp.Id, RequestMetadata: common.RequestMetadata{ - RetryPolicy: &defaultRetryPolicy, + RetryPolicy: &customRetryPolicy, }, } diff --git a/example/helpers/helper.go b/example/helpers/helper.go index 0f502fd5cd..2cf82c45d7 100644 --- a/example/helpers/helper.go +++ b/example/helpers/helper.go @@ -11,7 +11,6 @@ import ( "io" "io/ioutil" "log" - "math" "math/rand" "reflect" "strings" @@ -120,7 +119,9 @@ func GetRequestMetadataWithDefaultRetryPolicy() common.RequestMetadata { // input function (retry until the function return false) func GetRequestMetadataWithCustomizedRetryPolicy(fn func(r common.OCIOperationResponse) bool) common.RequestMetadata { return common.RequestMetadata{ - RetryPolicy: getExponentialBackoffRetryPolicy(uint(20), fn), + // since the goal here is to return until the function returns false, we should not be handling + // eventual consistency in a special way, therefore setting handleEventualConsistency to false + RetryPolicy: getExponentialBackoffRetryPolicy(uint(20), fn, false), } } @@ -132,15 +133,16 @@ func getDefaultRetryPolicy() *common.RetryPolicy { retryOnAllNon200ResponseCodes := func(r common.OCIOperationResponse) bool { return !(r.Error == nil && 199 < r.Response.HTTPResponse().StatusCode && r.Response.HTTPResponse().StatusCode < 300) } - return getExponentialBackoffRetryPolicy(attempts, retryOnAllNon200ResponseCodes) + // since we are handling ALL non-2xx error codes, we can set handleEventualConsistency to false + return getExponentialBackoffRetryPolicy(attempts, retryOnAllNon200ResponseCodes, false) } -func getExponentialBackoffRetryPolicy(n uint, fn func(r common.OCIOperationResponse) bool) *common.RetryPolicy { - // the duration between each retry operation, you might want to waite longer each time the retry fails - exponentialBackoff := func(r common.OCIOperationResponse) time.Duration { - return time.Duration(math.Pow(float64(2), float64(r.AttemptNumber-1))) * time.Second - } - policy := common.NewRetryPolicy(n, fn, exponentialBackoff) +func getExponentialBackoffRetryPolicy(n uint, fn func(r common.OCIOperationResponse) bool, handleEventualConsistency bool) *common.RetryPolicy { + policy := common.NewRetryPolicyWithOptions( + // only base off DefaultRetryPolicyWithoutEventualConsistency() if we're not handling eventual consistency + common.WithConditionalOption(!handleEventualConsistency, common.ReplaceWithValuesFromRetryPolicy(common.DefaultRetryPolicyWithoutEventualConsistency())), + common.WithMaximumNumberAttempts(n), + common.WithShouldRetryOperation(fn)) return &policy } diff --git a/go.sum b/go.sum index 2741e39980..1f1e7af975 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,7 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/identity/identity_client.go b/identity/identity_client.go index 141e635d68..7bd4afedd0 100644 --- a/identity/identity_client.go +++ b/identity/identity_client.go @@ -15,6 +15,7 @@ import ( "github.com/oracle/oci-go-sdk/v46/common" "github.com/oracle/oci-go-sdk/v46/common/auth" "net/http" + "time" ) //IdentityClient a client for Identity @@ -111,6 +112,7 @@ func (client IdentityClient) ActivateMfaTotpDevice(ctx context.Context, request return } if convertedResponse, ok := ociResponse.(ActivateMfaTotpDeviceResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into ActivateMfaTotpDeviceResponse") @@ -173,6 +175,7 @@ func (client IdentityClient) AddUserToGroup(ctx context.Context, request AddUser return } if convertedResponse, ok := ociResponse.(AddUserToGroupResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into AddUserToGroupResponse") @@ -295,6 +298,7 @@ func (client IdentityClient) BulkDeleteResources(ctx context.Context, request Bu return } if convertedResponse, ok := ociResponse.(BulkDeleteResourcesResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into BulkDeleteResourcesResponse") @@ -370,6 +374,7 @@ func (client IdentityClient) BulkDeleteTags(ctx context.Context, request BulkDel return } if convertedResponse, ok := ociResponse.(BulkDeleteTagsResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into BulkDeleteTagsResponse") @@ -440,6 +445,7 @@ func (client IdentityClient) BulkEditTags(ctx context.Context, request BulkEditT return } if convertedResponse, ok := ociResponse.(BulkEditTagsResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into BulkEditTagsResponse") @@ -504,6 +510,7 @@ func (client IdentityClient) BulkMoveResources(ctx context.Context, request Bulk return } if convertedResponse, ok := ociResponse.(BulkMoveResourcesResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into BulkMoveResourcesResponse") @@ -576,6 +583,7 @@ func (client IdentityClient) CascadeDeleteTagNamespace(ctx context.Context, requ return } if convertedResponse, ok := ociResponse.(CascadeDeleteTagNamespaceResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CascadeDeleteTagNamespaceResponse") @@ -639,6 +647,7 @@ func (client IdentityClient) ChangeTagNamespaceCompartment(ctx context.Context, return } if convertedResponse, ok := ociResponse.(ChangeTagNamespaceCompartmentResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into ChangeTagNamespaceCompartmentResponse") @@ -706,6 +715,7 @@ func (client IdentityClient) CreateAuthToken(ctx context.Context, request Create return } if convertedResponse, ok := ociResponse.(CreateAuthTokenResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateAuthTokenResponse") @@ -779,6 +789,7 @@ func (client IdentityClient) CreateCompartment(ctx context.Context, request Crea return } if convertedResponse, ok := ociResponse.(CreateCompartmentResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateCompartmentResponse") @@ -847,6 +858,7 @@ func (client IdentityClient) CreateCustomerSecretKey(ctx context.Context, reques return } if convertedResponse, ok := ociResponse.(CreateCustomerSecretKeyResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateCustomerSecretKeyResponse") @@ -920,6 +932,7 @@ func (client IdentityClient) CreateDynamicGroup(ctx context.Context, request Cre return } if convertedResponse, ok := ociResponse.(CreateDynamicGroupResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateDynamicGroupResponse") @@ -995,6 +1008,7 @@ func (client IdentityClient) CreateGroup(ctx context.Context, request CreateGrou return } if convertedResponse, ok := ociResponse.(CreateGroupResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateGroupResponse") @@ -1068,6 +1082,7 @@ func (client IdentityClient) CreateIdentityProvider(ctx context.Context, request return } if convertedResponse, ok := ociResponse.(CreateIdentityProviderResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateIdentityProviderResponse") @@ -1129,6 +1144,7 @@ func (client IdentityClient) CreateIdpGroupMapping(ctx context.Context, request return } if convertedResponse, ok := ociResponse.(CreateIdpGroupMappingResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateIdpGroupMappingResponse") @@ -1189,6 +1205,7 @@ func (client IdentityClient) CreateMfaTotpDevice(ctx context.Context, request Cr return } if convertedResponse, ok := ociResponse.(CreateMfaTotpDeviceResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateMfaTotpDeviceResponse") @@ -1264,6 +1281,7 @@ func (client IdentityClient) CreateNetworkSource(ctx context.Context, request Cr return } if convertedResponse, ok := ociResponse.(CreateNetworkSourceResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateNetworkSourceResponse") @@ -1324,6 +1342,7 @@ func (client IdentityClient) CreateOAuthClientCredential(ctx context.Context, re return } if convertedResponse, ok := ociResponse.(CreateOAuthClientCredentialResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateOAuthClientCredentialResponse") @@ -1392,6 +1411,7 @@ func (client IdentityClient) CreateOrResetUIPassword(ctx context.Context, reques return } if convertedResponse, ok := ociResponse.(CreateOrResetUIPasswordResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateOrResetUIPasswordResponse") @@ -1463,6 +1483,7 @@ func (client IdentityClient) CreatePolicy(ctx context.Context, request CreatePol return } if convertedResponse, ok := ociResponse.(CreatePolicyResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreatePolicyResponse") @@ -1523,6 +1544,7 @@ func (client IdentityClient) CreateRegionSubscription(ctx context.Context, reque return } if convertedResponse, ok := ociResponse.(CreateRegionSubscriptionResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateRegionSubscriptionResponse") @@ -1586,6 +1608,7 @@ func (client IdentityClient) CreateSmtpCredential(ctx context.Context, request C return } if convertedResponse, ok := ociResponse.(CreateSmtpCredentialResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateSmtpCredentialResponse") @@ -1654,6 +1677,7 @@ func (client IdentityClient) CreateSwiftPassword(ctx context.Context, request Cr return } if convertedResponse, ok := ociResponse.(CreateSwiftPasswordResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateSwiftPasswordResponse") @@ -1730,6 +1754,7 @@ func (client IdentityClient) CreateTag(ctx context.Context, request CreateTagReq return } if convertedResponse, ok := ociResponse.(CreateTagResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateTagResponse") @@ -1795,6 +1820,7 @@ func (client IdentityClient) CreateTagDefault(ctx context.Context, request Creat return } if convertedResponse, ok := ociResponse.(CreateTagDefaultResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateTagDefaultResponse") @@ -1865,6 +1891,7 @@ func (client IdentityClient) CreateTagNamespace(ctx context.Context, request Cre return } if convertedResponse, ok := ociResponse.(CreateTagNamespaceResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateTagNamespaceResponse") @@ -1953,6 +1980,7 @@ func (client IdentityClient) CreateUser(ctx context.Context, request CreateUserR return } if convertedResponse, ok := ociResponse.(CreateUserResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into CreateUserResponse") @@ -3023,6 +3051,7 @@ func (client IdentityClient) GenerateTotpSeed(ctx context.Context, request Gener return } if convertedResponse, ok := ociResponse.(GenerateTotpSeedResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into GenerateTotpSeedResponse") @@ -5859,6 +5888,7 @@ func (client IdentityClient) MoveCompartment(ctx context.Context, request MoveCo return } if convertedResponse, ok := ociResponse.(MoveCompartmentResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into MoveCompartmentResponse") @@ -5914,6 +5944,7 @@ func (client IdentityClient) RecoverCompartment(ctx context.Context, request Rec return } if convertedResponse, ok := ociResponse.(RecoverCompartmentResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into RecoverCompartmentResponse") @@ -6024,6 +6055,7 @@ func (client IdentityClient) ResetIdpScimClient(ctx context.Context, request Res return } if convertedResponse, ok := ociResponse.(ResetIdpScimClientResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into ResetIdpScimClientResponse") @@ -6079,6 +6111,7 @@ func (client IdentityClient) UpdateAuthToken(ctx context.Context, request Update return } if convertedResponse, ok := ociResponse.(UpdateAuthTokenResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateAuthTokenResponse") @@ -6134,6 +6167,7 @@ func (client IdentityClient) UpdateAuthenticationPolicy(ctx context.Context, req return } if convertedResponse, ok := ociResponse.(UpdateAuthenticationPolicyResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateAuthenticationPolicyResponse") @@ -6189,6 +6223,7 @@ func (client IdentityClient) UpdateCompartment(ctx context.Context, request Upda return } if convertedResponse, ok := ociResponse.(UpdateCompartmentResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateCompartmentResponse") @@ -6244,6 +6279,7 @@ func (client IdentityClient) UpdateCustomerSecretKey(ctx context.Context, reques return } if convertedResponse, ok := ociResponse.(UpdateCustomerSecretKeyResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateCustomerSecretKeyResponse") @@ -6299,6 +6335,7 @@ func (client IdentityClient) UpdateDynamicGroup(ctx context.Context, request Upd return } if convertedResponse, ok := ociResponse.(UpdateDynamicGroupResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateDynamicGroupResponse") @@ -6354,6 +6391,7 @@ func (client IdentityClient) UpdateGroup(ctx context.Context, request UpdateGrou return } if convertedResponse, ok := ociResponse.(UpdateGroupResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateGroupResponse") @@ -6409,6 +6447,7 @@ func (client IdentityClient) UpdateIdentityProvider(ctx context.Context, request return } if convertedResponse, ok := ociResponse.(UpdateIdentityProviderResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateIdentityProviderResponse") @@ -6464,6 +6503,7 @@ func (client IdentityClient) UpdateIdpGroupMapping(ctx context.Context, request return } if convertedResponse, ok := ociResponse.(UpdateIdpGroupMappingResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateIdpGroupMappingResponse") @@ -6519,6 +6559,7 @@ func (client IdentityClient) UpdateNetworkSource(ctx context.Context, request Up return } if convertedResponse, ok := ociResponse.(UpdateNetworkSourceResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateNetworkSourceResponse") @@ -6574,6 +6615,7 @@ func (client IdentityClient) UpdateOAuthClientCredential(ctx context.Context, re return } if convertedResponse, ok := ociResponse.(UpdateOAuthClientCredentialResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateOAuthClientCredentialResponse") @@ -6630,6 +6672,7 @@ func (client IdentityClient) UpdatePolicy(ctx context.Context, request UpdatePol return } if convertedResponse, ok := ociResponse.(UpdatePolicyResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdatePolicyResponse") @@ -6685,6 +6728,7 @@ func (client IdentityClient) UpdateSmtpCredential(ctx context.Context, request U return } if convertedResponse, ok := ociResponse.(UpdateSmtpCredentialResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateSmtpCredentialResponse") @@ -6741,6 +6785,7 @@ func (client IdentityClient) UpdateSwiftPassword(ctx context.Context, request Up return } if convertedResponse, ok := ociResponse.(UpdateSwiftPasswordResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateSwiftPasswordResponse") @@ -6803,6 +6848,7 @@ func (client IdentityClient) UpdateTag(ctx context.Context, request UpdateTagReq return } if convertedResponse, ok := ociResponse.(UpdateTagResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateTagResponse") @@ -6862,6 +6908,7 @@ func (client IdentityClient) UpdateTagDefault(ctx context.Context, request Updat return } if convertedResponse, ok := ociResponse.(UpdateTagDefaultResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateTagDefaultResponse") @@ -6923,6 +6970,7 @@ func (client IdentityClient) UpdateTagNamespace(ctx context.Context, request Upd return } if convertedResponse, ok := ociResponse.(UpdateTagNamespaceResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateTagNamespaceResponse") @@ -6978,6 +7026,7 @@ func (client IdentityClient) UpdateUser(ctx context.Context, request UpdateUserR return } if convertedResponse, ok := ociResponse.(UpdateUserResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateUserResponse") @@ -7033,6 +7082,7 @@ func (client IdentityClient) UpdateUserCapabilities(ctx context.Context, request return } if convertedResponse, ok := ociResponse.(UpdateUserCapabilitiesResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateUserCapabilitiesResponse") @@ -7088,6 +7138,7 @@ func (client IdentityClient) UpdateUserState(ctx context.Context, request Update return } if convertedResponse, ok := ociResponse.(UpdateUserStateResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UpdateUserStateResponse") @@ -7159,6 +7210,7 @@ func (client IdentityClient) UploadApiKey(ctx context.Context, request UploadApi return } if convertedResponse, ok := ociResponse.(UploadApiKeyResponse); ok { + common.EcContext.UpdateEndOfWindow(time.Duration(240 * time.Second)) response = convertedResponse } else { err = fmt.Errorf("failed to convert OCIResponse into UploadApiKeyResponse") diff --git a/objectstorage/transfer/upload_manager.go b/objectstorage/transfer/upload_manager.go index 1d28d7306e..7133ff1b8b 100644 --- a/objectstorage/transfer/upload_manager.go +++ b/objectstorage/transfer/upload_manager.go @@ -18,11 +18,9 @@ import ( "github.com/oracle/oci-go-sdk/v46/common" "github.com/oracle/oci-go-sdk/v46/objectstorage" "io" - "math" "net/http" "os" "strings" - "time" ) // UploadManager is the interface that groups the upload methods @@ -170,10 +168,12 @@ func getUploadManagerRetryPolicy() *common.RetryPolicy { return !(r.Error == nil && 199 < r.Response.HTTPResponse().StatusCode && r.Response.HTTPResponse().StatusCode < 300) } - exponentialBackoff := func(r common.OCIOperationResponse) time.Duration { - return time.Duration(math.Pow(float64(2), float64(r.AttemptNumber-1))) * time.Second - } - policy := common.NewRetryPolicy(attempts, retryOnAllNon200ResponseCodes, exponentialBackoff) + policy := common.NewRetryPolicyWithOptions( + // since this retries on ANY non-2xx response, we don't need special handling for eventual consistency + common.ReplaceWithValuesFromRetryPolicy(common.DefaultRetryPolicyWithoutEventualConsistency()), + common.WithMaximumNumberAttempts(attempts), + common.WithShouldRetryOperation(retryOnAllNon200ResponseCodes), + ) return &policy } diff --git a/objectstorage/transfer/upload_manager_req_resp.go b/objectstorage/transfer/upload_manager_req_resp.go index 371ad230e9..dc753c35ee 100644 --- a/objectstorage/transfer/upload_manager_req_resp.go +++ b/objectstorage/transfer/upload_manager_req_resp.go @@ -5,9 +5,7 @@ package transfer import ( "errors" - "math" "net/http" - "time" "github.com/oracle/oci-go-sdk/v46/common" "github.com/oracle/oci-go-sdk/v46/objectstorage" @@ -218,10 +216,9 @@ func getUploadManagerDefaultRetryPolicy() *common.RetryPolicy { return !(r.Error == nil && 199 < r.Response.HTTPResponse().StatusCode && r.Response.HTTPResponse().StatusCode < 300) } - exponentialBackoff := func(r common.OCIOperationResponse) time.Duration { - return time.Duration(math.Pow(float64(2), float64(r.AttemptNumber-1))) * time.Second - } - policy := common.NewRetryPolicy(attempts, retryOnAllNon200ResponseCodes, exponentialBackoff) + policy := common.NewRetryPolicyWithOptions( + common.WithMaximumNumberAttempts(attempts), + common.WithShouldRetryOperation(retryOnAllNon200ResponseCodes)) return &policy } diff --git a/osmanagement/autonomous_settings.go b/osmanagement/autonomous_settings.go new file mode 100644 index 0000000000..18da1494f6 --- /dev/null +++ b/osmanagement/autonomous_settings.go @@ -0,0 +1,26 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" +) + +// AutonomousSettings Managed Instance with Autonomous settings +type AutonomousSettings struct { + + // True if daily updates are enabled + IsAutoUpdateEnabled *bool `mandatory:"false" json:"isAutoUpdateEnabled"` +} + +func (m AutonomousSettings) String() string { + return common.PointerString(m) +} diff --git a/osmanagement/content_availability.go b/osmanagement/content_availability.go new file mode 100644 index 0000000000..6073949078 --- /dev/null +++ b/osmanagement/content_availability.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +// ContentAvailabilityEnum Enum with underlying type: string +type ContentAvailabilityEnum string + +// Set of constants representing the allowable values for ContentAvailabilityEnum +const ( + ContentAvailabilityNotAvailable ContentAvailabilityEnum = "NOT_AVAILABLE" + ContentAvailabilityAvailableOnInstance ContentAvailabilityEnum = "AVAILABLE_ON_INSTANCE" + ContentAvailabilityAvailableOnService ContentAvailabilityEnum = "AVAILABLE_ON_SERVICE" + ContentAvailabilityAvailableOnInstanceAndService ContentAvailabilityEnum = "AVAILABLE_ON_INSTANCE_AND_SERVICE" + ContentAvailabilityAvailableOnInstanceUploadInProgress ContentAvailabilityEnum = "AVAILABLE_ON_INSTANCE_UPLOAD_IN_PROGRESS" +) + +var mappingContentAvailability = map[string]ContentAvailabilityEnum{ + "NOT_AVAILABLE": ContentAvailabilityNotAvailable, + "AVAILABLE_ON_INSTANCE": ContentAvailabilityAvailableOnInstance, + "AVAILABLE_ON_SERVICE": ContentAvailabilityAvailableOnService, + "AVAILABLE_ON_INSTANCE_AND_SERVICE": ContentAvailabilityAvailableOnInstanceAndService, + "AVAILABLE_ON_INSTANCE_UPLOAD_IN_PROGRESS": ContentAvailabilityAvailableOnInstanceUploadInProgress, +} + +// GetContentAvailabilityEnumValues Enumerates the set of values for ContentAvailabilityEnum +func GetContentAvailabilityEnumValues() []ContentAvailabilityEnum { + values := make([]ContentAvailabilityEnum, 0) + for _, v := range mappingContentAvailability { + values = append(values, v) + } + return values +} diff --git a/osmanagement/crash_event_system_information.go b/osmanagement/crash_event_system_information.go new file mode 100644 index 0000000000..95c3836b92 --- /dev/null +++ b/osmanagement/crash_event_system_information.go @@ -0,0 +1,44 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" +) + +// CrashEventSystemInformation Detailed information about system at the time of the crash. +type CrashEventSystemInformation struct { + + // system architecture + Architecture ArchTypesEnum `mandatory:"false" json:"architecture,omitempty"` + + // Active ksplice kernel version (uptrack-uname -r) + KspliceEffectiveKernelVersion *string `mandatory:"false" json:"kspliceEffectiveKernelVersion"` + + // The Operating System type of the managed instance. + OsFamily OsFamiliesEnum `mandatory:"false" json:"osFamily,omitempty"` + + // Operating System Name (OCA value) + OsName *string `mandatory:"false" json:"osName"` + + // Operating System Kernel Release (uname -v) + OsKernelRelease *string `mandatory:"false" json:"osKernelRelease"` + + // Operating System Kernel Version (uname -r) + OsKernelVersion *string `mandatory:"false" json:"osKernelVersion"` + + // Version of the OS (VERSION from /etc/os-release) + OsSystemVersion *string `mandatory:"false" json:"osSystemVersion"` +} + +func (m CrashEventSystemInformation) String() string { + return common.PointerString(m) +} diff --git a/osmanagement/delete_event_content_request_response.go b/osmanagement/delete_event_content_request_response.go new file mode 100644 index 0000000000..2d46fa2dd4 --- /dev/null +++ b/osmanagement/delete_event_content_request_response.go @@ -0,0 +1,90 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" + "net/http" +) + +// DeleteEventContentRequest wrapper for the DeleteEventContent operation +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/DeleteEventContent.go.html to see an example of how to use DeleteEventContentRequest. +type DeleteEventContentRequest struct { + + // Instance Oracle Cloud identifier (ocid) + ManagedInstanceId *string `mandatory:"true" contributesTo:"path" name:"managedInstanceId"` + + // Unique Event identifier (OCID) + EventId *string `mandatory:"true" contributesTo:"path" name:"eventId"` + + // The ID of the compartment in which to list resources. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The client request ID for tracing. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // For optimistic concurrency control. In the PUT or DELETE call + // for a resource, set the `if-match` parameter to the value of the + // etag from a previous GET or POST response for that resource. + // The resource will be updated or deleted only if the etag you + // provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations. For example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // might be rejected. + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request DeleteEventContentRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request DeleteEventContentRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request DeleteEventContentRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request DeleteEventContentRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// DeleteEventContentResponse wrapper for the DeleteEventContent operation +type DeleteEventContentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteEventContentResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response DeleteEventContentResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/osmanagement/event.go b/osmanagement/event.go new file mode 100644 index 0000000000..75eaec49ee --- /dev/null +++ b/osmanagement/event.go @@ -0,0 +1,181 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/v46/common" +) + +// Event Description of Event. +type Event interface { + + // OCID identifier of the event + GetId() *string + + // OCI identifier of the instance where the event occurred + GetInstanceId() *string + + // OCI identifier of the compartement where the instance is + GetCompartmentId() *string + + // OCID identifier of the instance tenancy. + GetTenancyId() *string + + // human readable description of the event + GetSummary() *string + + // Time of the occurrence of the event + GetTimestamp() *common.SDKTime + + // Unique ID used to group event with the same characteristics together. + // The list of such groups of event can be retrieved via /recurringEvents/{EventFingerprint} + GetEventFingerprint() *string + + // Event occurrence count. Number of time the event has happen on the system. + GetCount() *int + + // Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. + // Example: `{"bar-key": "value"}` + GetFreeformTags() map[string]string + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // Example: `{"foo-namespace": {"bar-key": "value"}}` + GetDefinedTags() map[string]map[string]interface{} + + // Usage of system tag keys. These predefined keys are scoped to namespaces. + // Example: `{"orcl-cloud": {"free-tier-retained": "true"}}` + GetSystemTags() map[string]map[string]interface{} +} + +type event struct { + JsonData []byte + Id *string `mandatory:"true" json:"id"` + InstanceId *string `mandatory:"false" json:"instanceId"` + CompartmentId *string `mandatory:"false" json:"compartmentId"` + TenancyId *string `mandatory:"false" json:"tenancyId"` + Summary *string `mandatory:"false" json:"summary"` + Timestamp *common.SDKTime `mandatory:"false" json:"timestamp"` + EventFingerprint *string `mandatory:"false" json:"eventFingerprint"` + Count *int `mandatory:"false" json:"count"` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` + SystemTags map[string]map[string]interface{} `mandatory:"false" json:"systemTags"` + EventType string `json:"eventType"` +} + +// UnmarshalJSON unmarshals json +func (m *event) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalerevent event + s := struct { + Model Unmarshalerevent + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.Id = s.Model.Id + m.InstanceId = s.Model.InstanceId + m.CompartmentId = s.Model.CompartmentId + m.TenancyId = s.Model.TenancyId + m.Summary = s.Model.Summary + m.Timestamp = s.Model.Timestamp + m.EventFingerprint = s.Model.EventFingerprint + m.Count = s.Model.Count + m.FreeformTags = s.Model.FreeformTags + m.DefinedTags = s.Model.DefinedTags + m.SystemTags = s.Model.SystemTags + m.EventType = s.Model.EventType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *event) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + + if data == nil || string(data) == "null" { + return nil, nil + } + + var err error + switch m.EventType { + case "KERNEL_OOPS": + mm := KernelOopsEvent{} + err = json.Unmarshal(data, &mm) + return mm, err + case "KERNEL_CRASH": + mm := KernelCrashEvent{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + return *m, nil + } +} + +//GetId returns Id +func (m event) GetId() *string { + return m.Id +} + +//GetInstanceId returns InstanceId +func (m event) GetInstanceId() *string { + return m.InstanceId +} + +//GetCompartmentId returns CompartmentId +func (m event) GetCompartmentId() *string { + return m.CompartmentId +} + +//GetTenancyId returns TenancyId +func (m event) GetTenancyId() *string { + return m.TenancyId +} + +//GetSummary returns Summary +func (m event) GetSummary() *string { + return m.Summary +} + +//GetTimestamp returns Timestamp +func (m event) GetTimestamp() *common.SDKTime { + return m.Timestamp +} + +//GetEventFingerprint returns EventFingerprint +func (m event) GetEventFingerprint() *string { + return m.EventFingerprint +} + +//GetCount returns Count +func (m event) GetCount() *int { + return m.Count +} + +//GetFreeformTags returns FreeformTags +func (m event) GetFreeformTags() map[string]string { + return m.FreeformTags +} + +//GetDefinedTags returns DefinedTags +func (m event) GetDefinedTags() map[string]map[string]interface{} { + return m.DefinedTags +} + +//GetSystemTags returns SystemTags +func (m event) GetSystemTags() map[string]map[string]interface{} { + return m.SystemTags +} + +func (m event) String() string { + return common.PointerString(m) +} diff --git a/osmanagement/event_collection.go b/osmanagement/event_collection.go new file mode 100644 index 0000000000..822e414b13 --- /dev/null +++ b/osmanagement/event_collection.go @@ -0,0 +1,26 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" +) + +// EventCollection Results of a event search. Contains both EventSummary items and other information, such as metadata. +type EventCollection struct { + + // List of events. + Items []EventSummary `mandatory:"true" json:"items"` +} + +func (m EventCollection) String() string { + return common.PointerString(m) +} diff --git a/osmanagement/event_content.go b/osmanagement/event_content.go new file mode 100644 index 0000000000..482244cfdc --- /dev/null +++ b/osmanagement/event_content.go @@ -0,0 +1,32 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" +) + +// EventContent Information about the data collected as a ZIP file when the event occurred. +type EventContent struct { + + // Status of the event content + ContentAvailability ContentAvailabilityEnum `mandatory:"false" json:"contentAvailability,omitempty"` + + // Path to the event content on the instance + InstancePath *string `mandatory:"false" json:"instancePath"` + + // size in bytes of the event content (size of the zip file uploaded) + Size *int `mandatory:"false" json:"size"` +} + +func (m EventContent) String() string { + return common.PointerString(m) +} diff --git a/osmanagement/event_report.go b/osmanagement/event_report.go new file mode 100644 index 0000000000..dbeb9435a3 --- /dev/null +++ b/osmanagement/event_report.go @@ -0,0 +1,26 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" +) + +// EventReport Summary about event occurrences on a system. +type EventReport struct { + + // count of events currently registered on the system. + Count *int `mandatory:"true" json:"count"` +} + +func (m EventReport) String() string { + return common.PointerString(m) +} diff --git a/osmanagement/event_summary.go b/osmanagement/event_summary.go new file mode 100644 index 0000000000..2f525075ae --- /dev/null +++ b/osmanagement/event_summary.go @@ -0,0 +1,53 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" +) + +// EventSummary Summary of the Event. +type EventSummary struct { + + // OCID identifier of the event + Id *string `mandatory:"true" json:"id"` + + // Unique OCI identifier of the instance where the event occurred + InstanceId *string `mandatory:"true" json:"instanceId"` + + // Type of the event. + EventType EventTypeEnum `mandatory:"true" json:"eventType"` + + // human readable description of the event + Summary *string `mandatory:"false" json:"summary"` + + // Event occurrence count. Number of time the same event happened on the system. + Count *int `mandatory:"false" json:"count"` + + // Time of the occurrence of the event + Timestamp *common.SDKTime `mandatory:"false" json:"timestamp"` + + // Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. + // Example: `{"bar-key": "value"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // Example: `{"foo-namespace": {"bar-key": "value"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` + + // Usage of system tag keys. These predefined keys are scoped to namespaces. + // Example: `{"orcl-cloud": {"free-tier-retained": "true"}}` + SystemTags map[string]map[string]interface{} `mandatory:"false" json:"systemTags"` +} + +func (m EventSummary) String() string { + return common.PointerString(m) +} diff --git a/osmanagement/event_type.go b/osmanagement/event_type.go new file mode 100644 index 0000000000..39bde663e3 --- /dev/null +++ b/osmanagement/event_type.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +// EventTypeEnum Enum with underlying type: string +type EventTypeEnum string + +// Set of constants representing the allowable values for EventTypeEnum +const ( + EventTypeKernelOops EventTypeEnum = "KERNEL_OOPS" + EventTypeKernelCrash EventTypeEnum = "KERNEL_CRASH" + EventTypeCrash EventTypeEnum = "CRASH" + EventTypeExploitAttempt EventTypeEnum = "EXPLOIT_ATTEMPT" + EventTypeCompliance EventTypeEnum = "COMPLIANCE" + EventTypeTuningSuggestion EventTypeEnum = "TUNING_SUGGESTION" + EventTypeTuningApplied EventTypeEnum = "TUNING_APPLIED" + EventTypeSecurity EventTypeEnum = "SECURITY" + EventTypeError EventTypeEnum = "ERROR" + EventTypeWarning EventTypeEnum = "WARNING" +) + +var mappingEventType = map[string]EventTypeEnum{ + "KERNEL_OOPS": EventTypeKernelOops, + "KERNEL_CRASH": EventTypeKernelCrash, + "CRASH": EventTypeCrash, + "EXPLOIT_ATTEMPT": EventTypeExploitAttempt, + "COMPLIANCE": EventTypeCompliance, + "TUNING_SUGGESTION": EventTypeTuningSuggestion, + "TUNING_APPLIED": EventTypeTuningApplied, + "SECURITY": EventTypeSecurity, + "ERROR": EventTypeError, + "WARNING": EventTypeWarning, +} + +// GetEventTypeEnumValues Enumerates the set of values for EventTypeEnum +func GetEventTypeEnumValues() []EventTypeEnum { + values := make([]EventTypeEnum, 0) + for _, v := range mappingEventType { + values = append(values, v) + } + return values +} diff --git a/osmanagement/get_event_content_request_response.go b/osmanagement/get_event_content_request_response.go new file mode 100644 index 0000000000..d8ae49cd9e --- /dev/null +++ b/osmanagement/get_event_content_request_response.go @@ -0,0 +1,83 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" + "io" + "net/http" +) + +// GetEventContentRequest wrapper for the GetEventContent operation +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/GetEventContent.go.html to see an example of how to use GetEventContentRequest. +type GetEventContentRequest struct { + + // Instance Oracle Cloud identifier (ocid) + ManagedInstanceId *string `mandatory:"true" contributesTo:"path" name:"managedInstanceId"` + + // Unique Event identifier (OCID) + EventId *string `mandatory:"true" contributesTo:"path" name:"eventId"` + + // The ID of the compartment in which to list resources. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The client request ID for tracing. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request GetEventContentRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request GetEventContentRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request GetEventContentRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request GetEventContentRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// GetEventContentResponse wrapper for the GetEventContent operation +type GetEventContentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The io.ReadCloser instance + Content io.ReadCloser `presentIn:"body" encoding:"binary"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetEventContentResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response GetEventContentResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/osmanagement/get_event_report_request_response.go b/osmanagement/get_event_report_request_response.go new file mode 100644 index 0000000000..2ef4df8bbc --- /dev/null +++ b/osmanagement/get_event_report_request_response.go @@ -0,0 +1,83 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" + "net/http" +) + +// GetEventReportRequest wrapper for the GetEventReport operation +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/GetEventReport.go.html to see an example of how to use GetEventReportRequest. +type GetEventReportRequest struct { + + // Instance Oracle Cloud identifier (ocid) + ManagedInstanceId *string `mandatory:"true" contributesTo:"path" name:"managedInstanceId"` + + // The ID of the compartment in which to list resources. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // filter event occurrence. Selecting only those last occurred before given date in ISO 8601 format + // Example: 2017-07-14T02:40:00.000Z + LatestTimestampLessThan *common.SDKTime `mandatory:"false" contributesTo:"query" name:"latestTimestampLessThan"` + + // filter event occurrence. Selecting only those last occurred on or after given date in ISO 8601 format + // Example: 2017-07-14T02:40:00.000Z + LatestTimestampGreaterThanOrEqualTo *common.SDKTime `mandatory:"false" contributesTo:"query" name:"latestTimestampGreaterThanOrEqualTo"` + + // The client request ID for tracing. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request GetEventReportRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request GetEventReportRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request GetEventReportRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request GetEventReportRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// GetEventReportResponse wrapper for the GetEventReport operation +type GetEventReportResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The EventReport instance + EventReport `presentIn:"body"` + + // identifier for the request + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetEventReportResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response GetEventReportResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/osmanagement/get_event_request_response.go b/osmanagement/get_event_request_response.go new file mode 100644 index 0000000000..0d8e7752b5 --- /dev/null +++ b/osmanagement/get_event_request_response.go @@ -0,0 +1,82 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" + "net/http" +) + +// GetEventRequest wrapper for the GetEvent operation +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/GetEvent.go.html to see an example of how to use GetEventRequest. +type GetEventRequest struct { + + // Instance Oracle Cloud identifier (ocid) + ManagedInstanceId *string `mandatory:"true" contributesTo:"path" name:"managedInstanceId"` + + // Unique Event identifier (OCID) + EventId *string `mandatory:"true" contributesTo:"path" name:"eventId"` + + // The ID of the compartment in which to list resources. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The client request ID for tracing. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request GetEventRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request GetEventRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request GetEventRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request GetEventRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// GetEventResponse wrapper for the GetEvent operation +type GetEventResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Event instance + Event `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetEventResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response GetEventResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/osmanagement/get_managed_instance_request_response.go b/osmanagement/get_managed_instance_request_response.go index 8021b2a1e8..f02ac8feef 100644 --- a/osmanagement/get_managed_instance_request_response.go +++ b/osmanagement/get_managed_instance_request_response.go @@ -58,6 +58,9 @@ type GetManagedInstanceResponse struct { // The ManagedInstance instance ManagedInstance `presentIn:"body"` + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + // Unique Oracle-assigned identifier for the request. If you need to contact // Oracle about a particular request, please provide the request ID. OpcRequestId *string `presentIn:"header" name:"opc-request-id"` diff --git a/osmanagement/install_all_package_updates_on_managed_instance_request_response.go b/osmanagement/install_all_package_updates_on_managed_instance_request_response.go index 74d6524577..4e8d326542 100644 --- a/osmanagement/install_all_package_updates_on_managed_instance_request_response.go +++ b/osmanagement/install_all_package_updates_on_managed_instance_request_response.go @@ -19,6 +19,9 @@ type InstallAllPackageUpdatesOnManagedInstanceRequest struct { // OCID for the managed instance ManagedInstanceId *string `mandatory:"true" contributesTo:"path" name:"managedInstanceId"` + // The type of updates to be applied + UpdateType InstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnum `mandatory:"false" contributesTo:"query" name:"updateType" omitEmpty:"true"` + // The client request ID for tracing. OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` @@ -79,3 +82,34 @@ func (response InstallAllPackageUpdatesOnManagedInstanceResponse) String() strin func (response InstallAllPackageUpdatesOnManagedInstanceResponse) HTTPResponse() *http.Response { return response.RawResponse } + +// InstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnum Enum with underlying type: string +type InstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnum string + +// Set of constants representing the allowable values for InstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnum +const ( + InstallAllPackageUpdatesOnManagedInstanceUpdateTypeSecurity InstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnum = "SECURITY" + InstallAllPackageUpdatesOnManagedInstanceUpdateTypeBugfix InstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnum = "BUGFIX" + InstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnhancement InstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnum = "ENHANCEMENT" + InstallAllPackageUpdatesOnManagedInstanceUpdateTypeOther InstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnum = "OTHER" + InstallAllPackageUpdatesOnManagedInstanceUpdateTypeKsplice InstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnum = "KSPLICE" + InstallAllPackageUpdatesOnManagedInstanceUpdateTypeAll InstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnum = "ALL" +) + +var mappingInstallAllPackageUpdatesOnManagedInstanceUpdateType = map[string]InstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnum{ + "SECURITY": InstallAllPackageUpdatesOnManagedInstanceUpdateTypeSecurity, + "BUGFIX": InstallAllPackageUpdatesOnManagedInstanceUpdateTypeBugfix, + "ENHANCEMENT": InstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnhancement, + "OTHER": InstallAllPackageUpdatesOnManagedInstanceUpdateTypeOther, + "KSPLICE": InstallAllPackageUpdatesOnManagedInstanceUpdateTypeKsplice, + "ALL": InstallAllPackageUpdatesOnManagedInstanceUpdateTypeAll, +} + +// GetInstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnumValues Enumerates the set of values for InstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnum +func GetInstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnumValues() []InstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnum { + values := make([]InstallAllPackageUpdatesOnManagedInstanceUpdateTypeEnum, 0) + for _, v := range mappingInstallAllPackageUpdatesOnManagedInstanceUpdateType { + values = append(values, v) + } + return values +} diff --git a/osmanagement/install_all_updates_on_managed_instance_group_request_response.go b/osmanagement/install_all_updates_on_managed_instance_group_request_response.go new file mode 100644 index 0000000000..da6c4b9232 --- /dev/null +++ b/osmanagement/install_all_updates_on_managed_instance_group_request_response.go @@ -0,0 +1,115 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" + "net/http" +) + +// InstallAllUpdatesOnManagedInstanceGroupRequest wrapper for the InstallAllUpdatesOnManagedInstanceGroup operation +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/InstallAllUpdatesOnManagedInstanceGroup.go.html to see an example of how to use InstallAllUpdatesOnManagedInstanceGroupRequest. +type InstallAllUpdatesOnManagedInstanceGroupRequest struct { + + // OCID for the managed instance group + ManagedInstanceGroupId *string `mandatory:"true" contributesTo:"path" name:"managedInstanceGroupId"` + + // The type of updates to be applied + UpdateType InstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnum `mandatory:"false" contributesTo:"query" name:"updateType" omitEmpty:"true"` + + // The client request ID for tracing. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations. For example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // might be rejected. + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request InstallAllUpdatesOnManagedInstanceGroupRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request InstallAllUpdatesOnManagedInstanceGroupRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request InstallAllUpdatesOnManagedInstanceGroupRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request InstallAllUpdatesOnManagedInstanceGroupRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// InstallAllUpdatesOnManagedInstanceGroupResponse wrapper for the InstallAllUpdatesOnManagedInstanceGroup operation +type InstallAllUpdatesOnManagedInstanceGroupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the asynchronous request. + // You can use this to query the status of the asynchronous operation. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response InstallAllUpdatesOnManagedInstanceGroupResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response InstallAllUpdatesOnManagedInstanceGroupResponse) HTTPResponse() *http.Response { + return response.RawResponse +} + +// InstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnum Enum with underlying type: string +type InstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnum string + +// Set of constants representing the allowable values for InstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnum +const ( + InstallAllUpdatesOnManagedInstanceGroupUpdateTypeSecurity InstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnum = "SECURITY" + InstallAllUpdatesOnManagedInstanceGroupUpdateTypeBugfix InstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnum = "BUGFIX" + InstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnhancement InstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnum = "ENHANCEMENT" + InstallAllUpdatesOnManagedInstanceGroupUpdateTypeOther InstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnum = "OTHER" + InstallAllUpdatesOnManagedInstanceGroupUpdateTypeKsplice InstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnum = "KSPLICE" + InstallAllUpdatesOnManagedInstanceGroupUpdateTypeAll InstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnum = "ALL" +) + +var mappingInstallAllUpdatesOnManagedInstanceGroupUpdateType = map[string]InstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnum{ + "SECURITY": InstallAllUpdatesOnManagedInstanceGroupUpdateTypeSecurity, + "BUGFIX": InstallAllUpdatesOnManagedInstanceGroupUpdateTypeBugfix, + "ENHANCEMENT": InstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnhancement, + "OTHER": InstallAllUpdatesOnManagedInstanceGroupUpdateTypeOther, + "KSPLICE": InstallAllUpdatesOnManagedInstanceGroupUpdateTypeKsplice, + "ALL": InstallAllUpdatesOnManagedInstanceGroupUpdateTypeAll, +} + +// GetInstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnumValues Enumerates the set of values for InstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnum +func GetInstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnumValues() []InstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnum { + values := make([]InstallAllUpdatesOnManagedInstanceGroupUpdateTypeEnum, 0) + for _, v := range mappingInstallAllUpdatesOnManagedInstanceGroupUpdateType { + values = append(values, v) + } + return values +} diff --git a/osmanagement/install_all_windows_updates_on_managed_instance_request_response.go b/osmanagement/install_all_windows_updates_on_managed_instance_request_response.go index d31224289e..616f299b29 100644 --- a/osmanagement/install_all_windows_updates_on_managed_instance_request_response.go +++ b/osmanagement/install_all_windows_updates_on_managed_instance_request_response.go @@ -19,6 +19,9 @@ type InstallAllWindowsUpdatesOnManagedInstanceRequest struct { // OCID for the managed instance ManagedInstanceId *string `mandatory:"true" contributesTo:"path" name:"managedInstanceId"` + // The type of updates to be applied + UpdateType InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnum `mandatory:"false" contributesTo:"query" name:"updateType" omitEmpty:"true"` + // The client request ID for tracing. OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` @@ -79,3 +82,34 @@ func (response InstallAllWindowsUpdatesOnManagedInstanceResponse) String() strin func (response InstallAllWindowsUpdatesOnManagedInstanceResponse) HTTPResponse() *http.Response { return response.RawResponse } + +// InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnum Enum with underlying type: string +type InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnum string + +// Set of constants representing the allowable values for InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnum +const ( + InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeSecurity InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnum = "SECURITY" + InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeBugfix InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnum = "BUGFIX" + InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnhancement InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnum = "ENHANCEMENT" + InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeOther InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnum = "OTHER" + InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeKsplice InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnum = "KSPLICE" + InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeAll InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnum = "ALL" +) + +var mappingInstallAllWindowsUpdatesOnManagedInstanceUpdateType = map[string]InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnum{ + "SECURITY": InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeSecurity, + "BUGFIX": InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeBugfix, + "ENHANCEMENT": InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnhancement, + "OTHER": InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeOther, + "KSPLICE": InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeKsplice, + "ALL": InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeAll, +} + +// GetInstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnumValues Enumerates the set of values for InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnum +func GetInstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnumValues() []InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnum { + values := make([]InstallAllWindowsUpdatesOnManagedInstanceUpdateTypeEnum, 0) + for _, v := range mappingInstallAllWindowsUpdatesOnManagedInstanceUpdateType { + values = append(values, v) + } + return values +} diff --git a/osmanagement/kernel_crash_event.go b/osmanagement/kernel_crash_event.go new file mode 100644 index 0000000000..afe78c9ea8 --- /dev/null +++ b/osmanagement/kernel_crash_event.go @@ -0,0 +1,142 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/v46/common" +) + +// KernelCrashEvent Information about a Kernel Crash. +type KernelCrashEvent struct { + + // OCID identifier of the event + Id *string `mandatory:"true" json:"id"` + + // OCI identifier of the instance where the event occurred + InstanceId *string `mandatory:"false" json:"instanceId"` + + // OCI identifier of the compartement where the instance is + CompartmentId *string `mandatory:"false" json:"compartmentId"` + + // OCID identifier of the instance tenancy. + TenancyId *string `mandatory:"false" json:"tenancyId"` + + // human readable description of the event + Summary *string `mandatory:"false" json:"summary"` + + // Time of the occurrence of the event + Timestamp *common.SDKTime `mandatory:"false" json:"timestamp"` + + // Unique ID used to group event with the same characteristics together. + // The list of such groups of event can be retrieved via /recurringEvents/{EventFingerprint} + EventFingerprint *string `mandatory:"false" json:"eventFingerprint"` + + // Event occurrence count. Number of time the event has happen on the system. + Count *int `mandatory:"false" json:"count"` + + // Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. + // Example: `{"bar-key": "value"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // Example: `{"foo-namespace": {"bar-key": "value"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` + + // Usage of system tag keys. These predefined keys are scoped to namespaces. + // Example: `{"orcl-cloud": {"free-tier-retained": "true"}}` + SystemTags map[string]map[string]interface{} `mandatory:"false" json:"systemTags"` + + // reason of the crash + Reason *string `mandatory:"false" json:"reason"` + + // First occurrence time of the event + TimeFirstOccurred *common.SDKTime `mandatory:"false" json:"timeFirstOccurred"` + + Vmcore *KernelVmCoreInformation `mandatory:"false" json:"vmcore"` + + Content *EventContent `mandatory:"false" json:"content"` + + System *CrashEventSystemInformation `mandatory:"false" json:"system"` +} + +//GetId returns Id +func (m KernelCrashEvent) GetId() *string { + return m.Id +} + +//GetInstanceId returns InstanceId +func (m KernelCrashEvent) GetInstanceId() *string { + return m.InstanceId +} + +//GetCompartmentId returns CompartmentId +func (m KernelCrashEvent) GetCompartmentId() *string { + return m.CompartmentId +} + +//GetTenancyId returns TenancyId +func (m KernelCrashEvent) GetTenancyId() *string { + return m.TenancyId +} + +//GetSummary returns Summary +func (m KernelCrashEvent) GetSummary() *string { + return m.Summary +} + +//GetTimestamp returns Timestamp +func (m KernelCrashEvent) GetTimestamp() *common.SDKTime { + return m.Timestamp +} + +//GetEventFingerprint returns EventFingerprint +func (m KernelCrashEvent) GetEventFingerprint() *string { + return m.EventFingerprint +} + +//GetCount returns Count +func (m KernelCrashEvent) GetCount() *int { + return m.Count +} + +//GetFreeformTags returns FreeformTags +func (m KernelCrashEvent) GetFreeformTags() map[string]string { + return m.FreeformTags +} + +//GetDefinedTags returns DefinedTags +func (m KernelCrashEvent) GetDefinedTags() map[string]map[string]interface{} { + return m.DefinedTags +} + +//GetSystemTags returns SystemTags +func (m KernelCrashEvent) GetSystemTags() map[string]map[string]interface{} { + return m.SystemTags +} + +func (m KernelCrashEvent) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m KernelCrashEvent) MarshalJSON() (buff []byte, e error) { + type MarshalTypeKernelCrashEvent KernelCrashEvent + s := struct { + DiscriminatorParam string `json:"eventType"` + MarshalTypeKernelCrashEvent + }{ + "KERNEL_CRASH", + (MarshalTypeKernelCrashEvent)(m), + } + + return json.Marshal(&s) +} diff --git a/osmanagement/kernel_oops_event.go b/osmanagement/kernel_oops_event.go new file mode 100644 index 0000000000..75b3deb9ae --- /dev/null +++ b/osmanagement/kernel_oops_event.go @@ -0,0 +1,142 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/v46/common" +) + +// KernelOopsEvent Information about a Kernel Oops. +type KernelOopsEvent struct { + + // OCID identifier of the event + Id *string `mandatory:"true" json:"id"` + + // OCI identifier of the instance where the event occurred + InstanceId *string `mandatory:"false" json:"instanceId"` + + // OCI identifier of the compartement where the instance is + CompartmentId *string `mandatory:"false" json:"compartmentId"` + + // OCID identifier of the instance tenancy. + TenancyId *string `mandatory:"false" json:"tenancyId"` + + // human readable description of the event + Summary *string `mandatory:"false" json:"summary"` + + // Time of the occurrence of the event + Timestamp *common.SDKTime `mandatory:"false" json:"timestamp"` + + // Unique ID used to group event with the same characteristics together. + // The list of such groups of event can be retrieved via /recurringEvents/{EventFingerprint} + EventFingerprint *string `mandatory:"false" json:"eventFingerprint"` + + // Event occurrence count. Number of time the event has happen on the system. + Count *int `mandatory:"false" json:"count"` + + // Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. + // Example: `{"bar-key": "value"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // Example: `{"foo-namespace": {"bar-key": "value"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` + + // Usage of system tag keys. These predefined keys are scoped to namespaces. + // Example: `{"orcl-cloud": {"free-tier-retained": "true"}}` + SystemTags map[string]map[string]interface{} `mandatory:"false" json:"systemTags"` + + // reason of the crash + Reason *string `mandatory:"false" json:"reason"` + + // First occurrence time of the event + TimeFirstOccurred *common.SDKTime `mandatory:"false" json:"timeFirstOccurred"` + + Vmcore *KernelVmCoreInformation `mandatory:"false" json:"vmcore"` + + Content *EventContent `mandatory:"false" json:"content"` + + System *CrashEventSystemInformation `mandatory:"false" json:"system"` +} + +//GetId returns Id +func (m KernelOopsEvent) GetId() *string { + return m.Id +} + +//GetInstanceId returns InstanceId +func (m KernelOopsEvent) GetInstanceId() *string { + return m.InstanceId +} + +//GetCompartmentId returns CompartmentId +func (m KernelOopsEvent) GetCompartmentId() *string { + return m.CompartmentId +} + +//GetTenancyId returns TenancyId +func (m KernelOopsEvent) GetTenancyId() *string { + return m.TenancyId +} + +//GetSummary returns Summary +func (m KernelOopsEvent) GetSummary() *string { + return m.Summary +} + +//GetTimestamp returns Timestamp +func (m KernelOopsEvent) GetTimestamp() *common.SDKTime { + return m.Timestamp +} + +//GetEventFingerprint returns EventFingerprint +func (m KernelOopsEvent) GetEventFingerprint() *string { + return m.EventFingerprint +} + +//GetCount returns Count +func (m KernelOopsEvent) GetCount() *int { + return m.Count +} + +//GetFreeformTags returns FreeformTags +func (m KernelOopsEvent) GetFreeformTags() map[string]string { + return m.FreeformTags +} + +//GetDefinedTags returns DefinedTags +func (m KernelOopsEvent) GetDefinedTags() map[string]map[string]interface{} { + return m.DefinedTags +} + +//GetSystemTags returns SystemTags +func (m KernelOopsEvent) GetSystemTags() map[string]map[string]interface{} { + return m.SystemTags +} + +func (m KernelOopsEvent) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m KernelOopsEvent) MarshalJSON() (buff []byte, e error) { + type MarshalTypeKernelOopsEvent KernelOopsEvent + s := struct { + DiscriminatorParam string `json:"eventType"` + MarshalTypeKernelOopsEvent + }{ + "KERNEL_OOPS", + (MarshalTypeKernelOopsEvent)(m), + } + + return json.Marshal(&s) +} diff --git a/osmanagement/kernel_vm_core_information.go b/osmanagement/kernel_vm_core_information.go new file mode 100644 index 0000000000..551a89775c --- /dev/null +++ b/osmanagement/kernel_vm_core_information.go @@ -0,0 +1,29 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" +) + +// KernelVmCoreInformation VMcore information. +type KernelVmCoreInformation struct { + + // Kernel module responsible of the crash. + Component *string `mandatory:"false" json:"component"` + + // Crash backtrace. + Backtrace *string `mandatory:"false" json:"backtrace"` +} + +func (m KernelVmCoreInformation) String() string { + return common.PointerString(m) +} diff --git a/osmanagement/list_events_request_response.go b/osmanagement/list_events_request_response.go new file mode 100644 index 0000000000..b335a9d41c --- /dev/null +++ b/osmanagement/list_events_request_response.go @@ -0,0 +1,193 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" + "net/http" +) + +// ListEventsRequest wrapper for the ListEvents operation +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/ListEvents.go.html to see an example of how to use ListEventsRequest. +type ListEventsRequest struct { + + // Instance Oracle Cloud identifier (ocid) + ManagedInstanceId *string `mandatory:"true" contributesTo:"path" name:"managedInstanceId"` + + // The ID of the compartment in which to list resources. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // Unique event identifier (OCID) + EventId *string `mandatory:"false" contributesTo:"query" name:"eventId"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The sort order to use, either 'asc' or 'desc'. + SortOrder ListEventsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // The field to sort by. Only one sort order may be provided. Default order for TIMECREATED is descending. Default order for DISPLAYNAME is ascending. If no value is specified TIMECREATED is default. + SortBy ListEventsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The client request ID for tracing. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A filter to return only event of given type. + EventType ListEventsEventTypeEnum `mandatory:"false" contributesTo:"query" name:"eventType" omitEmpty:"true"` + + // filter event occurrence. Selecting only those last occurred before given date in ISO 8601 format + // Example: 2017-07-14T02:40:00.000Z + LatestTimestampLessThan *common.SDKTime `mandatory:"false" contributesTo:"query" name:"latestTimestampLessThan"` + + // filter event occurrence. Selecting only those last occurred on or after given date in ISO 8601 format + // Example: 2017-07-14T02:40:00.000Z + LatestTimestampGreaterThanOrEqualTo *common.SDKTime `mandatory:"false" contributesTo:"query" name:"latestTimestampGreaterThanOrEqualTo"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request ListEventsRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request ListEventsRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request ListEventsRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request ListEventsRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ListEventsResponse wrapper for the ListEvents operation +type ListEventsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // A list of EventCollection instances + EventCollection `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of items. When paging through a list, if this + // header appears in the response, then a partial list might have been + // returned. Include this value as the `page` parameter for the subsequent + // GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListEventsResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response ListEventsResponse) HTTPResponse() *http.Response { + return response.RawResponse +} + +// ListEventsSortOrderEnum Enum with underlying type: string +type ListEventsSortOrderEnum string + +// Set of constants representing the allowable values for ListEventsSortOrderEnum +const ( + ListEventsSortOrderAsc ListEventsSortOrderEnum = "ASC" + ListEventsSortOrderDesc ListEventsSortOrderEnum = "DESC" +) + +var mappingListEventsSortOrder = map[string]ListEventsSortOrderEnum{ + "ASC": ListEventsSortOrderAsc, + "DESC": ListEventsSortOrderDesc, +} + +// GetListEventsSortOrderEnumValues Enumerates the set of values for ListEventsSortOrderEnum +func GetListEventsSortOrderEnumValues() []ListEventsSortOrderEnum { + values := make([]ListEventsSortOrderEnum, 0) + for _, v := range mappingListEventsSortOrder { + values = append(values, v) + } + return values +} + +// ListEventsSortByEnum Enum with underlying type: string +type ListEventsSortByEnum string + +// Set of constants representing the allowable values for ListEventsSortByEnum +const ( + ListEventsSortByTimecreated ListEventsSortByEnum = "TIMECREATED" + ListEventsSortByDisplayname ListEventsSortByEnum = "DISPLAYNAME" +) + +var mappingListEventsSortBy = map[string]ListEventsSortByEnum{ + "TIMECREATED": ListEventsSortByTimecreated, + "DISPLAYNAME": ListEventsSortByDisplayname, +} + +// GetListEventsSortByEnumValues Enumerates the set of values for ListEventsSortByEnum +func GetListEventsSortByEnumValues() []ListEventsSortByEnum { + values := make([]ListEventsSortByEnum, 0) + for _, v := range mappingListEventsSortBy { + values = append(values, v) + } + return values +} + +// ListEventsEventTypeEnum Enum with underlying type: string +type ListEventsEventTypeEnum string + +// Set of constants representing the allowable values for ListEventsEventTypeEnum +const ( + ListEventsEventTypeKernelOops ListEventsEventTypeEnum = "KERNEL_OOPS" + ListEventsEventTypeKernelCrash ListEventsEventTypeEnum = "KERNEL_CRASH" + ListEventsEventTypeCrash ListEventsEventTypeEnum = "CRASH" + ListEventsEventTypeExploitAttempt ListEventsEventTypeEnum = "EXPLOIT_ATTEMPT" + ListEventsEventTypeCompliance ListEventsEventTypeEnum = "COMPLIANCE" + ListEventsEventTypeTuningSuggestion ListEventsEventTypeEnum = "TUNING_SUGGESTION" + ListEventsEventTypeTuningApplied ListEventsEventTypeEnum = "TUNING_APPLIED" + ListEventsEventTypeSecurity ListEventsEventTypeEnum = "SECURITY" + ListEventsEventTypeError ListEventsEventTypeEnum = "ERROR" + ListEventsEventTypeWarning ListEventsEventTypeEnum = "WARNING" +) + +var mappingListEventsEventType = map[string]ListEventsEventTypeEnum{ + "KERNEL_OOPS": ListEventsEventTypeKernelOops, + "KERNEL_CRASH": ListEventsEventTypeKernelCrash, + "CRASH": ListEventsEventTypeCrash, + "EXPLOIT_ATTEMPT": ListEventsEventTypeExploitAttempt, + "COMPLIANCE": ListEventsEventTypeCompliance, + "TUNING_SUGGESTION": ListEventsEventTypeTuningSuggestion, + "TUNING_APPLIED": ListEventsEventTypeTuningApplied, + "SECURITY": ListEventsEventTypeSecurity, + "ERROR": ListEventsEventTypeError, + "WARNING": ListEventsEventTypeWarning, +} + +// GetListEventsEventTypeEnumValues Enumerates the set of values for ListEventsEventTypeEnum +func GetListEventsEventTypeEnumValues() []ListEventsEventTypeEnum { + values := make([]ListEventsEventTypeEnum, 0) + for _, v := range mappingListEventsEventType { + values = append(values, v) + } + return values +} diff --git a/osmanagement/list_related_events_request_response.go b/osmanagement/list_related_events_request_response.go new file mode 100644 index 0000000000..eaf263d471 --- /dev/null +++ b/osmanagement/list_related_events_request_response.go @@ -0,0 +1,150 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" + "net/http" +) + +// ListRelatedEventsRequest wrapper for the ListRelatedEvents operation +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/ListRelatedEvents.go.html to see an example of how to use ListRelatedEventsRequest. +type ListRelatedEventsRequest struct { + + // Event fingerprint identifier + EventFingerprint *string `mandatory:"true" contributesTo:"query" name:"eventFingerprint"` + + // The ID of the compartment in which to list resources. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The client request ID for tracing. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The sort order to use, either 'asc' or 'desc'. + SortOrder ListRelatedEventsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // The field to sort by. Only one sort order may be provided. Default order for id is descending. + SortBy ListRelatedEventsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // filter event occurrence. Selecting only those last occurred before given date in ISO 8601 format + // Example: 2017-07-14T02:40:00.000Z + LatestTimestampLessThan *common.SDKTime `mandatory:"false" contributesTo:"query" name:"latestTimestampLessThan"` + + // filter event occurrence. Selecting only those last occurred on or after given date in ISO 8601 format + // Example: 2017-07-14T02:40:00.000Z + LatestTimestampGreaterThanOrEqualTo *common.SDKTime `mandatory:"false" contributesTo:"query" name:"latestTimestampGreaterThanOrEqualTo"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request ListRelatedEventsRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request ListRelatedEventsRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request ListRelatedEventsRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request ListRelatedEventsRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ListRelatedEventsResponse wrapper for the ListRelatedEvents operation +type ListRelatedEventsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // A list of RelatedEventCollection instances + RelatedEventCollection `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of items. When paging through a list, if this + // header appears in the response, then a partial list might have been + // returned. Include this value as the `page` parameter for the subsequent + // GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListRelatedEventsResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response ListRelatedEventsResponse) HTTPResponse() *http.Response { + return response.RawResponse +} + +// ListRelatedEventsSortOrderEnum Enum with underlying type: string +type ListRelatedEventsSortOrderEnum string + +// Set of constants representing the allowable values for ListRelatedEventsSortOrderEnum +const ( + ListRelatedEventsSortOrderAsc ListRelatedEventsSortOrderEnum = "ASC" + ListRelatedEventsSortOrderDesc ListRelatedEventsSortOrderEnum = "DESC" +) + +var mappingListRelatedEventsSortOrder = map[string]ListRelatedEventsSortOrderEnum{ + "ASC": ListRelatedEventsSortOrderAsc, + "DESC": ListRelatedEventsSortOrderDesc, +} + +// GetListRelatedEventsSortOrderEnumValues Enumerates the set of values for ListRelatedEventsSortOrderEnum +func GetListRelatedEventsSortOrderEnumValues() []ListRelatedEventsSortOrderEnum { + values := make([]ListRelatedEventsSortOrderEnum, 0) + for _, v := range mappingListRelatedEventsSortOrder { + values = append(values, v) + } + return values +} + +// ListRelatedEventsSortByEnum Enum with underlying type: string +type ListRelatedEventsSortByEnum string + +// Set of constants representing the allowable values for ListRelatedEventsSortByEnum +const ( + ListRelatedEventsSortByInstanceid ListRelatedEventsSortByEnum = "instanceId" + ListRelatedEventsSortById ListRelatedEventsSortByEnum = "id" + ListRelatedEventsSortByEventfingerprint ListRelatedEventsSortByEnum = "eventFingerprint" +) + +var mappingListRelatedEventsSortBy = map[string]ListRelatedEventsSortByEnum{ + "instanceId": ListRelatedEventsSortByInstanceid, + "id": ListRelatedEventsSortById, + "eventFingerprint": ListRelatedEventsSortByEventfingerprint, +} + +// GetListRelatedEventsSortByEnumValues Enumerates the set of values for ListRelatedEventsSortByEnum +func GetListRelatedEventsSortByEnumValues() []ListRelatedEventsSortByEnum { + values := make([]ListRelatedEventsSortByEnum, 0) + for _, v := range mappingListRelatedEventsSortBy { + values = append(values, v) + } + return values +} diff --git a/osmanagement/list_scheduled_jobs_request_response.go b/osmanagement/list_scheduled_jobs_request_response.go index d6d46061fb..1d7bd8b224 100644 --- a/osmanagement/list_scheduled_jobs_request_response.go +++ b/osmanagement/list_scheduled_jobs_request_response.go @@ -53,6 +53,9 @@ type ListScheduledJobsRequest struct { // The OS family for which to list resources. OsFamily ListScheduledJobsOsFamilyEnum `mandatory:"false" contributesTo:"query" name:"osFamily" omitEmpty:"true"` + // If true, will only filter out restricted Autonomous Linux Scheduled Job + IsRestricted *bool `mandatory:"false" contributesTo:"query" name:"isRestricted"` + // Metadata about the request. This information will not be transmitted to the service, but // represents information that the SDK will consume to drive retry behavior. RequestMetadata common.RequestMetadata diff --git a/osmanagement/managed_instance.go b/osmanagement/managed_instance.go index 8685c35861..33abfd9dd0 100644 --- a/osmanagement/managed_instance.go +++ b/osmanagement/managed_instance.go @@ -66,6 +66,18 @@ type ManagedInstance struct { // Indicates whether a reboot is required to complete installation of updates. IsRebootRequired *bool `mandatory:"false" json:"isRebootRequired"` + // OCID of the ONS topic used to send notification to users + NotificationTopicId *string `mandatory:"false" json:"notificationTopicId"` + + // The ksplice effective kernel version + KspliceEffectiveKernelVersion *string `mandatory:"false" json:"kspliceEffectiveKernelVersion"` + + // True if user allow data collection for this instance + IsDataCollectionAuthorized *bool `mandatory:"false" json:"isDataCollectionAuthorized"` + + // if present, indicates the Managed Instance is an autonomous instance. Holds all the Autonomous specific information + Autonomous *AutonomousSettings `mandatory:"false" json:"autonomous"` + // Number of security type updates available to be installed SecurityUpdatesAvailable *int `mandatory:"false" json:"securityUpdatesAvailable"` diff --git a/osmanagement/osmanagement_client.go b/osmanagement/osmanagement_client.go index 71ba3e87ca..ab9dc5a430 100644 --- a/osmanagement/osmanagement_client.go +++ b/osmanagement/osmanagement_client.go @@ -1540,6 +1540,66 @@ func (client OsManagementClient) installAllPackageUpdatesOnManagedInstance(ctx c return response, err } +// InstallAllUpdatesOnManagedInstanceGroup Install all of the available updates for the Managed Instance Group. +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/InstallAllUpdatesOnManagedInstanceGroup.go.html to see an example of how to use InstallAllUpdatesOnManagedInstanceGroup API. +func (client OsManagementClient) InstallAllUpdatesOnManagedInstanceGroup(ctx context.Context, request InstallAllUpdatesOnManagedInstanceGroupRequest) (response InstallAllUpdatesOnManagedInstanceGroupResponse, err error) { + var ociResponse common.OCIResponse + policy := common.NoRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + + if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { + request.OpcRetryToken = common.String(common.RetryToken()) + } + + ociResponse, err = common.Retry(ctx, request, client.installAllUpdatesOnManagedInstanceGroup, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = InstallAllUpdatesOnManagedInstanceGroupResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = InstallAllUpdatesOnManagedInstanceGroupResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(InstallAllUpdatesOnManagedInstanceGroupResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into InstallAllUpdatesOnManagedInstanceGroupResponse") + } + return +} + +// installAllUpdatesOnManagedInstanceGroup implements the OCIOperation interface (enables retrying operations) +func (client OsManagementClient) installAllUpdatesOnManagedInstanceGroup(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPost, "/managedInstanceGroups/{managedInstanceGroupId}/actions/updates/installAll", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response InstallAllUpdatesOnManagedInstanceGroupResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + // InstallAllWindowsUpdatesOnManagedInstance Install all of the available Windows updates for the managed instance. // // See also @@ -3063,6 +3123,61 @@ func (client OsManagementClient) skipNextScheduledJobExecution(ctx context.Conte return response, err } +// UpdateManagedInstance Updates a specific Managed Instance. +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/UpdateManagedInstance.go.html to see an example of how to use UpdateManagedInstance API. +func (client OsManagementClient) UpdateManagedInstance(ctx context.Context, request UpdateManagedInstanceRequest) (response UpdateManagedInstanceResponse, err error) { + var ociResponse common.OCIResponse + policy := common.NoRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.updateManagedInstance, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = UpdateManagedInstanceResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = UpdateManagedInstanceResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(UpdateManagedInstanceResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into UpdateManagedInstanceResponse") + } + return +} + +// updateManagedInstance implements the OCIOperation interface (enables retrying operations) +func (client OsManagementClient) updateManagedInstance(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPut, "/managedInstances/{managedInstanceId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response UpdateManagedInstanceResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + // UpdateManagedInstanceGroup Updates a specific Managed Instance Group. // // See also diff --git a/osmanagement/osmanagement_event_client.go b/osmanagement/osmanagement_event_client.go new file mode 100644 index 0000000000..d17c7334b8 --- /dev/null +++ b/osmanagement/osmanagement_event_client.go @@ -0,0 +1,530 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +import ( + "context" + "fmt" + "github.com/oracle/oci-go-sdk/v46/common" + "github.com/oracle/oci-go-sdk/v46/common/auth" + "net/http" +) + +//EventClient a client for Event +type EventClient struct { + common.BaseClient + config *common.ConfigurationProvider +} + +// NewEventClientWithConfigurationProvider Creates a new default Event client with the given configuration provider. +// the configuration provider will be used for the default signer as well as reading the region +func NewEventClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client EventClient, err error) { + provider, err := auth.GetGenericConfigurationProvider(configProvider) + if err != nil { + return client, err + } + baseClient, e := common.NewClientWithConfig(provider) + if e != nil { + return client, e + } + return newEventClientFromBaseClient(baseClient, provider) +} + +// NewEventClientWithOboToken Creates a new default Event client with the given configuration provider. +// The obotoken will be added to default headers and signed; the configuration provider will be used for the signer +// as well as reading the region +func NewEventClientWithOboToken(configProvider common.ConfigurationProvider, oboToken string) (client EventClient, err error) { + baseClient, err := common.NewClientWithOboToken(configProvider, oboToken) + if err != nil { + return client, err + } + + return newEventClientFromBaseClient(baseClient, configProvider) +} + +func newEventClientFromBaseClient(baseClient common.BaseClient, configProvider common.ConfigurationProvider) (client EventClient, err error) { + client = EventClient{BaseClient: baseClient} + client.BasePath = "20190801" + err = client.setConfigurationProvider(configProvider) + return +} + +// SetRegion overrides the region of this client. +func (client *EventClient) SetRegion(region string) { + client.Host = common.StringToRegion(region).EndpointForTemplate("osmanagement", "https://osms.{region}.oci.{secondLevelDomain}") +} + +// SetConfigurationProvider sets the configuration provider including the region, returns an error if is not valid +func (client *EventClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error { + if ok, err := common.IsConfigurationProviderValid(configProvider); !ok { + return err + } + + // Error has been checked already + region, _ := configProvider.Region() + client.SetRegion(region) + client.config = &configProvider + return nil +} + +// ConfigurationProvider the ConfigurationProvider used in this client, or null if none set +func (client *EventClient) ConfigurationProvider() *common.ConfigurationProvider { + return client.config +} + +// DeleteEventContent Delete an event content ZIP archive from the service +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/DeleteEventContent.go.html to see an example of how to use DeleteEventContent API. +func (client EventClient) DeleteEventContent(ctx context.Context, request DeleteEventContentRequest) (response DeleteEventContentResponse, err error) { + var ociResponse common.OCIResponse + policy := common.NoRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + + if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { + request.OpcRetryToken = common.String(common.RetryToken()) + } + + ociResponse, err = common.Retry(ctx, request, client.deleteEventContent, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = DeleteEventContentResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = DeleteEventContentResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(DeleteEventContentResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into DeleteEventContentResponse") + } + return +} + +// deleteEventContent implements the OCIOperation interface (enables retrying operations) +func (client EventClient) deleteEventContent(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodDelete, "/managedInstances/{managedInstanceId}/events/{eventId}/content", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response DeleteEventContentResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// GetEvent Gets an Event by identifier +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/GetEvent.go.html to see an example of how to use GetEvent API. +func (client EventClient) GetEvent(ctx context.Context, request GetEventRequest) (response GetEventResponse, err error) { + var ociResponse common.OCIResponse + policy := common.NoRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.getEvent, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = GetEventResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = GetEventResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(GetEventResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into GetEventResponse") + } + return +} + +// getEvent implements the OCIOperation interface (enables retrying operations) +func (client EventClient) getEvent(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/managedInstances/{managedInstanceId}/events/{eventId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response GetEventResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return response, err + } + + err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &event{}) + return response, err +} + +// GetEventContent Get additional data about a event as a ZIP archive. The archive content depends on the event eventType. +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/GetEventContent.go.html to see an example of how to use GetEventContent API. +func (client EventClient) GetEventContent(ctx context.Context, request GetEventContentRequest) (response GetEventContentResponse, err error) { + var ociResponse common.OCIResponse + policy := common.NoRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.getEventContent, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = GetEventContentResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = GetEventContentResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(GetEventContentResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into GetEventContentResponse") + } + return +} + +// getEventContent implements the OCIOperation interface (enables retrying operations) +func (client EventClient) getEventContent(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/managedInstances/{managedInstanceId}/events/{eventId}/content", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response GetEventContentResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + response.RawResponse = httpResponse + if err != nil { + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// GetEventReport Get summary information about events on this instance. +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/GetEventReport.go.html to see an example of how to use GetEventReport API. +func (client EventClient) GetEventReport(ctx context.Context, request GetEventReportRequest) (response GetEventReportResponse, err error) { + var ociResponse common.OCIResponse + policy := common.NoRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.getEventReport, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = GetEventReportResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = GetEventReportResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(GetEventReportResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into GetEventReportResponse") + } + return +} + +// getEventReport implements the OCIOperation interface (enables retrying operations) +func (client EventClient) getEventReport(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/managedInstances/{managedInstanceId}/events/report", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response GetEventReportResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// ListEvents Returns a list of Events. +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/ListEvents.go.html to see an example of how to use ListEvents API. +func (client EventClient) ListEvents(ctx context.Context, request ListEventsRequest) (response ListEventsResponse, err error) { + var ociResponse common.OCIResponse + policy := common.NoRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.listEvents, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = ListEventsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = ListEventsResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(ListEventsResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into ListEventsResponse") + } + return +} + +// listEvents implements the OCIOperation interface (enables retrying operations) +func (client EventClient) listEvents(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/managedInstances/{managedInstanceId}/events", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response ListEventsResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// ListRelatedEvents Returns a list of related events. For now pagination is not implemented. +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/ListRelatedEvents.go.html to see an example of how to use ListRelatedEvents API. +func (client EventClient) ListRelatedEvents(ctx context.Context, request ListRelatedEventsRequest) (response ListRelatedEventsResponse, err error) { + var ociResponse common.OCIResponse + policy := common.NoRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.listRelatedEvents, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = ListRelatedEventsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = ListRelatedEventsResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(ListRelatedEventsResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into ListRelatedEventsResponse") + } + return +} + +// listRelatedEvents implements the OCIOperation interface (enables retrying operations) +func (client EventClient) listRelatedEvents(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/relatedEvents", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response ListRelatedEventsResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// UpdateEvent Updates an existing event associated to a managed instance +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/UpdateEvent.go.html to see an example of how to use UpdateEvent API. +func (client EventClient) UpdateEvent(ctx context.Context, request UpdateEventRequest) (response UpdateEventResponse, err error) { + var ociResponse common.OCIResponse + policy := common.NoRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.updateEvent, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = UpdateEventResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = UpdateEventResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(UpdateEventResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into UpdateEventResponse") + } + return +} + +// updateEvent implements the OCIOperation interface (enables retrying operations) +func (client EventClient) updateEvent(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPut, "/managedInstances/{managedInstanceId}/events/{eventId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response UpdateEventResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return response, err + } + + err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &event{}) + return response, err +} + +// UploadEventContent Upload the event content as a ZIP archive from the managed instance to the service +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/UploadEventContent.go.html to see an example of how to use UploadEventContent API. +func (client EventClient) UploadEventContent(ctx context.Context, request UploadEventContentRequest) (response UploadEventContentResponse, err error) { + var ociResponse common.OCIResponse + policy := common.NoRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + + if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { + request.OpcRetryToken = common.String(common.RetryToken()) + } + + ociResponse, err = common.Retry(ctx, request, client.uploadEventContent, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = UploadEventContentResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = UploadEventContentResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(UploadEventContentResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into UploadEventContentResponse") + } + return +} + +// uploadEventContent implements the OCIOperation interface (enables retrying operations) +func (client EventClient) uploadEventContent(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPost, "/managedInstances/{managedInstanceId}/events/{eventId}/content/actions/upload", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response UploadEventContentResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} diff --git a/osmanagement/package_update_types.go b/osmanagement/package_update_types.go index adf6b74b8c..79c870b44c 100644 --- a/osmanagement/package_update_types.go +++ b/osmanagement/package_update_types.go @@ -18,6 +18,8 @@ const ( PackageUpdateTypesSecurity PackageUpdateTypesEnum = "SECURITY" PackageUpdateTypesBugfix PackageUpdateTypesEnum = "BUGFIX" PackageUpdateTypesEnhancement PackageUpdateTypesEnum = "ENHANCEMENT" + PackageUpdateTypesOther PackageUpdateTypesEnum = "OTHER" + PackageUpdateTypesKsplice PackageUpdateTypesEnum = "KSPLICE" PackageUpdateTypesAll PackageUpdateTypesEnum = "ALL" ) @@ -25,6 +27,8 @@ var mappingPackageUpdateTypes = map[string]PackageUpdateTypesEnum{ "SECURITY": PackageUpdateTypesSecurity, "BUGFIX": PackageUpdateTypesBugfix, "ENHANCEMENT": PackageUpdateTypesEnhancement, + "OTHER": PackageUpdateTypesOther, + "KSPLICE": PackageUpdateTypesKsplice, "ALL": PackageUpdateTypesAll, } diff --git a/osmanagement/related_event_collection.go b/osmanagement/related_event_collection.go new file mode 100644 index 0000000000..fba8191476 --- /dev/null +++ b/osmanagement/related_event_collection.go @@ -0,0 +1,26 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" +) + +// RelatedEventCollection Results of a event occurence search. Contains RelatedEventSummary. +type RelatedEventCollection struct { + + // List of event occurrence. + Items []RelatedEventSummary `mandatory:"true" json:"items"` +} + +func (m RelatedEventCollection) String() string { + return common.PointerString(m) +} diff --git a/osmanagement/related_event_summary.go b/osmanagement/related_event_summary.go new file mode 100644 index 0000000000..ba18e843c1 --- /dev/null +++ b/osmanagement/related_event_summary.go @@ -0,0 +1,32 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" +) + +// RelatedEventSummary Event occurrence on managed instances. +type RelatedEventSummary struct { + + // OCID identifier of the event + Id *string `mandatory:"true" json:"id"` + + // OCID identifier of the instance + InstanceId *string `mandatory:"true" json:"instanceId"` + + // time occurence + Timestamp *common.SDKTime `mandatory:"false" json:"timestamp"` +} + +func (m RelatedEventSummary) String() string { + return common.PointerString(m) +} diff --git a/osmanagement/scheduled_job.go b/osmanagement/scheduled_job.go index 5b421249ef..b59089ff51 100644 --- a/osmanagement/scheduled_job.go +++ b/osmanagement/scheduled_job.go @@ -79,6 +79,9 @@ type ScheduledJob struct { // The Operating System type of the managed instance. OsFamily OsFamiliesEnum `mandatory:"false" json:"osFamily,omitempty"` + + // true, if the schedule job has its update capabilities restricted. (Used to track Autonomous Scheduled Job) + IsRestricted *bool `mandatory:"false" json:"isRestricted"` } func (m ScheduledJob) String() string { diff --git a/osmanagement/scheduled_job_summary.go b/osmanagement/scheduled_job_summary.go index a5fd5640db..60038ff3e2 100644 --- a/osmanagement/scheduled_job_summary.go +++ b/osmanagement/scheduled_job_summary.go @@ -57,6 +57,9 @@ type ScheduledJobSummary struct { // The Operating System type of the managed instance. OsFamily OsFamiliesEnum `mandatory:"false" json:"osFamily,omitempty"` + + // true, if the schedule job has its update capabilities restricted. (Used to track Autonomous Scheduled Job) + IsRestricted *bool `mandatory:"false" json:"isRestricted"` } func (m ScheduledJobSummary) String() string { diff --git a/osmanagement/software_package_dependency.go b/osmanagement/software_package_dependency.go index 5477a9d369..15bcad8ae4 100644 --- a/osmanagement/software_package_dependency.go +++ b/osmanagement/software_package_dependency.go @@ -14,7 +14,7 @@ import ( "github.com/oracle/oci-go-sdk/v46/common" ) -// SoftwarePackageDependency A dependecy for a software package +// SoftwarePackageDependency A dependency for a software package type SoftwarePackageDependency struct { // the software package's dependency diff --git a/osmanagement/update_event_details.go b/osmanagement/update_event_details.go new file mode 100644 index 0000000000..aeb1a7559d --- /dev/null +++ b/osmanagement/update_event_details.go @@ -0,0 +1,31 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" +) + +// UpdateEventDetails Information for updating an event associated with a managed instance +type UpdateEventDetails struct { + + // Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. + // Example: `{"bar-key": "value"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // Example: `{"foo-namespace": {"bar-key": "value"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` +} + +func (m UpdateEventDetails) String() string { + return common.PointerString(m) +} diff --git a/osmanagement/update_event_request_response.go b/osmanagement/update_event_request_response.go new file mode 100644 index 0000000000..3a45959d7d --- /dev/null +++ b/osmanagement/update_event_request_response.go @@ -0,0 +1,92 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" + "net/http" +) + +// UpdateEventRequest wrapper for the UpdateEvent operation +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/UpdateEvent.go.html to see an example of how to use UpdateEventRequest. +type UpdateEventRequest struct { + + // Instance Oracle Cloud identifier (ocid) + ManagedInstanceId *string `mandatory:"true" contributesTo:"path" name:"managedInstanceId"` + + // Unique Event identifier (OCID) + EventId *string `mandatory:"true" contributesTo:"path" name:"eventId"` + + // The ID of the compartment in which to list resources. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // Details about the event to update + UpdateEventDetails `contributesTo:"body"` + + // The client request ID for tracing. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // For optimistic concurrency control. In the PUT or DELETE call + // for a resource, set the `if-match` parameter to the value of the + // etag from a previous GET or POST response for that resource. + // The resource will be updated or deleted only if the etag you + // provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request UpdateEventRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request UpdateEventRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request UpdateEventRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request UpdateEventRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// UpdateEventResponse wrapper for the UpdateEvent operation +type UpdateEventResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Event instance + Event `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateEventResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response UpdateEventResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/osmanagement/update_managed_instance_details.go b/osmanagement/update_managed_instance_details.go new file mode 100644 index 0000000000..8d2e467ef8 --- /dev/null +++ b/osmanagement/update_managed_instance_details.go @@ -0,0 +1,29 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// OS Management API +// +// API for the OS Management service. Use these API operations for working +// with Managed instances and Managed instance groups. +// + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" +) + +// UpdateManagedInstanceDetails Information to update a managed instance +type UpdateManagedInstanceDetails struct { + + // OCID of the ONS topic used to send notification to users + NotificationTopicId *string `mandatory:"false" json:"notificationTopicId"` + + // True if user allow data collection for this instance + IsDataCollectionAuthorized *bool `mandatory:"false" json:"isDataCollectionAuthorized"` +} + +func (m UpdateManagedInstanceDetails) String() string { + return common.PointerString(m) +} diff --git a/osmanagement/update_managed_instance_request_response.go b/osmanagement/update_managed_instance_request_response.go new file mode 100644 index 0000000000..77b1a996a1 --- /dev/null +++ b/osmanagement/update_managed_instance_request_response.go @@ -0,0 +1,86 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" + "net/http" +) + +// UpdateManagedInstanceRequest wrapper for the UpdateManagedInstance operation +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/UpdateManagedInstance.go.html to see an example of how to use UpdateManagedInstanceRequest. +type UpdateManagedInstanceRequest struct { + + // OCID for the managed instance + ManagedInstanceId *string `mandatory:"true" contributesTo:"path" name:"managedInstanceId"` + + // Details about a Managed Instance to update + UpdateManagedInstanceDetails `contributesTo:"body"` + + // The client request ID for tracing. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // For optimistic concurrency control. In the PUT or DELETE call + // for a resource, set the `if-match` parameter to the value of the + // etag from a previous GET or POST response for that resource. + // The resource will be updated or deleted only if the etag you + // provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request UpdateManagedInstanceRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request UpdateManagedInstanceRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request UpdateManagedInstanceRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request UpdateManagedInstanceRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// UpdateManagedInstanceResponse wrapper for the UpdateManagedInstance operation +type UpdateManagedInstanceResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The ManagedInstance instance + ManagedInstance `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateManagedInstanceResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response UpdateManagedInstanceResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/osmanagement/upload_event_content_request_response.go b/osmanagement/upload_event_content_request_response.go new file mode 100644 index 0000000000..b83fd82792 --- /dev/null +++ b/osmanagement/upload_event_content_request_response.go @@ -0,0 +1,90 @@ +// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package osmanagement + +import ( + "github.com/oracle/oci-go-sdk/v46/common" + "net/http" +) + +// UploadEventContentRequest wrapper for the UploadEventContent operation +// +// See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/osmanagement/UploadEventContent.go.html to see an example of how to use UploadEventContentRequest. +type UploadEventContentRequest struct { + + // Instance Oracle Cloud identifier (ocid) + ManagedInstanceId *string `mandatory:"true" contributesTo:"path" name:"managedInstanceId"` + + // Unique Event identifier (OCID) + EventId *string `mandatory:"true" contributesTo:"path" name:"eventId"` + + // The ID of the compartment in which to list resources. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The client request ID for tracing. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // For optimistic concurrency control. In the PUT or DELETE call + // for a resource, set the `if-match` parameter to the value of the + // etag from a previous GET or POST response for that resource. + // The resource will be updated or deleted only if the etag you + // provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations. For example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // might be rejected. + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request UploadEventContentRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request UploadEventContentRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request UploadEventContentRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request UploadEventContentRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// UploadEventContentResponse wrapper for the UploadEventContent operation +type UploadEventContentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UploadEventContentResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response UploadEventContentResponse) HTTPResponse() *http.Response { + return response.RawResponse +}