private async Task AttachPolicyToCertificate(string policyName, string certificateArn) { var request = new AttachPolicyRequest() { PolicyName = policyName, Target = certificateArn }; var result = await _client.AttachPolicyAsync(request); }
/// <summary> /// Initializes the Organizations client object and then calls the /// AttachPolicyAsync method to attach the policy to the root /// organization. /// </summary> public static async Task Main() { IAmazonOrganizations client = new AmazonOrganizationsClient(); var policyId = "p-c0hsjgmq"; var targetId = "r-sso8"; var request = new AttachPolicyRequest { PolicyId = policyId, TargetId = targetId, }; var response = await client.AttachPolicyAsync(request); if (response.HttpStatusCode == System.Net.HttpStatusCode.OK) { Console.WriteLine($"Successfully attached Policy ID {policyId} to Target ID: {targetId}."); } else { Console.WriteLine("Was not successful in attaching the policy."); } }