コード例 #1
0
        protected override void ColumnDefinition(
            string schema,
            string table,
            string name,
            System.Type clrType,
            string type,
            bool?unicode,
            int?maxLength,
            bool rowVersion,
            bool nullable,
            object defaultValue,
            string defaultValueSql,
            string computedColumnSql,
            IAnnotatable annotatable,
            IModel model,
            MigrationCommandListBuilder builder)
        {
            GaxPreconditions.CheckNotNullOrEmpty(name, nameof(name));
            GaxPreconditions.CheckNotNull(clrType, nameof(clrType));
            GaxPreconditions.CheckNotNull(annotatable, nameof(annotatable));
            GaxPreconditions.CheckNotNull(builder, nameof(builder));

            builder
            .Append(Dependencies.SqlGenerationHelper.DelimitIdentifier(name))
            .Append(" ")
            .Append(GetCorrectedColumnType(
                        type ?? GetColumnType(schema, table, name, clrType, unicode, maxLength, rowVersion, model)));

            if (!nullable)
            {
                builder.Append(" NOT NULL");
            }
        }
 /// <inheritdoc />
 public override void DelimitIdentifier(StringBuilder builder, string identifier)
 {
     GaxPreconditions.CheckNotNullOrEmpty(identifier, nameof(identifier));
     builder.Append('`');
     EscapeIdentifier(builder, identifier);
     builder.Append('`');
 }
コード例 #3
0
        public void CheckNotNull_Empty()
        {
            string x         = "";
            var    exception = Assert.Throws <ArgumentException>(() => GaxPreconditions.CheckNotNullOrEmpty(x, nameof(x)));

            Assert.Equal(nameof(x), exception.ParamName);
        }
 /// <summary>
 /// Uses middleware that will report all uncaught exceptions to the Stackdriver
 /// Error Reporting API.
 /// </summary>
 /// <param name="app">The application builder. Cannot be null.</param>
 /// <param name="projectId">The Google Cloud Platform project ID. Cannot be null.</param>
 /// <param name="serviceName">An identifier of the service, such as the name of the
 ///     executable or job. Cannot be null.</param>
 /// <param name="version">Represents the source code version that the developer
 ///     provided. Cannot be null.</param>
 /// <param name="options">Error reporting options for exception logging.</param>
 public static void UseGoogleExceptionLogging(
     this IApplicationBuilder app, string projectId, string serviceName, string version,
     ErrorReportingOptions options = null)
 {
     GaxPreconditions.CheckNotNullOrEmpty(projectId, nameof(projectId));
     UseGoogleExceptionLoggingBase(app, projectId, serviceName, version, options);
 }
コード例 #5
0
 /// <summary>
 /// Adds services for middleware that will report all uncaught exceptions to the
 /// Stackdriver Error Reporting API.
 /// </summary>
 /// <param name="services">The service collection. Cannot be null.</param>
 /// <param name="projectId">The Google Cloud Platform project ID. Cannot be null.</param>
 /// <param name="serviceName">An identifier of the service, such as the name of the
 ///     executable or job. Cannot be null.</param>
 /// <param name="version">Represents the source code version that the developer
 ///     provided. Cannot be null.</param>
 /// <param name="options">Error reporting options for exception logging.</param>
 public static void AddGoogleExceptionLogging(
     this IServiceCollection services, string projectId, string serviceName, string version,
     ErrorReportingOptions options = null)
 {
     GaxPreconditions.CheckNotNullOrEmpty(projectId, nameof(projectId));
     AddGoogleExceptionLoggingBase(services, projectId, serviceName, version, options);
 }
        /// <summary>
        /// Configures a <see cref="DbContextOptionsBuilder"/> for use with Cloud Spanner.
        /// </summary>
        /// <param name="optionsBuilder">The DbContextOptionsBuilder to configure for use with Cloud Spanner</param>
        /// <param name="connectionString">The connection string to use to connect to Cloud Spanner in the format `Data Source=projects/{project}/instances/{instance}/databases/{database};[Host={hostname};][Port={portnumber}]`</param>
        /// <param name="spannerOptionsAction">Any actions that should be executed as part of configuring the options builder for Cloud Spanner</param>
        /// <param name="channelCredentials">An optional credential for operations to be performed on the Spanner database.</param>
        /// <returns>The optionsBuilder for chaining</returns>
        public static DbContextOptionsBuilder UseSpanner(
            this DbContextOptionsBuilder optionsBuilder,
            string connectionString,
            Action <SpannerDbContextOptionsBuilder> spannerOptionsAction = null,
            ChannelCredentials channelCredentials = null)
        {
            GaxPreconditions.CheckNotNull(optionsBuilder, nameof(optionsBuilder));
            GaxPreconditions.CheckNotNullOrEmpty(connectionString, nameof(connectionString));

            SpannerModelValidationConnectionProvider.Instance.SetConnectionString(connectionString, channelCredentials);
            var extension = GetOrCreateExtension(optionsBuilder);

            if (channelCredentials == null)
            {
                extension = (SpannerOptionsExtension)extension.WithConnectionString(connectionString);
            }
            else
            {
                // The Cloud Spanner client library does not support adding any credentials to the connection string, so in that case we need
                // to create a connection here already in order to be able to use the credentials.
                extension = (SpannerOptionsExtension)extension.WithConnection(new SpannerRetriableConnection(new SpannerConnection(connectionString, channelCredentials)));
            }
            ((IDbContextOptionsBuilderInfrastructure)optionsBuilder).AddOrUpdateExtension(extension);

            ConfigureWarnings(optionsBuilder);
            spannerOptionsAction?.Invoke(new SpannerDbContextOptionsBuilder(optionsBuilder));

            return(optionsBuilder);
        }
