Skip to content

Instantly share code, notes, and snippets.

View viralmodi's full-sized avatar

Viral Modi viralmodi

  • Oracle
View GitHub Profile
@viralmodi
viralmodi / Program.cs
Created August 25, 2020 06:47
Pushing a web image to Oracle Cloud Object Storage service
using Oci.Common;
using Oci.Common.Auth;
using Oci.ObjectstorageService;
using Oci.ObjectstorageService.Models;
using Oci.ObjectstorageService.Requests;
using Oci.ObjectstorageService.Responses;
using System;
using System.IO;
using System.Net;
using System.Threading.Tasks;
@viralmodi
viralmodi / consoleAppOutput
Created July 16, 2020 08:32
Output of ListRegions
AMS : eu-amsterdam-1
BOM : ap-mumbai-1
FRA : eu-frankfurt-1
GRU : sa-saopaulo-1
HYD : ap-hyderabad-1
IAD : us-ashburn-1
ICN : ap-seoul-1
JED : me-jeddah-1
KIX : ap-osaka-1
LHR : uk-london-1
@viralmodi
viralmodi / testOCIDotNetSdkConsoleApp.cs
Last active July 16, 2020 08:33
List Regions Example
private static async Task ListOciRegions()
{
// Accepts profile name and creates a auth provider based on config file
var authProvider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
// Create a client for the service to enable using its APIs
var client = new IdentityClient(authProvider);
// List regions
var listRegionsRequest = new ListRegionsRequest();
try
{
@viralmodi
viralmodi / consoleAppOutput
Created July 16, 2020 08:10
Output Of Console Application
source_dotnetsdk1.sCdm2sWV | source compartment | ocid1.compartment.oc1..
source_dotnetsdk2.MTCBvYR8 | source compartment | ocid1.compartment.oc1..
source_dotnetsdk3.JLfWRqsX | source compartment | ocid1.compartment.oc1..
source_dotnetsdk4.c4Dh9Bht | source compartment | ocid1.compartment.oc1..
target_dotnetsdk1.HDbFwat0 | target compartment | ocid1.compartment.oc1..
target_dotnetsdk2.90WbFnEJ | target compartment | ocid1.compartment.oc1..
target_dotnetsdk3.01JaKkYG | target compartment | ocid1.compartment.oc1..
target_dotnetsdk4.WaYvdMUj | target compartment | ocid1.compartment.oc1..
target_dotnetsdk5.tdmO3sbW | target compartment | ocid
@viralmodi
viralmodi / testOCIDotNetSdkConsoleApp.cs
Last active July 16, 2020 08:10
List Compartments Using Paginators
try
{
// Using Identity client paginator and its record enumerator to iterate through all compartments
var compartments = client.Paginators.ListCompartmentsRecordEnumerator(listCompartmentsRequest);
foreach (var compartment in compartments)
{
Console.WriteLine("{0, 30} | {1, 60} | {2, 60}",
compartment.Name,
compartment.Description,
compartment.Id);
@viralmodi
viralmodi / testOCIDotNetSdkConsoleApp.cs
Last active July 16, 2020 08:11
Create an OCI Identity Service Request
var listCompartmentsRequest = new ListCompartmentsRequest
{
CompartmentId = compartmentId
};
@viralmodi
viralmodi / testOCIDotNetSdkConsoleApp.cs
Last active July 16, 2020 08:11
Create Identity Client
var client = new IdentityClient(authProvider);
@viralmodi
viralmodi / testOCIDotNetSdkConsoleApp.cs
Last active July 16, 2020 08:12
Authentication Provider
var authProvider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
@viralmodi
viralmodi / testOCIDotNetSdkConsoleApp.cs
Last active July 16, 2020 08:12
Initialize Variables
private static String compartmentId = "ocid1.tenancy.oc1..";
@viralmodi
viralmodi / testOCIDotNetSdkConsoleApp.cs
Last active July 16, 2020 08:12
Types to use in our Namespace
using System;
using System.Threading.Tasks;
using Oci.Common.Auth;
using Oci.IdentityService;
using Oci.IdentityService.Requests;
using Oci.IdentityService.Responses;