Ejemplo n.º 1
0
 /// <summary>Snippet for CreateClientEvent</summary>
 public void CreateClientEvent()
 {
     // Snippet: CreateClientEvent(string, ClientEvent, CallSettings)
     // Create client
     EventServiceClient eventServiceClient = EventServiceClient.Create();
     // Initialize request argument(s)
     string      parent      = "projects/[PROJECT]/tenants/[TENANT]";
     ClientEvent clientEvent = new ClientEvent();
     // Make the request
     ClientEvent response = eventServiceClient.CreateClientEvent(parent, clientEvent);
     // End snippet
 }
Ejemplo n.º 2
0
 /// <summary>Snippet for CreateClientEvent</summary>
 public void CreateClientEvent()
 {
     // Snippet: CreateClientEvent(TenantOrProjectNameOneof,ClientEvent,CallSettings)
     // Create client
     EventServiceClient eventServiceClient = EventServiceClient.Create();
     // Initialize request argument(s)
     TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]"));
     ClientEvent clientEvent         = new ClientEvent();
     // Make the request
     ClientEvent response = eventServiceClient.CreateClientEvent(parent, clientEvent);
     // End snippet
 }
 /// <summary>Snippet for CreateClientEvent</summary>
 public void CreateClientEvent()
 {
     // Snippet: CreateClientEvent(string,ClientEvent,CallSettings)
     // Create client
     EventServiceClient eventServiceClient = EventServiceClient.Create();
     // Initialize request argument(s)
     string      formattedParent = new ProjectName("[PROJECT]").ToString();
     ClientEvent clientEvent     = new ClientEvent();
     // Make the request
     ClientEvent response = eventServiceClient.CreateClientEvent(formattedParent, clientEvent);
     // End snippet
 }
 /// <summary>Snippet for CreateClientEvent</summary>
 public void CreateClientEventResourceNames1()
 {
     // Snippet: CreateClientEvent(TenantName, ClientEvent, CallSettings)
     // Create client
     EventServiceClient eventServiceClient = EventServiceClient.Create();
     // Initialize request argument(s)
     TenantName  parent      = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]");
     ClientEvent clientEvent = new ClientEvent();
     // Make the request
     ClientEvent response = eventServiceClient.CreateClientEvent(parent, clientEvent);
     // End snippet
 }
        // [START job_search_create_client_event]
        public static object CreateClientEvent(string projectId, string tenantId, string requestId, string eventId, IEnumerable <string> jobIds)
        {
            EventServiceClient eventServiceClient = EventServiceClient.Create();

            TenantName parent = new TenantName(projectId, tenantId);

            long      seconds    = 1L;
            Timestamp createTime = new Timestamp
            {
                Seconds = seconds
            };

            // The type of event attributed to the behavior of the end user.
            JobEventType type = JobEventType.View;

            // List of job names associated with this event.
            List <string> jobs = new List <string>();

            foreach (var jobId in jobIds)
            {
                //build full path of job IDs
                JobName name = new JobName(projectId, tenantId, jobId);
                jobs.Add(name.ToString());
            }

            JobEvent jobEvent = new JobEvent
            {
                Type = type
            };

            jobEvent.Jobs.Add(jobs);

            ClientEvent clientEvent = new ClientEvent
            {
                RequestId  = requestId,
                EventId    = eventId,
                CreateTime = createTime,
                JobEvent   = jobEvent
            };

            CreateClientEventRequest request = new CreateClientEventRequest
            {
                ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(parent),
                ClientEvent = clientEvent
            };

            ClientEvent response = eventServiceClient.CreateClientEvent(request);

            Console.WriteLine($"Created client event.");
            Console.WriteLine(response);

            return(0);
        }
 /// <summary>Snippet for CreateClientEvent</summary>
 public void CreateClientEvent_RequestObject()
 {
     // Snippet: CreateClientEvent(CreateClientEventRequest,CallSettings)
     // Create client
     EventServiceClient eventServiceClient = EventServiceClient.Create();
     // Initialize request argument(s)
     CreateClientEventRequest request = new CreateClientEventRequest
     {
         ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")),
         ClientEvent = new ClientEvent(),
     };
     // Make the request
     ClientEvent response = eventServiceClient.CreateClientEvent(request);
     // End snippet
 }
 /// <summary>Snippet for CreateClientEvent</summary>
 public void CreateClientEvent_RequestObject()
 {
     // Snippet: CreateClientEvent(CreateClientEventRequest,CallSettings)
     // Create client
     EventServiceClient eventServiceClient = EventServiceClient.Create();
     // Initialize request argument(s)
     CreateClientEventRequest request = new CreateClientEventRequest
     {
         Parent      = new ProjectName("[PROJECT]").ToString(),
         ClientEvent = new ClientEvent(),
     };
     // Make the request
     ClientEvent response = eventServiceClient.CreateClientEvent(request);
     // End snippet
 }