oracle / oci-dotnet-sdk

Oracle Cloud Infrastructure SDK for .NET
https://cloud.oracle.com/cloud-infrastructure
Other
53 stars 20 forks source link

LogAnalytics - ListScheduledTasks - Enum parameter issue #149

Open jbcintra opened 1 year ago

jbcintra commented 1 year ago

Hi, I'm calling ListScheduledTasks which has 3 parameters. CompartmentId, NamespaceName, and TaskType. TaskType is LA Enum TaskType, with a set of values. I'm coding it to enumerate the values, so that it accomodates future changes.

var types = Enum.GetValues(typeof(TaskType)).Cast(); // this returns a list of TaskTypes to process in a foreach loop. The TaskType values are: UnknownEnumValue SavedSearch Acceleration Purge AccelerationMaintenance

Passing in UnknownEnumValue causes an ArgumentNullException error, so I've set that to skip..

When it gets to AccelerationMaintenance, it is passing in ACCELERATION_MAINTENANCE and taskType is invalid. The same error occurs via the CLI - so this is an API level error...

oci log-analytics scheduled-task list --namespace-name --compartment-id ocid1.compartment.oc1..**** --task-type ACCELERATION_MAINTENANCE --profile SSCL

yet the CLI outputs that as one of the approved values

github-anurag commented 1 year ago

@jbcintra Thanks for reporting this issue. We will investigate and let you know our findings.

github-anurag commented 1 year ago

@jbcintra I have reported this to the Log Analytics team. I will get back to you once they respond back with their finding.

jbcintra commented 1 year ago

Thanks @github-anurag

github-anurag commented 1 year ago

@jbcintra The ACCELERATION_MAINTENANCE taskType is an internal value and is not meant to be used via public APIs. The service team will be removing this enum from their API spec which would trigger its removal from the SDKs.

Also, the UnknownEnumValue enum only makes sense when the Service sends down a response enum whose value is not available in the version of the OCI Dotnet SDK you are using. It is not meant to be used in a request :)

jbcintra commented 1 year ago

Thanks @github-anurag , that explains why is wasn't handling the Unknown/null input then! I'll leave that disabled till it's removed from the next release. I was only referencing it as it was a mandatory variable!