From c83d0b60cb335cdb3292a3d2f71b36a8c44353a9 Mon Sep 17 00:00:00 2001 From: Amanda Tarafa Mas Date: Tue, 5 Mar 2024 13:15:11 -0800 Subject: [PATCH] review: Support overriding some URLSigner.Options default values. --- .../UrlSignerTest.OptionsTest.cs | 6 +++--- .../UrlSigner.DefaultOptionsOverrides.cs | 6 ++---- .../Google.Cloud.Storage.V1/UrlSigner.Options.cs | 7 +++---- .../Google.Cloud.Storage.V1/UrlSigner.cs | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1.Tests/UrlSignerTest.OptionsTest.cs b/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1.Tests/UrlSignerTest.OptionsTest.cs index e82e7cca7e80..f3db0f15ec67 100644 --- a/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1.Tests/UrlSignerTest.OptionsTest.cs +++ b/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1.Tests/UrlSignerTest.OptionsTest.cs @@ -243,7 +243,7 @@ public void WithPort_Null() } [Fact] - public void WithDefultOverrides_NullOverrideValues() + public void WithDefaultOverrides_NullOverrideValues() { var options = Options.FromDuration(TimeSpan.FromMinutes(1)); @@ -256,7 +256,7 @@ public void WithDefultOverrides_NullOverrideValues() } [Fact] - public void WithDefultOverrides() + public void WithDefaultOverrides() { var options = Options.FromDuration(TimeSpan.FromMinutes(1)); @@ -269,7 +269,7 @@ public void WithDefultOverrides() } [Fact] - public void WithDefultOverrides_DoesNotOverrideExplicit() + public void WithDefaultOverrides_DoesNotOverrideExplicit() { var options = Options.FromDuration(TimeSpan.FromMinutes(1)).WithScheme("https").WithHost("explicitHost").WithPort(5678); diff --git a/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/UrlSigner.DefaultOptionsOverrides.cs b/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/UrlSigner.DefaultOptionsOverrides.cs index a3f8601384c0..2a1608b1e69e 100644 --- a/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/UrlSigner.DefaultOptionsOverrides.cs +++ b/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/UrlSigner.DefaultOptionsOverrides.cs @@ -12,15 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Google.Api.Gax; - namespace Google.Cloud.Storage.V1; public sealed partial class UrlSigner { /// /// Overrides for default values for some of the options in . - /// Useful for creating signers where signing options default to specific valued, for instance - /// for creating signers from a where the host and scheme should + /// Useful for creating signers where signing options default to specific values, for instance + /// for creating signers from a where the scheme, host and port should /// default to that of the client. /// internal sealed class DefaultOptionsOverrides diff --git a/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/UrlSigner.Options.cs b/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/UrlSigner.Options.cs index 73ac63a0113a..3c0c08d5590b 100644 --- a/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/UrlSigner.Options.cs +++ b/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/UrlSigner.Options.cs @@ -65,8 +65,7 @@ public sealed class Options /// /// The Scheme to use for the request. Only http or https supported. /// This will never be null. If null is specified in - /// then https will be used. - /// Defaults to https. + /// an appropiate default value will be used. /// public string Scheme => ExplicitScheme ?? DefaultOptionsOverrides?.Scheme ?? DefaultScheme; @@ -79,7 +78,7 @@ public sealed class Options /// /// The host to use for generating the signed URL. /// This will never be null. If null is specified in - /// then will be used. + /// then the appropiate default value will be used. /// Will be ignored if is set to . /// public string Host => ExplicitHost ?? DefaultOptionsOverrides?.Host ?? DefaultStorageHost; @@ -121,7 +120,7 @@ public sealed class Options /// /// Values to be used as default for some options in case they are not set, - /// instead of the usual default values.May be null. + /// instead of the usual default values. May be null. /// internal DefaultOptionsOverrides DefaultOptionsOverrides { get; } diff --git a/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/UrlSigner.cs b/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/UrlSigner.cs index 5dbe81715c83..daee9fd34730 100644 --- a/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/UrlSigner.cs +++ b/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/UrlSigner.cs @@ -220,7 +220,7 @@ private static UrlSigner FromBlobSignerAsyncProvider(Func> sig internal UrlSigner WithClock(IClock clock) => new UrlSigner(_blobSignerProvider, clock, _defaultOptionsOverrides); /// - /// Returns a URL signer identical to this one, excepto for the default options overrides used for signing. + /// Returns a URL signer identical to this one, except for the default options overrides used for signing. /// internal UrlSigner WithDefaultOptionsOverride(DefaultOptionsOverrides optionsOverrides) => new UrlSigner(_blobSignerProvider, _clock, optionsOverrides);