private static async Task <string> CreateCompartment(IdentityClient client, string compartmentId, string name) { CreateCompartmentDetails createCompartmentDetails = new CreateCompartmentDetails { CompartmentId = compartmentId, Name = name + "_dotnetSDK", Description = name + " compartment" }; CreateCompartmentRequest createCompartmentRequest = new CreateCompartmentRequest { CreateCompartmentDetails = createCompartmentDetails }; CreateCompartmentResponse createCompartmentResponse = await client.CreateCompartment(createCompartmentRequest); // wait for compartment to be accessible await Task.Delay(10000); logger.Info($"{name} compartment created, ID: {createCompartmentResponse.Compartment.Id} and state is {createCompartmentResponse.Compartment.LifecycleState}"); return(createCompartmentResponse.Compartment.Id); }
protected override void ProcessRecord() { base.ProcessRecord(); CreateCompartmentRequest request; try { request = new CreateCompartmentRequest { CreateCompartmentDetails = CreateCompartmentDetails, OpcRetryToken = OpcRetryToken }; response = client.CreateCompartment(request).GetAwaiter().GetResult(); WriteOutput(response, response.Compartment); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }