OCISDK/OCISDK/Identity/identityClient.cs
/// <summary>
/// Creates a new compartment in the specified compartment.
/// </summary>
/// <param name="createRequest"></param>
/// <returns></returns>
Creates a new compartment in the specified compartment.
Creates a new compartment in the specified compartment .
public CreateCompartmentResponse CreateCompartment(CreateCompartmentRequest createRequest)
        {
            var uri = new Uri(GetEndPoint(IdentityServices.Compartment, this.Region));
            using (var webResponse = this.RestClient.Post(uri, createRequest.CreateCompartmentDetails, new HttpRequestHeaderParam() { OpcRetryToken = createRequest.OpcRetryToken }))
            using (var stream = webResponse.GetResponseStream())
            using (var reader = new StreamReader(stream))
            {
                var response = reader.ReadToEnd();
                return new CreateCompartmentResponse()
                {
                    Compartment = JsonSerializer.Deserialize<Compartment>(response),
                    ETag = webResponse.Headers.Get("ETag"),
                    OpcRequestId = webResponse.Headers.Get("opc-request-id")
                };
            }
        }
public CreateCompartmentResponse CreateCompartment ( CreateCompartmentRequest createRequest ) { var uri = new Uri ( GetEndPoint ( IdentityServices . Compartment , this . Region ) ) ; using ( var webResponse = this . RestClient . Post ( uri , createRequest . CreateCompartmentDetails , new HttpRequestHeaderParam ( ) { OpcRetryToken = createRequest . OpcRetryToken } ) ) using ( var stream = webResponse . GetResponseStream ( ) ) using ( var reader = new StreamReader ( stream ) ) { var response = reader . ReadToEnd ( ) ; return new CreateCompartmentResponse ( ) { Compartment = JsonSerializer . Deserialize < Compartment > ( response ) , ETag = webResponse . Headers . Get ( " " ) , OpcRequestId = webResponse . Headers . Get ( " " ) } ; } }
Creates a new compartment in the specified compartment.
Creates a new compartment in the specified compartment .
None
createRequest
CreateCompartmentRequest
None