示例#1
0
        /// <summary>
        /// Get a list of indexes on a table.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ListIndexesResponse ListIndexes(ListIndexesRequest request)
        {
            var uriStr   = $"{GetEndPoint(NoSQLServices.Tables, this.Region)}/{request.TableNameOrId}";
            var optional = request.GetOptionalQuery();

            if (!string.IsNullOrEmpty(optional))
            {
                uriStr = $"{uriStr}?{optional}";
            }

            var uri = new Uri(uriStr);

            var httpRequestHeaderParam = new HttpRequestHeaderParam()
            {
                OpcRequestId = request.OpcRequestId
            };

            using (var webResponse = this.RestClient.Get(uri, httpRequestHeaderParam))
                using (var stream = webResponse.GetResponseStream())
                    using (var reader = new StreamReader(stream))
                    {
                        var response = reader.ReadToEnd();

                        return(new ListIndexesResponse()
                        {
                            IndexCollection = this.JsonSerializer.Deserialize <IndexCollection>(response),
                            OpcRequestId = webResponse.Headers.Get("opc-request-id"),
                            OpcNextPage = webResponse.Headers.Get("opc-next-page")
                        });
                    }
        }
示例#2
0
    public IEnumerable <Google.Cloud.Datastore.Admin.V1.Index> ListIndexes(string projectId = "your-project-id")
    {
        // Create client
        DatastoreAdminClient datastoreAdminClient = DatastoreAdminClient.Create();

        // Initialize request argument(s)
        ListIndexesRequest listIndexesRequest = new ListIndexesRequest
        {
            ProjectId = projectId
        };

        var response = datastoreAdminClient.ListIndexes(listIndexesRequest);

        foreach (var index in response)
        {
            Console.WriteLine($"Index Id: {index.IndexId}");
            Console.WriteLine($"Kind: {index.Kind}");

            Console.WriteLine("Properties:");
            foreach (var property in index.Properties)
            {
                Console.WriteLine($"Property: {property.Name}");
                Console.WriteLine($"Direction: {property.Direction}");
            }
        }

        return(response);
    }
示例#3
0
 /// <summary>
 /// Lists the indexes that match the specified filters.
 /// </summary>
 /// <param name="request">
 /// The request object containing all of the parameters for the API call.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// A pageable sequence of <see cref="Index"/> resources.
 /// </returns>
 public override PagedEnumerable <ListIndexesResponse, Index> ListIndexes(
     ListIndexesRequest request,
     CallSettings callSettings = null)
 {
     Modify_ListIndexesRequest(ref request, ref callSettings);
     return(new GrpcPagedEnumerable <ListIndexesRequest, ListIndexesResponse, Index>(_callListIndexes, request, callSettings));
 }
