// 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 = 471,
CompartmentIdInSubtree = false,
AccessLevel = Oci.DatasafeService.Requests.ListUsersRequest.AccessLevelEnum.Restricted,
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("11/03/2012 19:14:41"),
TimeLastLoginLessThan = DateTime.Parse("02/11/2045 00:06:16"),
TimeUserCreatedGreaterThanOrEqualTo = DateTime.Parse("11/15/2029 13:34:16"),
TimeUserCreatedLessThan = DateTime.Parse("02/16/2034 10:18:54"),
TimePasswordLastChangedGreaterThanOrEqualTo = DateTime.Parse("12/10/2005 15:45:05"),
TimePasswordLastChangedLessThan = DateTime.Parse("06/10/2010 16:27:07"),
Page = "EXAMPLE-page-Value",
SortOrder = Oci.DatasafeService.Requests.ListUsersRequest.SortOrderEnum.Desc,
SortBy = Oci.DatasafeService.Requests.ListUsersRequest.SortByEnum.AuthenticationType,
OpcRequestId = "LS8B5EVOW7AE1ZYXMP5X<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;
}
}
}
}