public void ListGroupMembers()
        {
            // Snippet: ListGroupMembers(string,string,int?,CallSettings)
            // Create client
            GroupServiceClient groupServiceClient = GroupServiceClient.Create();
            // Initialize request argument(s)
            string formattedName = GroupServiceClient.FormatGroupName("[PROJECT]", "[GROUP]");
            // Make the request
            IPagedEnumerable <ListGroupMembersResponse, MonitoredResource> response =
                groupServiceClient.ListGroupMembers(formattedName);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (MonitoredResource item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over fixed-sized pages, lazily performing RPCs as required
            int pageSize = 10;

            foreach (FixedSizePage <MonitoredResource> page in response.AsPages().WithFixedSize(pageSize))
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (MonitoredResource item in page)
                {
                    Console.WriteLine(item);
                }
            }
            // End snippet
        }
 /// <summary>Snippet for UpdateGroup</summary>
 public void UpdateGroup()
 {
     // Snippet: UpdateGroup(Group,CallSettings)
     // Create client
     GroupServiceClient groupServiceClient = GroupServiceClient.Create();
     // Initialize request argument(s)
     Group group = new Group();
     // Make the request
     Group response = groupServiceClient.UpdateGroup(group);
     // End snippet
 }
 /// <summary>Snippet for GetGroup</summary>
 public void GetGroup()
 {
     // Snippet: GetGroup(GroupName,CallSettings)
     // Create client
     GroupServiceClient groupServiceClient = GroupServiceClient.Create();
     // Initialize request argument(s)
     GroupName name = new GroupName("[PROJECT]", "[GROUP]");
     // Make the request
     Group response = groupServiceClient.GetGroup(name);
     // End snippet
 }
 /// <summary>Snippet for CreateGroup</summary>
 public void CreateGroup()
 {
     // Snippet: CreateGroup(ProjectName,Group,CallSettings)
     // Create client
     GroupServiceClient groupServiceClient = GroupServiceClient.Create();
     // Initialize request argument(s)
     ProjectName name  = new ProjectName("[PROJECT]");
     Group       group = new Group();
     // Make the request
     Group response = groupServiceClient.CreateGroup(name, group);
     // End snippet
 }
        public void DeleteGroup()
        {
            // Snippet: DeleteGroup(string,CallSettings)
            // Create client
            GroupServiceClient groupServiceClient = GroupServiceClient.Create();
            // Initialize request argument(s)
            string formattedName = GroupServiceClient.FormatGroupName("[PROJECT]", "[GROUP]");

            // Make the request
            groupServiceClient.DeleteGroup(formattedName);
            // End snippet
        }
        public async Task UpdateGroupAsync()
        {
            // Snippet: UpdateGroupAsync(Group,CallSettings)
            // Additional: UpdateGroupAsync(Group,CancellationToken)
            // Create client
            GroupServiceClient groupServiceClient = GroupServiceClient.Create();
            // Initialize request argument(s)
            Group group = new Group();
            // Make the request
            Group response = await groupServiceClient.UpdateGroupAsync(group);

            // End snippet
        }
        public async Task GetGroupAsync()
        {
            // Snippet: GetGroupAsync(string,CallSettings)
            // Additional: GetGroupAsync(string,CancellationToken)
            // Create client
            GroupServiceClient groupServiceClient = GroupServiceClient.Create();
            // Initialize request argument(s)
            string formattedName = GroupServiceClient.FormatGroupName("[PROJECT]", "[GROUP]");
            // Make the request
            Group response = await groupServiceClient.GetGroupAsync(formattedName);

            // End snippet
        }
 /// <summary>Snippet for UpdateGroup</summary>
 public void UpdateGroup_RequestObject()
 {
     // Snippet: UpdateGroup(UpdateGroupRequest,CallSettings)
     // Create client
     GroupServiceClient groupServiceClient = GroupServiceClient.Create();
     // Initialize request argument(s)
     UpdateGroupRequest request = new UpdateGroupRequest
     {
         Group = new Group(),
     };
     // Make the request
     Group response = groupServiceClient.UpdateGroup(request);
     // End snippet
 }
 /// <summary>Snippet for GetGroup</summary>
 public void GetGroup_RequestObject()
 {
     // Snippet: GetGroup(GetGroupRequest,CallSettings)
     // Create client
     GroupServiceClient groupServiceClient = GroupServiceClient.Create();
     // Initialize request argument(s)
     GetGroupRequest request = new GetGroupRequest
     {
         GroupName = new GroupName("[PROJECT]", "[GROUP]"),
     };
     // Make the request
     Group response = groupServiceClient.GetGroup(request);
     // End snippet
 }
        public async Task CreateGroupAsync()
        {
            // Snippet: CreateGroupAsync(string,Group,CallSettings)
            // Additional: CreateGroupAsync(string,Group,CancellationToken)
            // Create client
            GroupServiceClient groupServiceClient = GroupServiceClient.Create();
            // Initialize request argument(s)
            string formattedName = GroupServiceClient.FormatProjectName("[PROJECT]");
            Group  group         = new Group();
            // Make the request
            Group response = await groupServiceClient.CreateGroupAsync(formattedName, group);

            // End snippet
        }