コード例 #7
0
        /// <summary>
        /// Gets a <see cref="IConsumer{ReportedErrorEvent}"/>.
        /// </summary>
        /// <param name="projectId">The Google Cloud Platform project ID. Cannot be null.</param>
        internal IConsumer <ReportedErrorEvent> CreateConsumer(string projectId)
        {
            GaxPreconditions.CheckNotNullOrEmpty(projectId, nameof(projectId));

            IConsumer <ReportedErrorEvent> consumer;

            switch (EventTarget.Kind)
            {
            case EventTargetKind.Logging:
                consumer = new ErrorEventToLogEntryConsumer(EventTarget.LogName, EventTarget.LogTarget,
                                                            new GrpcLogConsumer(EventTarget.LoggingClient), EventTarget.MonitoredResource);
                break;

            case EventTargetKind.ErrorReporting:
                consumer = new GrpcErrorEventConsumer(
                    EventTarget.ErrorReportingClient, projectId);
                break;

            default:
                Debug.Fail($"Unsupported location {EventTarget.Kind}");
                return(null);
            }

            return(ConsumerFactory <ReportedErrorEvent> .GetConsumer(
                       consumer, MessageSizer <ReportedErrorEvent> .GetSize, BufferOptions));
        }
コード例 #8
0
 /// <summary>
 /// Deletes an index.
 /// </summary>
 /// <param name="name">
 /// The index name. For example:
 /// `projects/{project_id}/databases/{database_id}/indexes/{index_id}`
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// The RPC response.
 /// </returns>
 public virtual void DeleteIndex(
     string name,
     CallSettings callSettings = null) => DeleteIndex(
     new DeleteIndexRequest
 {
     Name = GaxPreconditions.CheckNotNullOrEmpty(name, nameof(name)),
 },
     callSettings);
コード例 #9
0
 /// <summary>
 /// Gets an index.
 /// </summary>
 /// <param name="name">
 /// The name of the index. For example:
 /// `projects/{project_id}/databases/{database_id}/indexes/{index_id}`
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// A Task containing the RPC response.
 /// </returns>
 public virtual Task <Index> GetIndexAsync(
     string name,
     CallSettings callSettings = null) => GetIndexAsync(
     new GetIndexRequest
 {
     Name = GaxPreconditions.CheckNotNullOrEmpty(name, nameof(name)),
 },
     callSettings);
 /// <summary>
 /// Creates a new instance of the <see cref="ErrorEventToLogEntryConsumer"/>.
 /// </summary>
 /// <param name="logName">The name of the log.  Not the fully qualified name. Cannot be null.</param>
 /// <param name="logTarget">Where to log, such as a project or organization. Cannot be null.</param>
 /// <param name="logConsumer">The log consumer. Cannot be null.</param>
 /// <param name="monitoredResource">The resource that is being monitored. Cannot be null.</param>
 internal ErrorEventToLogEntryConsumer(string logName, LogTarget logTarget,
                                       IConsumer <LogEntry> logConsumer, MonitoredResource monitoredResource)
 {
     GaxPreconditions.CheckNotNullOrEmpty(logName, nameof(logName));
     _logName           = GaxPreconditions.CheckNotNull(logTarget, nameof(logTarget)).GetFullLogName(logName);
     _logConsumer       = GaxPreconditions.CheckNotNull(logConsumer, nameof(logConsumer));
     _monitoredResource = GaxPreconditions.CheckNotNull(monitoredResource, nameof(monitoredResource));
 }
コード例 #11
0
        /// <summary>
        /// Creates an instance of <see cref="GoogleExceptionLogger"/>.
        /// </summary>
        /// <param name="projectId">The Google Cloud Platform project ID. Must not be null.</param>
        /// <param name="serviceName">An identifier of the service, such as the name of the executable or job.
        ///     Must not be null.</param>
        /// <param name="version">Represents the source code version that the developer provided.
        ///     Must not be null.</param>
        /// <param name="options">Optional, error reporting options.</param>
        public static GoogleExceptionLogger Create(string projectId, string serviceName, string version,
                                                   ErrorReportingOptions options = null)
        {
            GaxPreconditions.CheckNotNullOrEmpty(projectId, nameof(projectId));
            var contextLogger = ContextExceptionLogger.Create(projectId, serviceName, version, options);

            return(new GoogleExceptionLogger(contextLogger));
        }
コード例 #12
0
 /// <summary>
 /// Returns the list of all active breakpoints for the debuggee.
 ///
 /// The breakpoint specification (`location`, `condition`, and `expressions`
 /// fields) is semantically immutable, although the field values may
 /// change. For example, an agent may update the location line number
 /// to reflect the actual line where the breakpoint was set, but this
 /// doesn't change the breakpoint semantics.
 ///
 /// This means that an agent does not need to check if a breakpoint has changed
 /// when it encounters the same breakpoint on a successive call.
 /// Moreover, an agent should remember the breakpoints that are completed
 /// until the controller removes them from the active list to avoid
 /// setting those breakpoints again.
 /// </summary>
 /// <param name="debuggeeId">
 /// Identifies the debuggee.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// The RPC response.
 /// </returns>
 public virtual ListActiveBreakpointsResponse ListActiveBreakpoints(
     string debuggeeId,
     CallSettings callSettings = null) => ListActiveBreakpoints(
     new ListActiveBreakpointsRequest
 {
     DebuggeeId = GaxPreconditions.CheckNotNullOrEmpty(debuggeeId, nameof(debuggeeId)),
 },
     callSettings);
        /// <inheritdoc />
        public override void EscapeIdentifier(StringBuilder builder, string identifier)
        {
            GaxPreconditions.CheckNotNullOrEmpty(identifier, nameof(identifier));
            var initialLength = builder.Length;

            builder.Append(identifier);
            builder.Replace("`", "\\`", initialLength, identifier.Length);
        }
コード例 #14
0
 private static string ValidateTableName(string table, string parameterName)
 {
     GaxPreconditions.CheckNotNullOrEmpty(table, parameterName);
     if (!table.All(c => char.IsLetterOrDigit(c) || c == '_'))
     {
         throw new ArgumentException($"Table names must consist of letters, numbers or underscores", parameterName);
     }
     return(table);
 }
コード例 #15
0
        /// <summary>
        /// Creates a new path from this one, with the specified segment appended.
        /// </summary>
        /// <param name="segment">The segment to append. Must not be null or empty.</param>
        internal FieldPath Append(string segment)
        {
            GaxPreconditions.CheckNotNullOrEmpty(segment, nameof(segment));
            var newFields = new string[Segments.Length + 1];

            Array.Copy(Segments, newFields, Segments.Length);
            newFields[Segments.Length] = segment;
            return(new FieldPath(newFields, true));
        }
コード例 #16
0
 /// <summary>
 /// Gets a single trace by its ID.
 /// </summary>
 /// <param name="projectId">
 /// ID of the Cloud project where the trace data is stored.
 /// </param>
 /// <param name="traceId">
 /// ID of the trace to return.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// The RPC response.
 /// </returns>
 public virtual Trace GetTrace(
     string projectId,
     string traceId,
     CallSettings callSettings = null) => GetTrace(
     new GetTraceRequest
 {
     ProjectId = GaxPreconditions.CheckNotNullOrEmpty(projectId, nameof(projectId)),
     TraceId   = GaxPreconditions.CheckNotNullOrEmpty(traceId, nameof(traceId)),
 },
     callSettings);
コード例 #17
0
 /// <summary>
 /// Sends new traces to Stackdriver Trace or updates existing traces. If the ID
 /// of a trace that you send matches that of an existing trace, any fields
 /// in the existing trace and its spans are overwritten by the provided values,
 /// and any new fields provided are merged with the existing trace data. If the
 /// ID does not match, a new trace is created.
 /// </summary>
 /// <param name="projectId">
 /// ID of the Cloud project where the trace data is stored.
 /// </param>
 /// <param name="traces">
 /// The body of the message.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// The RPC response.
 /// </returns>
 public virtual void PatchTraces(
     string projectId,
     Traces traces,
     CallSettings callSettings = null) => PatchTraces(
     new PatchTracesRequest
 {
     ProjectId = GaxPreconditions.CheckNotNullOrEmpty(projectId, nameof(projectId)),
     Traces    = GaxPreconditions.CheckNotNull(traces, nameof(traces)),
 },
     callSettings);
コード例 #18
0
 /// <summary>
 /// Creates the specified index.
 /// A newly created index's initial state is `CREATING`. On completion of the
 /// returned [google.longrunning.Operation][google.longrunning.Operation], the state will be `READY`.
 /// If the index already exists, the call will return an `ALREADY_EXISTS`
 /// status.
 ///
 /// During creation, the process could result in an error, in which case the
 /// index will move to the `ERROR` state. The process can be recovered by
 /// fixing the data that caused the error, removing the index with
 /// [delete][google.firestore.admin.v1beta1.FirestoreAdmin.DeleteIndex], then re-creating the index with
 /// [create][google.firestore.admin.v1beta1.FirestoreAdmin.CreateIndex].
 ///
 /// Indexes with a single field cannot be created.
 /// </summary>
 /// <param name="parent">
 /// The name of the database this index will apply to. For example:
 /// `projects/{project_id}/databases/{database_id}`
 /// </param>
 /// <param name="index">
 /// The index to create. The name and state should not be specified.
 /// Certain single field indexes cannot be created or deleted.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// The RPC response.
 /// </returns>
 public virtual Operation CreateIndex(
     string parent,
     Index index,
     CallSettings callSettings = null) => CreateIndex(
     new CreateIndexRequest
 {
     Parent = GaxPreconditions.CheckNotNullOrEmpty(parent, nameof(parent)),
     Index  = GaxPreconditions.CheckNotNull(index, nameof(index)),
 },
     callSettings);
コード例 #19
0
 /// <summary>
 /// Updates the breakpoint state or mutable fields.
 /// The entire Breakpoint message must be sent back to the controller service.
 ///
 /// Updates to active breakpoint fields are only allowed if the new value
 /// does not change the breakpoint specification. Updates to the `location`,
 /// `condition` and `expressions` fields should not alter the breakpoint
 /// semantics. These may only make changes such as canonicalizing a value
 /// or snapping the location to the correct line of code.
 /// </summary>
 /// <param name="debuggeeId">
 /// Identifies the debuggee being debugged.
 /// </param>
 /// <param name="breakpoint">
 /// Updated breakpoint information.
 /// The field `id` must be set.
 /// The agent must echo all Breakpoint specification fields in the update.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// The RPC response.
 /// </returns>
 public virtual UpdateActiveBreakpointResponse UpdateActiveBreakpoint(
     string debuggeeId,
     Breakpoint breakpoint,
     CallSettings callSettings = null) => UpdateActiveBreakpoint(
     new UpdateActiveBreakpointRequest
 {
     DebuggeeId = GaxPreconditions.CheckNotNullOrEmpty(debuggeeId, nameof(debuggeeId)),
     Breakpoint = GaxPreconditions.CheckNotNull(breakpoint, nameof(breakpoint)),
 },
     callSettings);
コード例 #20
0
 /// <summary>
 /// Create a new <see cref="NamedPipeServer"/>.
 /// </summary>
 /// <param name="pipeName">The name of the pipe.</param>
 public NamedPipeServer(string pipeName)
 {
     _server = new NamedPipeServerStream(
         pipeName: GaxPreconditions.CheckNotNullOrEmpty(pipeName, nameof(pipeName)),
         direction: PipeDirection.InOut,
         maxNumberOfServerInstances: NamedPipeServerStream.MaxAllowedServerInstances,
         transmissionMode: PipeTransmissionMode.Byte,
         options: PipeOptions.Asynchronous);
     _pipe = new NamedPipe(_server);
 }
コード例 #21
0
 /// <summary>
 /// Performs asynchronous video annotation. Progress and results can be
 /// retrieved through the `google.longrunning.Operations` interface.
 /// `Operation.metadata` contains `AnnotateVideoProgress` (progress).
 /// `Operation.response` contains `AnnotateVideoResponse` (results).
 /// </summary>
 /// <param name="inputUri">
 /// Input video location. Currently, only
 /// [Google Cloud Storage](https://cloud.google.com/storage/) URIs are
 /// supported, which must be specified in the following format:
 /// `gs://bucket-id/object-id` (other URI formats return
 /// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see
 /// [Request URIs](/storage/docs/reference-uris).
 /// A video URI may include wildcards in `object-id`, and thus identify
 /// multiple videos. Supported wildcards: '*' to match 0 or more characters;
 /// '?' to match 1 character. If unset, the input video should be embedded
 /// in the request as `input_content`. If set, `input_content` should be unset.
 /// </param>
 /// <param name="features">
 /// Requested video annotation features.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// The RPC response.
 /// </returns>
 public virtual Operation <AnnotateVideoResponse, AnnotateVideoProgress> AnnotateVideo(
     string inputUri,
     IEnumerable <Feature> features,
     CallSettings callSettings = null) => AnnotateVideo(
     new AnnotateVideoRequest
 {
     InputUri = GaxPreconditions.CheckNotNullOrEmpty(inputUri, nameof(inputUri)),
     Features = { GaxPreconditions.CheckNotNull(features, nameof(features)) },
 },
     callSettings);
コード例 #22
0
 internal GoogleLogger(IConsumer <LogEntry> consumer, LogTarget logTarget, LoggerOptions loggerOptions,
                       string logName, IClock clock = null)
 {
     GaxPreconditions.CheckNotNull(logTarget, nameof(logTarget));
     GaxPreconditions.CheckNotNullOrEmpty(logName, nameof(logName));
     _consumer      = GaxPreconditions.CheckNotNull(consumer, nameof(consumer));
     _loggerOptions = GaxPreconditions.CheckNotNull(loggerOptions, nameof(loggerOptions));;
     _logName       = logTarget.GetFullLogName(logName);
     _clock         = clock ?? SystemClock.Instance;
 }
        /// <summary>
        /// Creates an instance of <see cref="ErrorReportingContextExceptionLogger"/>
        /// </summary>
        /// <param name="projectId">The Google Cloud Platform project ID. Can be null.</param>
        /// <param name="serviceName">An identifier of the service, such as the name of the executable or job.
        ///     Must not be null.</param>
        /// <param name="version">Represents the source code version that the developer provided.
        ///     Must not be null.</param>
        /// <param name="options">Optional, error reporting options.</param>
        internal static IContextExceptionLogger Create(string projectId, string serviceName, string version,
                                                       ErrorReportingOptions options = null)
        {
            GaxPreconditions.CheckNotNullOrEmpty(serviceName, nameof(serviceName));
            GaxPreconditions.CheckNotNullOrEmpty(version, nameof(version));

            options = options ?? ErrorReportingOptions.Create(projectId);
            var consumer = options.CreateConsumer();

            return(new ErrorReportingContextExceptionLogger(consumer, serviceName, version, options));
        }
コード例 #24
0
 /// <inheritdoc />
 public override int GetOrdinal(string name)
 {
     // If we've already populated the field index, complete synchronously.
     GaxPreconditions.CheckNotNullOrEmpty(name, nameof(name));
     if (_fieldIndex.Count != 0)
     {
         return(_fieldIndex[name]);
     }
     // Otherwise, fetch metadata in a new task and wait for it.
     return(Task.Run(() => GetFieldIndexAsync(name, CancellationToken.None)).ResultWithUnwrappedExceptions());
 }
コード例 #25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StackdriverMetricExporter"/> class.
        /// </summary>
        /// <param name="projectId">Google Cloud ProjectId that is used to send data to Stackdriver.</param>
        /// <param name="jsonPath">File path to the json file containing the service credential used to authenticate against Stackdriver APIs.</param>s
        /// <param name="viewManager">View manager to get the stats from.</param>
        public StackdriverMetricExporter(
            string projectId,
            string jsonPath,
            IViewManager viewManager)
        {
            GaxPreconditions.CheckNotNullOrEmpty(projectId, "projectId");

            this.projectId   = projectId;
            this.jsonPath    = jsonPath;
            this.viewManager = viewManager;
        }
