// This is an automatically generated code sample.
// To make this code sample work in your Oracle Cloud tenancy,
// please replace the values for any parameters whose current values do not fit
// your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
// boolean, number, and enum parameters with values not fitting your use case).
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.DatasafeService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Datasafe
{
public class ListUsersExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var listUsersRequest = new Oci.DatasafeService.Requests.ListUsersRequest
{
UserAssessmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-userAssessmentId-Value",
Limit = 171,
CompartmentIdInSubtree = false,
AccessLevel = Oci.DatasafeService.Requests.ListUsersRequest.AccessLevelEnum.Accessible,
UserCategory = "EXAMPLE-userCategory-Value",
UserRole = "EXAMPLE-userRole-Value",
UserProfile = "EXAMPLE-userProfile-Value",
UserType = "EXAMPLE-userType-Value",
UserKey = "EXAMPLE-userKey-Value",
AccountStatus = "EXAMPLE-accountStatus-Value",
AuthenticationType = "EXAMPLE-authenticationType-Value",
UserName = "EXAMPLE-userName-Value",
TargetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-targetId-Value",
TimeLastLoginGreaterThanOrEqualTo = DateTime.Parse("02/02/2007 23:31:53"),
TimeLastLoginLessThan = DateTime.Parse("01/07/2026 01:48:45"),
TimeUserCreatedGreaterThanOrEqualTo = DateTime.Parse("05/09/2010 09:23:31"),
TimeUserCreatedLessThan = DateTime.Parse("10/16/2017 19:26:05"),
TimePasswordLastChangedGreaterThanOrEqualTo = DateTime.Parse("06/05/2012 17:23:34"),
TimePasswordLastChangedLessThan = DateTime.Parse("04/17/2016 17:28:18"),
TimePasswordExpiryGreaterThanOrEqualTo = DateTime.Parse("09/11/2046 01:48:55"),
TimePasswordExpiryLessThan = DateTime.Parse("10/31/2012 04:32:03"),
Page = "EXAMPLE-page-Value",
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
SortOrder = Oci.DatasafeService.Requests.ListUsersRequest.SortOrderEnum.Asc,
SortBy = Oci.DatasafeService.Requests.ListUsersRequest.SortByEnum.TargetId,
OpcRequestId = "XX7PYUHNLEZVBZF68NUN<unique_ID>",
SchemaList = new List<string>
{
"EXAMPLE--Value"
},
AreAllSchemasAccessible = false
};
// Create a default authentication provider that uses the DEFAULT
// profile in the configuration file.
// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
try
{
// Create a service client and send the request.
using (var client = new DataSafeClient(provider, new ClientConfiguration()))
{
var response = await client.ListUsers(listUsersRequest);
// Retrieve value from the response.
var userSummaryValueCount = response.Items.Count;
}
}
catch (Exception e)
{
Console.WriteLine($"ListUsers Failed with {e.Message}");
throw e;
}
}
}
}