Skip to content

Instantly share code, notes, and snippets.

Avatar

Viral Modi viralmodi

  • Oracle
View GitHub Profile
@viralmodi
viralmodi / Program.cs
Created Aug 25, 2020
Pushing a web image to Oracle Cloud Object Storage service
View Program.cs
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 Jul 16, 2020
Output of ListRegions
View consoleAppOutput
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
View testOCIDotNetSdkConsoleApp.cs
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 Jul 16, 2020
Output Of Console Application
View consoleAppOutput
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 Jul 16, 2020
List Compartments Using Paginators
View testOCIDotNetSdkConsoleApp.cs
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 Jul 16, 2020
Create an OCI Identity Service Request
View testOCIDotNetSdkConsoleApp.cs
var listCompartmentsRequest = new ListCompartmentsRequest
{
CompartmentId = compartmentId
};
View testOCIDotNetSdkConsoleApp.cs
var client = new IdentityClient(authProvider);
View testOCIDotNetSdkConsoleApp.cs
var authProvider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
View testOCIDotNetSdkConsoleApp.cs
private static String compartmentId = "ocid1.tenancy.oc1..";
@viralmodi
viralmodi / testOCIDotNetSdkConsoleApp.cs
Last active Jul 16, 2020
Types to use in our Namespace
View testOCIDotNetSdkConsoleApp.cs
using System;
using System.Threading.Tasks;
using Oci.Common.Auth;
using Oci.IdentityService;
using Oci.IdentityService.Requests;
using Oci.IdentityService.Responses;