示例#4
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListIndexesRequest request;

            try
            {
                request = new ListIndexesRequest
                {
                    TableNameOrId  = TableNameOrId,
                    CompartmentId  = CompartmentId,
                    Name           = Name,
                    LifecycleState = LifecycleState,
                    Limit          = Limit,
                    Page           = Page,
                    SortOrder      = SortOrder,
                    SortBy         = SortBy,
                    OpcRequestId   = OpcRequestId
                };
                IEnumerable <ListIndexesResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.IndexCollection, true);
                }
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
示例#5
0
        /// <summary>Snippet for ListIndexesAsync</summary>
        public async Task ListIndexesRequestObjectAsync()
        {
            // Snippet: ListIndexesAsync(ListIndexesRequest, CallSettings)
            // Create client
            IndexServiceClient indexServiceClient = await IndexServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListIndexesRequest request = new ListIndexesRequest
            {
                ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                Filter   = "",
                ReadMask = new FieldMask(),
            };
            // Make the request
            PagedAsyncEnumerable <ListIndexesResponse, gcav::Index> response = indexServiceClient.ListIndexesAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((gcav::Index item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListIndexesResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (gcav::Index item in page)
                {
                    // Do something with each item
                    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 <gcav::Index> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (gcav::Index item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
示例#6
0
 /// <summary>
 /// Creates a new enumerable which will iterate over the responses received from the ListIndexes operation. This enumerable
 /// will fetch more data from the server as needed.
 /// </summary>
 /// <param name="request">The request object containing the details to send</param>
 /// <param name="retryConfiguration">The configuration for retrying, may be null</param>
 /// <param name="cancellationToken">The cancellation token object</param>
 /// <returns>The enumerator, which supports a simple iteration over a collection of a specified type</returns>
 public IEnumerable <ListIndexesResponse> ListIndexesResponseEnumerator(ListIndexesRequest request, Common.Retry.RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
 {
     return(new Common.Utils.ResponseEnumerable <ListIndexesRequest, ListIndexesResponse>(
                response => response.OpcNextPage,
                input =>
     {
         if (!string.IsNullOrEmpty(input))
         {
             request.Page = input;
         }
         return request;
     },
                request => client.ListIndexes(request, retryConfiguration, cancellationToken)
                ));
 }
        /// <summary>Snippet for ListIndexes</summary>
        public void ListIndexesRequestObject()
        {
            // Snippet: ListIndexes(ListIndexesRequest, CallSettings)
            // Create client
            DatastoreAdminClient datastoreAdminClient = DatastoreAdminClient.Create();
            // Initialize request argument(s)
            ListIndexesRequest request = new ListIndexesRequest
            {
                ProjectId = "",
                Filter    = "",
            };
            // Make the request
            PagedEnumerable <ListIndexesResponse, gcdav::Index> response = datastoreAdminClient.ListIndexes(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (gcdav::Index 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 (ListIndexesResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (gcdav::Index item in page)
                {
                    // Do something with each item
                    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 <gcdav::Index> 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 (gcdav::Index item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
        /// <summary>Snippet for ListIndexesAsync</summary>
        public async Task ListIndexesAsync_RequestObject()
        {
            // Snippet: ListIndexesAsync(ListIndexesRequest,CallSettings)
            // Create client
            FirestoreAdminClient firestoreAdminClient = await FirestoreAdminClient.CreateAsync();

            // Initialize request argument(s)
            ListIndexesRequest request = new ListIndexesRequest
            {
                ParentAsParentName = new ParentName("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]"),
            };
            // Make the request
            PagedAsyncEnumerable <ListIndexesResponse, Index> response =
                firestoreAdminClient.ListIndexesAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Index item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListIndexesResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Index 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 <Index> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Index item in singlePage)
            {
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
示例#9
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListIndexesRequest request;

            try
            {
                request = new ListIndexesRequest
                {
                    TableNameOrId  = TableNameOrId,
                    CompartmentId  = CompartmentId,
                    Name           = Name,
                    LifecycleState = LifecycleState,
                    Limit          = Limit,
                    Page           = Page,
                    SortOrder      = SortOrder,
                    SortBy         = SortBy,
                    OpcRequestId   = OpcRequestId
                };
                IEnumerable <ListIndexesResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.IndexCollection, true);
                }
                if (!ParameterSetName.Equals(AllPageSet) && !ParameterSetName.Equals(LimitSet) && response.OpcNextPage != null)
                {
                    WriteWarning("This operation supports pagination and not all resources were returned. Re-run using the -All option to auto paginate and list all resources.");
                }
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
示例#10
0
        public void ListIndexes()
        {
            var listIndexesRequest = new ListIndexesRequest();

            listIndexesRequest.Parent = Parent;
            ListIndexesResponse listIndexesResponse = new ListIndexesResponse();

            try
            {
                listIndexesResponse = FsAdminClient.ListIndexes(listIndexesRequest);
            }
            catch (Exception e)
            {
                FirestoreTestUtils.ColoredConsoleWrite(ConsoleColor.Red, "Exception caught\n" + e.Message);
            }
            var indexes = listIndexesResponse.Indexes;
            var i       = 0;

            foreach (var index in indexes)
            {
                i++;
                FirestoreTestUtils.ColoredConsoleWrite(ConsoleColor.White, "\nIndex " + i + ": " + index.Name);
            }
        }
示例#11
0
 partial void Modify_ListIndexesRequest(ref ListIndexesRequest request, ref CallSettings settings);
示例#12
0
 /// <summary>
 /// Lists the indexes that match the specified filters.
 /// </summary>
 /// <param name="request">
 /// The request object containing all of the parameters for the API call.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// A pageable sequence of <see cref="Index"/> resources.
 /// </returns>
 public virtual PagedEnumerable <ListIndexesResponse, Index> ListIndexes(
     ListIndexesRequest request,
     CallSettings callSettings = null)
 {
     throw new NotImplementedException();
 }