X

The latest cloud infrastructure announcements, technical solutions, and enterprise cloud insights.

You get a code sample! And you get a code sample!

Zack Menegakis
Senior Product Manager

Everybody gets a code sample!

While we’re not announcing a free car giveaway, we’d still like to tell you about a different kind of free giveaway: Oracle Cloud Infrastructure SDK code samples for almost every class and method in the Java, Python, TypeScript, .NET, Go, and Ruby SDKs. When you’re looking through our SDK documentation and need to understand how to implement a specific operation in your code, you can view a code sample as a starting point. Better yet, if you insert just a handful of parameter values specific to your cloud account and services that you’re working with, such as particular Oracle Cloud Identifiers (OCIDs) for your cloud resources, then you will have working code for your environment. This start can save you a huge amount of time.  

Where do I find this code, and what does it look like?

These code samples are included with the API Reference documentation in each of our Oracle Cloud SDKs, including Java, Python, TypeScript, .NET, Go, and Ruby. For example, I have a workload that needed to scale automatically with usage. I look through our Autoscaling documentation in my preferred programming language, .NET. First, I go to the SDK for .NET documentation and then click API Reference in the left pane of the web page.

A screenshot of the SDK for .NET documentation page.

Our full API Reference for .NET is now shown, where I either browse for this method or search for it in the top-left pane. I decided to pick the Oci.AutoscalingService to learn more about it and see if it helps to achieve my goal.

A screenshot of the left menu in the previous documentation page expanded with Oci.AutoscalingService outlined in green with arrows pointing to it.

Then I started reading about the AutoScalingClient. There is an example which follows the method's info with the following text: “Click here to see an example of how to use CreateAutoScalingConfiguration API.”

A screenshot of the Examples section outlined in green.

Clicking the link provides a premade example. An excerpt is shown below. 

A screenshot of the premade example code of the Autoscaling service.

Cool stuff! At this point, I only need to insert the parameter values specific to my cloud tenancy or other resources, such as OCIDs, and I can use this code.

Summary

See how much time you can save with code samples? The great news about this feature is that you get autogenerated code samples for all aspects of our SDKs. So, no matter which Oracle Cloud Infrastructure service you’re interested in integrating with, we now provide pre-populated code in a common programming language to guide you. Also, we have handwritten code samples for each SDK to provide examples for integrating across multiple services. You can find these examples on GitHub with each corresponding SDK project, such as this example for the Java SDK. Happy coding!

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha