/// <summary> /// TODO /// </summary> /// <param name="maxOutstandingElementCount"></param> /// <param name="maxOutstandardByteCount"></param> public FlowControlSettings(long?maxOutstandingElementCount, long?maxOutstandardByteCount) { MaxOutstandingElementCount = GaxPreconditions.CheckNonNegative(maxOutstandingElementCount, nameof(maxOutstandingElementCount)); MaxOutstandingByteCount = GaxPreconditions.CheckNonNegative(maxOutstandardByteCount, nameof(maxOutstandardByteCount)); }
/// <summary> /// Private constructor used by internal code to avoid repeated cloning and validation. /// </summary> private TemplatedResourceName(PathTemplate template, string serviceName, string[] resourceIds, bool ignored) { Template = GaxPreconditions.CheckNotNull(template, nameof(template)); ServiceName = serviceName; this._resourceIds = resourceIds; }
/// <summary> /// Constructs a <see cref="ResourceNameList{TName}"/> from an underlying string-based list /// and a resource name parser. /// </summary> /// <param name="underlyingList"></param> /// <param name="stringToName"></param> public ResourceNameList(IList <string> underlyingList, Func <string, TName> stringToName) { _underlyingList = underlyingList; _nameToString = name => GaxPreconditions.CheckNotNull(name, nameof(name)).ToString(); _stringToName = str => stringToName(GaxPreconditions.CheckNotNull(str, nameof(str))); }
/// <summary> /// Creates an unkown resource name from the given resource name string. /// Only minimal verification is carried out that <paramref name="name"/> is a value resource name string. /// </summary> /// <param name="name"></param> public UnknownResourceName(string name) { // TODO: Verify it looks like a resource name. _name = GaxPreconditions.CheckNotNullOrEmpty(name, nameof(name)); }
/// <summary> /// Construct with details of Google Cloud Run. /// </summary> /// <param name="cloudRunDetails">Details of Google Cloud Run.</param> public Platform(CloudRunPlatformDetails cloudRunDetails) { CloudRunDetails = GaxPreconditions.CheckNotNull(cloudRunDetails, nameof(cloudRunDetails)); }
/// <summary> /// Construct with details of Google Container (Kubernetes) Engine. /// </summary> /// <param name="gkeDetails">Details of Google Container (Kubernetes) Engine.</param> public Platform(GkePlatformDetails gkeDetails) { GkeDetails = GaxPreconditions.CheckNotNull(gkeDetails, nameof(gkeDetails)); }
/// <summary> /// Creates poll settings from the given expiration, delay and call settings. /// </summary> /// <param name="expiration">The expiration to use in order to know when to stop polling. Must not be null.</param> /// <param name="delay">The delay between RPC calls. Must be non-negative.</param> public PollSettings(Expiration expiration, TimeSpan delay) { Expiration = GaxPreconditions.CheckNotNull(expiration, nameof(expiration)); Delay = GaxPreconditions.CheckNonNegativeDelay(delay, nameof(delay)); }
/// <summary> /// Simulates a synchronous delay by calling <see cref="IScheduler.Delay(TimeSpan, CancellationToken)"/> on /// <paramref name="scheduler"/>, and unwrapping any exceptions generated (typically cancellation). /// </summary> /// <param name="scheduler">The scheduler to use for the sleep operation.</param> /// <param name="delay">Time to sleep for. Must not be negative.</param> /// <param name="cancellationToken">The cancellation token that will be watched during the sleep operation.</param> /// <exception cref="OperationCanceledException">The cancellation token was cancelled during the sleep.</exception> public static void Sleep(this IScheduler scheduler, TimeSpan delay, CancellationToken cancellationToken) => GaxPreconditions.CheckNotNull(scheduler, nameof(scheduler)) .Delay(delay, cancellationToken) .WaitWithUnwrappedExceptions();