Exemplo n.º 11
0
        // [END monitoring_get_resource]

        public static object ListGroups(string projectId)
        {
            GroupServiceClient client      = GroupServiceClient.Create();
            ProjectName        projectName = new ProjectName(projectId);
            ListGroupsRequest  request     = new ListGroupsRequest {
                Name = projectName.ToString()
            };
            PagedEnumerable <ListGroupsResponse, Group> groups = client.ListGroups(request);

            foreach (Group group in groups.Take(10))
            {
                Console.WriteLine($"{group.Name}: {group.DisplayName}");
            }
            return(0);
        }
 /// <summary>Snippet for CreateGroup</summary>
 public void CreateGroup_RequestObject()
 {
     // Snippet: CreateGroup(CreateGroupRequest,CallSettings)
     // Create client
     GroupServiceClient groupServiceClient = GroupServiceClient.Create();
     // Initialize request argument(s)
     CreateGroupRequest request = new CreateGroupRequest
     {
         ProjectName = new ProjectName("[PROJECT]"),
         Group       = new Group(),
     };
     // Make the request
     Group response = groupServiceClient.CreateGroup(request);
     // End snippet
 }
Exemplo n.º 13
0
        public void ListGroups()
        {
            string projectId = _fixture.ProjectId;

            // Sample: ListGroups
            // Additional: ListGroups(*,*)
            GroupServiceClient client      = GroupServiceClient.Create();
            ProjectName        projectName = ProjectName.FromProject(projectId);
            PagedEnumerable <ListGroupsResponse, Group> groups = client.ListGroups(projectName);

            foreach (Group group in groups.Take(10))
            {
                Console.WriteLine($"{group.Name}: {group.DisplayName}");
            }
            // End sample
        }
        /// <summary>Snippet for ListGroupMembers</summary>
        public void ListGroupMembers_RequestObject()
        {
            // Snippet: ListGroupMembers(ListGroupMembersRequest,CallSettings)
            // Create client
            GroupServiceClient groupServiceClient = GroupServiceClient.Create();
            // Initialize request argument(s)
            ListGroupMembersRequest request = new ListGroupMembersRequest
            {
                GroupName = new GroupName("[PROJECT]", "[GROUP]"),
            };
            // Make the request
            PagedEnumerable <ListGroupMembersResponse, MonitoredResource> response =
                groupServiceClient.ListGroupMembers(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (MonitoredResource item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListGroupMembersResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (MonitoredResource item in page)
                {
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <MonitoredResource> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (MonitoredResource item in singlePage)
            {
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }