public static int Main(string[] args) { // Read projectId from args if (args.Length != 1) { Console.WriteLine("Usage: Project ID must be passed as first argument."); Console.WriteLine(); return(1); } string projectId = args[0]; // Create client AssetServiceClient client = AssetServiceClient.Create(); // Initialize request argument(s) var request = new BatchGetAssetsHistoryRequest { ParentAsProjectName = new ProjectName(projectId), ContentType = ContentType.Resource, ReadTimeWindow = new TimeWindow { StartTime = DateTime.UtcNow.AddDays(-1).ToTimestamp() }, }; // Call API method client.BatchGetAssetsHistory(request); // Success Console.WriteLine("Smoke test passed OK"); return(0); }
/// <summary>Snippet for BatchGetAssetsHistory</summary> public void BatchGetAssetsHistory() { // Snippet: BatchGetAssetsHistory(string,CallSettings) // Create client AssetServiceClient assetServiceClient = AssetServiceClient.Create(); // Initialize request argument(s) string formattedParent = new Google.Api.Gax.ResourceNames.ProjectName("[PROJECT]").ToString(); // Make the request BatchGetAssetsHistoryResponse response = assetServiceClient.BatchGetAssetsHistory(formattedParent); // End snippet }
/// <summary>Snippet for BatchGetAssetsHistory</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void BatchGetAssetsHistoryRequestObject() { // Create client AssetServiceClient assetServiceClient = AssetServiceClient.Create(); // Initialize request argument(s) BatchGetAssetsHistoryRequest request = new BatchGetAssetsHistoryRequest { ParentAsResourceName = new UnparsedResourceName("a/wildcard/resource"), AssetNames = { "", }, ContentType = ContentType.Unspecified, ReadTimeWindow = new TimeWindow(), }; // Make the request BatchGetAssetsHistoryResponse response = assetServiceClient.BatchGetAssetsHistory(request); }
/// <summary>Snippet for BatchGetAssetsHistory</summary> public void BatchGetAssetsHistory_RequestObject() { // Snippet: BatchGetAssetsHistory(BatchGetAssetsHistoryRequest,CallSettings) // Create client AssetServiceClient assetServiceClient = AssetServiceClient.Create(); // Initialize request argument(s) BatchGetAssetsHistoryRequest request = new BatchGetAssetsHistoryRequest { ParentAsProjectName = new ProjectName("[PROJECT]"), ContentType = ContentType.Unspecified, ReadTimeWindow = new TimeWindow(), }; // Make the request BatchGetAssetsHistoryResponse response = assetServiceClient.BatchGetAssetsHistory(request); // End snippet }
public static void Main(string[] args) { // Asset names, e.g.: //storage.googleapis.com/[YOUR_BUCKET_NAME] string[] assetNames = { "ASSET-NAME" }; string projectId = "YOUR-GOOGLE-PROJECT-ID"; BatchGetAssetsHistoryRequest request = new BatchGetAssetsHistoryRequest { ParentAsProjectName = new ProjectName(projectId), ContentType = ContentType.Resource, ReadTimeWindow = new TimeWindow { StartTime = Timestamp.FromDateTime(System.DateTime.UtcNow) } }; request.AssetNames.AddRange(assetNames); AssetServiceClient client = AssetServiceClient.Create(); BatchGetAssetsHistoryResponse response = client.BatchGetAssetsHistory(request); Console.WriteLine(response); }
public BatchGetAssetsHistoryResponse BatchGetAssetsHistory(string[] assetNames, string projectId) { // Create the client. AssetServiceClient client = AssetServiceClient.Create(); // Build the request. BatchGetAssetsHistoryRequest request = new BatchGetAssetsHistoryRequest { ParentAsResourceName = ProjectName.FromProject(projectId), ContentType = ContentType.Resource, ReadTimeWindow = new TimeWindow { StartTime = Timestamp.FromDateTime(DateTime.UtcNow) } }; request.AssetNames.AddRange(assetNames); // Call the API. BatchGetAssetsHistoryResponse response = client.BatchGetAssetsHistory(request); // Return the result. return(response); }