コード例 #26
0
        /// <summary>
        /// Returns the column ordinal given the name of the column, asynchronously requesting metadata from
        /// the database if necessary.
        /// </summary>
        /// <param name="name">The name of the column.</param>
        /// <param name="cancellationToken">A cancellation token to cancel reading metadata. Defaults to <see cref="CancellationToken.None"/>.</param>
        /// <returns>The zero-based column ordinal.</returns>
        public async Task <int> GetOrdinalAsync(string name, CancellationToken cancellationToken = default)
        {
            GaxPreconditions.CheckNotNullOrEmpty(name, nameof(name));
            if (_fieldIndex is null)
            {
                await PopulateMetadataAsync(cancellationToken).ConfigureAwait(false);

                InitializeFieldIndexFromMetadata();
            }
            return(_fieldIndex[name]);
        }
コード例 #27
0
        /// <summary>
        /// Shared code for creating <see cref="ErrorReportingExceptionFilter"/>.
        /// </summary>
        /// <param name="projectId">The Google Cloud Platform project ID. If null the project Id will be auto detected.</param>
        /// <param name="serviceName">An identifier of the service, such as the name of the executable or job.
        ///     Cannot be null.</param>
        /// <param name="version">Represents the source code version that the developer provided.
        ///     Cannot be null.</param>
        /// <param name="options">Optional, error reporting options.</param>
        private static ErrorReportingExceptionFilter CreateBase(string projectId, string serviceName, string version,
                                                                ErrorReportingOptions options = null)
        {
            GaxPreconditions.CheckNotNullOrEmpty(serviceName, nameof(serviceName));
            GaxPreconditions.CheckNotNullOrEmpty(version, nameof(version));

            options = options ?? ErrorReportingOptions.Create(projectId);
            var consumer = options.CreateConsumer();

            return(new ErrorReportingExceptionFilter(consumer, serviceName, version));
        }
コード例 #28
0
 internal static FieldPath FromDotSeparatedString(string path)
 {
     GaxPreconditions.CheckNotNullOrEmpty(path, nameof(path));
     GaxPreconditions.CheckArgument(path.IndexOfAny(s_prohibitedCharacters) == -1, nameof(path), "Use the constructor for field names containing any of '~*/[]'.");
     string[] elements = path.Split(s_dotSplit);
     if (elements.Contains(""))
     {
         throw new ArgumentException("Path cannot contain empty elements", nameof(path));
     }
     // Avoid the copy or more validation.
     return(new FieldPath(elements, true));
 }
コード例 #29
0
 /// <summary>
 /// Returns of a list of traces that match the specified filter conditions.
 /// </summary>
 /// <param name="projectId">
 /// ID of the Cloud project where the trace data is stored.
 /// </param>
 /// <param name="pageToken">
 /// The token returned from the previous request.
 /// A value of <c>null</c> or an empty string retrieves the first page.
 /// </param>
 /// <param name="pageSize">
 /// The size of page to request. The response will not be larger than this, but may be smaller.
 /// A value of <c>null</c> or 0 uses a server-defined page size.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// A pageable sequence of <see cref="Trace"/> resources.
 /// </returns>
 public virtual PagedEnumerable <ListTracesResponse, Trace> ListTraces(
     string projectId,
     string pageToken          = null,
     int?pageSize              = null,
     CallSettings callSettings = null) => ListTraces(
     new ListTracesRequest
 {
     ProjectId = GaxPreconditions.CheckNotNullOrEmpty(projectId, nameof(projectId)),
     PageToken = pageToken ?? "",
     PageSize  = pageSize ?? 0,
 },
     callSettings);
コード例 #30
0
 /// <summary>
 /// Lists the indexes that match the specified filters.
 /// </summary>
 /// <param name="parent">
 /// The database name. For example:
 /// `projects/{project_id}/databases/{database_id}`
 /// </param>
 /// <param name="pageToken">
 /// The token returned from the previous request.
 /// A value of <c>null</c> or an empty string retrieves the first page.
 /// </param>
 /// <param name="pageSize">
 /// The size of page to request. The response will not be larger than this, but may be smaller.
 /// A value of <c>null</c> or 0 uses a server-defined page size.
 /// </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(
     string parent,
     string pageToken          = null,
     int?pageSize              = null,
     CallSettings callSettings = null) => ListIndexes(
     new ListIndexesRequest
 {
     Parent    = GaxPreconditions.CheckNotNullOrEmpty(parent, nameof(parent)),
     PageToken = pageToken ?? "",
     PageSize  = pageSize ?? 0,
 },
     callSettings);