OCISDK/OCISDK/Identity/identityClient.cs
/// <summary>
/// Creates a new policy in the specified compartment (either the tenancy or another of your compartments). 
/// If you're new to policies, see Getting Started with Policies.
/// You must specify a name for the policy, which must be unique across all policies in your tenancy and cannot be changed.
/// </summary>
/// <param name="createPolicyRequest"></param>
/// <returns></returns>
Creates a new policy in the specified compartment (either the tenancy or another of your compartments).
If you're new to policies, see Getting Started with Policies.
You must specify a name for the policy, which must be unique across all policies in your tenancy and cannot be changed.
Creates a new policy in the specified compartment ( either the tenancy or another of your compartments ) . If you ' re new to policies see Getting Started with Policies . You must specify a name for the policy which must be unique across all policies in your tenancy and cannot be changed .
public CreatePolicyResponse CreatePolicy(CreatePolicyRequest createPolicyRequest)
        {
            var uri = new Uri($"{GetEndPoint(IdentityServices.Policiy, this.Region)}/");
            using (var webResponse = this.RestClient.Post(uri, createPolicyRequest.CreatePolicyDetails, new HttpRequestHeaderParam() { OpcRetryToken = createPolicyRequest.OpcRetryToken }))
            using (var stream = webResponse.GetResponseStream())
            using (var reader = new StreamReader(stream))
            {
                var response = reader.ReadToEnd();
                return new CreatePolicyResponse()
                {
                    Policy = JsonSerializer.Deserialize<Policy>(response),
                    OpcRequestId = webResponse.Headers.Get("opc-request-id"),
                    ETag = webResponse.Headers.Get("etag")
                };
            }
        }
public CreatePolicyResponse CreatePolicy ( CreatePolicyRequest createPolicyRequest ) { var uri = new Uri ( $" { GetEndPoint ( IdentityServices . Policiy , this . Region ) } / " ) ; using ( var webResponse = this . RestClient . Post ( uri , createPolicyRequest . CreatePolicyDetails , new HttpRequestHeaderParam ( ) { OpcRetryToken = createPolicyRequest . OpcRetryToken } ) ) using ( var stream = webResponse . GetResponseStream ( ) ) using ( var reader = new StreamReader ( stream ) ) { var response = reader . ReadToEnd ( ) ; return new CreatePolicyResponse ( ) { Policy = JsonSerializer . Deserialize < Policy > ( response ) , OpcRequestId = webResponse . Headers . Get ( " " ) , ETag = webResponse . Headers . Get ( " " ) } ; } }
Creates a new policy in the specified compartment (either the tenancy or another of your compartments).
Creates a new policy in the specified compartment ( either the tenancy or another of your compartments ) .
None
createPolicyRequest
CreatePolicyRequest
None