diff --git a/commands/deploy_command.go b/commands/deploy_command.go index 3212a9e..3cc13dc 100644 --- a/commands/deploy_command.go +++ b/commands/deploy_command.go @@ -286,9 +286,9 @@ func (c *DeployCommand) Execute(args []string) ExecutionStatus { return Failure } - chunkSizeInMB := c.configurationSnapshot.GetChunkSizeInMB() + uploadChunkSizeInMB := c.configurationSnapshot.GetUploadChunkSizeInMB() // Upload the MTA archive file - mtaArchiveUploader := NewFileUploader([]string{mtaArchivePath}, mtaClient, chunkSizeInMB) + mtaArchiveUploader := NewFileUploader([]string{mtaArchivePath}, mtaClient, uploadChunkSizeInMB) uploadedMtaArchives, status := mtaArchiveUploader.UploadFiles() if status == Failure { return Failure @@ -301,7 +301,7 @@ func (c *DeployCommand) Execute(args []string) ExecutionStatus { // Upload the extension descriptor files var uploadedExtDescriptorIDs []string if len(extDescriptorPaths) != 0 { - extDescriptorsUploader := NewFileUploader(extDescriptorPaths, mtaClient, chunkSizeInMB) + extDescriptorsUploader := NewFileUploader(extDescriptorPaths, mtaClient, uploadChunkSizeInMB) uploadedExtDescriptors, status := extDescriptorsUploader.UploadFiles() if status == Failure { return Failure diff --git a/commands/file_uploader.go b/commands/file_uploader.go index c887a16..cb5fac9 100644 --- a/commands/file_uploader.go +++ b/commands/file_uploader.go @@ -20,17 +20,17 @@ import ( //FileUploader uploads files for the service with the specified service ID type FileUploader struct { - files []string - mtaClient mtaclient.MtaClientOperations - chunkSizeInMB uint64 + files []string + mtaClient mtaclient.MtaClientOperations + uploadChunkSizeInMB uint64 } //NewFileUploader creates a new file uploader for the specified service ID, files, and SLMP client -func NewFileUploader(files []string, mtaClient mtaclient.MtaClientOperations, chunkSizeInMB uint64) *FileUploader { +func NewFileUploader(files []string, mtaClient mtaclient.MtaClientOperations, uploadChunkSizeInMB uint64) *FileUploader { return &FileUploader{ - files: files, - mtaClient: mtaClient, - chunkSizeInMB: chunkSizeInMB, + files: files, + mtaClient: mtaClient, + uploadChunkSizeInMB: uploadChunkSizeInMB, } } @@ -89,7 +89,7 @@ func (f *FileUploader) UploadFiles() ([]*models.FileMetadata, ExecutionStatus) { ui.Say(" " + fullPath) // Upload the file - uploaded, err := uploadInChunks(fullPath, fileToUpload, f.chunkSizeInMB, f.mtaClient) + uploaded, err := uploadInChunks(fullPath, fileToUpload, f.uploadChunkSizeInMB, f.mtaClient) if err != nil { ui.Failed("Could not upload file %s: %s", terminal.EntityNameColor(fileToUpload.Name()), err.Error()) return nil, Failure @@ -101,13 +101,13 @@ func (f *FileUploader) UploadFiles() ([]*models.FileMetadata, ExecutionStatus) { return uploadedFiles, Success } -func uploadInChunks(fullPath string, fileToUpload os.File, chunkSizeInMB uint64, mtaClient mtaclient.MtaClientOperations) ([]*models.FileMetadata, error) { +func uploadInChunks(fullPath string, fileToUpload os.File, uploadChunkSizeInMB uint64, mtaClient mtaclient.MtaClientOperations) ([]*models.FileMetadata, error) { // Upload the file - err := util.ValidateChunkSize(fullPath, chunkSizeInMB) + err := util.ValidateChunkSize(fullPath, uploadChunkSizeInMB) if err != nil { return nil, fmt.Errorf("Could not valide file %q: %v", fullPath, baseclient.NewClientError(err)) } - fileToUploadParts, err := util.SplitFile(fullPath, chunkSizeInMB) + fileToUploadParts, err := util.SplitFile(fullPath, uploadChunkSizeInMB) if err != nil { return nil, fmt.Errorf("Could not process file %q: %v", fullPath, baseclient.NewClientError(err)) } diff --git a/commands/file_uploader_test.go b/commands/file_uploader_test.go index b72d278..c3f496f 100644 --- a/commands/file_uploader_test.go +++ b/commands/file_uploader_test.go @@ -9,7 +9,7 @@ import ( "github.com/cloudfoundry-incubator/multiapps-cli-plugin/clients/models" "github.com/cloudfoundry-incubator/multiapps-cli-plugin/clients/mtaclient/fakes" "github.com/cloudfoundry-incubator/multiapps-cli-plugin/commands" - "github.com/cloudfoundry-incubator/multiapps-cli-plugin/configuration" + "github.com/cloudfoundry-incubator/multiapps-cli-plugin/configuration/properties" "github.com/cloudfoundry-incubator/multiapps-cli-plugin/testutil" "github.com/cloudfoundry-incubator/multiapps-cli-plugin/ui" "github.com/cloudfoundry-incubator/multiapps-cli-plugin/util" @@ -44,7 +44,7 @@ var _ = Describe("FileUploader", func() { client := fakeSlmpClientBuilder.GetMtaFiles([]*models.FileMetadata{}, nil).Build() output := oc.CaptureOutput(func() { - fileUploader = commands.NewFileUploader([]string{}, client, configuration.DefaultChunkSizeInMB) + fileUploader = commands.NewFileUploader([]string{}, client, properties.DefaultUploadChunkSizeInMB) uploadedFiles, status = fileUploader.UploadFiles() }) ex.ExpectSuccess(status.ToInt(), output) @@ -57,7 +57,7 @@ var _ = Describe("FileUploader", func() { client := fakeSlmpClientBuilder.GetMtaFiles([]*models.FileMetadata{&testutil.SimpleFile}, nil).Build() var uploadedFiles []*models.FileMetadata output := oc.CaptureOutput(func() { - fileUploader = commands.NewFileUploader([]string{}, client, configuration.DefaultChunkSizeInMB) + fileUploader = commands.NewFileUploader([]string{}, client, properties.DefaultUploadChunkSizeInMB) uploadedFiles, status = fileUploader.UploadFiles() }) ex.ExpectSuccess(status.ToInt(), output) @@ -73,7 +73,7 @@ var _ = Describe("FileUploader", func() { UploadMtaFile(*testFile, testutil.GetFile(*testFile, testFileDigest), nil).Build() var uploadedFiles []*models.FileMetadata output := oc.CaptureOutput(func() { - fileUploader = commands.NewFileUploader([]string{testFileAbsolutePath}, client, configuration.DefaultChunkSizeInMB) + fileUploader = commands.NewFileUploader([]string{testFileAbsolutePath}, client, properties.DefaultUploadChunkSizeInMB) uploadedFiles, status = fileUploader.UploadFiles() }) Expect(len(uploadedFiles)).To(Equal(1)) @@ -95,7 +95,7 @@ var _ = Describe("FileUploader", func() { UploadMtaFile(*testFile, testutil.GetFile(*testFile, testFileDigest), nil).Build() var uploadedFiles []*models.FileMetadata output := oc.CaptureOutput(func() { - fileUploader = commands.NewFileUploader([]string{testFileAbsolutePath}, client, configuration.DefaultChunkSizeInMB) + fileUploader = commands.NewFileUploader([]string{testFileAbsolutePath}, client, properties.DefaultUploadChunkSizeInMB) uploadedFiles, status = fileUploader.UploadFiles() }) ex.ExpectSuccessWithOutput(status.ToInt(), output, []string{ @@ -113,7 +113,7 @@ var _ = Describe("FileUploader", func() { UploadMtaFile(*testFile, fileMetadata, nil).Build() var uploadedFiles []*models.FileMetadata output := oc.CaptureOutput(func() { - fileUploader = commands.NewFileUploader([]string{testFileAbsolutePath}, client, configuration.DefaultChunkSizeInMB) + fileUploader = commands.NewFileUploader([]string{testFileAbsolutePath}, client, properties.DefaultUploadChunkSizeInMB) uploadedFiles, status = fileUploader.UploadFiles() }) Expect(len(uploadedFiles)).To(Equal(1)) @@ -135,7 +135,7 @@ var _ = Describe("FileUploader", func() { UploadMtaFile(*testFile, &models.FileMetadata{}, errors.New("Unexpected error from the backend")).Build() // var uploadedFiles []*models.FileMetadata output := oc.CaptureOutput(func() { - fileUploader = commands.NewFileUploader([]string{testFileAbsolutePath}, client, configuration.DefaultChunkSizeInMB) + fileUploader = commands.NewFileUploader([]string{testFileAbsolutePath}, client, properties.DefaultUploadChunkSizeInMB) _, status = fileUploader.UploadFiles() }) // Expect(len(uploadedFiles)).To(Equal(1)) diff --git a/commands/test.mtar b/commands/test.mtar deleted file mode 100644 index e69de29..0000000 diff --git a/configuration/chunk_size_in_mb_parser.go b/configuration/chunk_size_in_mb_parser.go deleted file mode 100644 index c66b024..0000000 --- a/configuration/chunk_size_in_mb_parser.go +++ /dev/null @@ -1,20 +0,0 @@ -package configuration - -import ( - "errors" - "strconv" -) - -type chunkSizeInMBParser struct { -} - -func (p chunkSizeInMBParser) Parse(value string) (interface{}, error) { - chunkSizeInMB, err := strconv.ParseUint(value, 10, 64) - if err != nil { - return nil, err - } - if chunkSizeInMB == 0 { - return nil, errors.New("chunk size cannot be 0") - } - return chunkSizeInMB, nil -} diff --git a/configuration/configurable_property.go b/configuration/configurable_property.go deleted file mode 100644 index d8cf738..0000000 --- a/configuration/configurable_property.go +++ /dev/null @@ -1,14 +0,0 @@ -package configuration - -type configurableProperty struct { - Name string - DeprecatedNames []string - Parser configurablePropertyParser - ParsingSuccessMessage string - ParsingFailureMessage string - DefaultValue interface{} -} - -type configurablePropertyParser interface { - Parse(value string) (interface{}, error) -} diff --git a/configuration/configuration.go b/configuration/configuration.go index 54abcb9..2d7a96a 100644 --- a/configuration/configuration.go +++ b/configuration/configuration.go @@ -2,45 +2,21 @@ package configuration import ( "fmt" + "github.com/cloudfoundry-incubator/multiapps-cli-plugin/configuration/properties" "os" ) -const ( - unknownError = "An unknown error occurred during the parsing of the environment variable \"%s\". Please report this! Value type: %T" - DefaultChunkSizeInMB = uint64(45) -) - -var BackendURLConfigurableProperty = configurableProperty{ - Name: "MULTIAPPS_CONTROLLER_URL", - DeprecatedNames: []string{ - "DEPLOY_SERVICE_URL", - }, - Parser: noOpParser{}, - ParsingSuccessMessage: "Attention: You've specified a custom backend URL (%s) via the environment variable \"%s\". The application listening on that URL may be outdated, contain bugs or unreleased features or may even be modified by a potentially untrused person. Use at your own risk.\n", - ParsingFailureMessage: "No validation implemented for custom backend URLs. If you're seeing this message then something has gone horribly wrong.\n", - DefaultValue: "", -} - -var ChunkSizeInMBConfigurableProperty = configurableProperty{ - Name: "MULTIAPPS_UPLOAD_CHUNK_SIZE", - DeprecatedNames: []string{ - "CHUNK_SIZE_IN_MB", - }, - Parser: chunkSizeInMBParser{}, - ParsingSuccessMessage: "Attention: You've specified a custom chunk size (%d MB) via the environment variable \"%s\".\n", - ParsingFailureMessage: "Attention: You've specified an INVALID custom chunk size (%s) via the environment variable \"%s\". Using default: %d\n", - DefaultValue: DefaultChunkSizeInMB, -} +const unknownError = "An unknown error occurred during the parsing of the environment variable \"%s\". Please report this! Value type: %T" type Snapshot struct { - backendURL string - chunkSizeInMB uint64 + backendURL string + uploadChunkSizeInMB uint64 } func NewSnapshot() Snapshot { return Snapshot{ - backendURL: getBackendURLFromEnvironment(), - chunkSizeInMB: getChunkSizeInMBFromEnvironment(), + backendURL: getBackendURLFromEnvironment(), + uploadChunkSizeInMB: getUploadChunkSizeInMBFromEnvironment(), } } @@ -48,19 +24,19 @@ func (c Snapshot) GetBackendURL() string { return c.backendURL } -func (c Snapshot) GetChunkSizeInMB() uint64 { - return c.chunkSizeInMB +func (c Snapshot) GetUploadChunkSizeInMB() uint64 { + return c.uploadChunkSizeInMB } func getBackendURLFromEnvironment() string { - return getStringProperty(BackendURLConfigurableProperty) + return getStringProperty(properties.BackendURL) } -func getChunkSizeInMBFromEnvironment() uint64 { - return getUint64Property(ChunkSizeInMBConfigurableProperty) +func getUploadChunkSizeInMBFromEnvironment() uint64 { + return getUint64Property(properties.UploadChunkSizeInMB) } -func getStringProperty(property configurableProperty) string { +func getStringProperty(property properties.ConfigurableProperty) string { uncastedValue := getPropertyOrDefault(property) value, ok := uncastedValue.(string) if !ok { @@ -69,7 +45,7 @@ func getStringProperty(property configurableProperty) string { return value } -func getUint64Property(property configurableProperty) uint64 { +func getUint64Property(property properties.ConfigurableProperty) uint64 { uncastedValue := getPropertyOrDefault(property) value, ok := uncastedValue.(uint64) if !ok { @@ -78,7 +54,7 @@ func getUint64Property(property configurableProperty) uint64 { return value } -func getPropertyOrDefault(property configurableProperty) interface{} { +func getPropertyOrDefault(property properties.ConfigurableProperty) interface{} { value := getPropertyWithNameOrDefaultIfInvalid(property, property.Name) if value != nil { return value @@ -93,7 +69,7 @@ func getPropertyOrDefault(property configurableProperty) interface{} { return property.DefaultValue } -func getPropertyWithNameOrDefaultIfInvalid(property configurableProperty, name string) interface{} { +func getPropertyWithNameOrDefaultIfInvalid(property properties.ConfigurableProperty, name string) interface{} { propertyValue, err := getPropertyWithName(name, property.Parser) if err != nil { propertyValue = os.Getenv(name) @@ -107,7 +83,7 @@ func getPropertyWithNameOrDefaultIfInvalid(property configurableProperty, name s return nil } -func getPropertyWithName(name string, parser configurablePropertyParser) (interface{}, error) { +func getPropertyWithName(name string, parser properties.Parser) (interface{}, error) { propertyValue, isSet := os.LookupEnv(name) if isSet { return parser.Parse(propertyValue) diff --git a/configuration/configuration_test.go b/configuration/configuration_test.go index c689fa3..73f3482 100644 --- a/configuration/configuration_test.go +++ b/configuration/configuration_test.go @@ -2,6 +2,7 @@ package configuration_test import ( "github.com/cloudfoundry-incubator/multiapps-cli-plugin/configuration" + "github.com/cloudfoundry-incubator/multiapps-cli-plugin/configuration/properties" "github.com/cloudfoundry-incubator/multiapps-cli-plugin/ui" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -18,8 +19,8 @@ var _ = Describe("Configuration", func() { Describe("GetBackendURL", func() { BeforeEach(func() { - os.Unsetenv(configuration.BackendURLConfigurableProperty.Name) - for _, name := range configuration.BackendURLConfigurableProperty.DeprecatedNames { + os.Unsetenv(properties.BackendURL.Name) + for _, name := range properties.BackendURL.DeprecatedNames { os.Unsetenv(name) } }) @@ -27,16 +28,16 @@ var _ = Describe("Configuration", func() { Context("with a set environment variable", func() { It("should return its value", func() { backendURL := "http://my-multiapps-controller.domain.com" - os.Setenv(configuration.BackendURLConfigurableProperty.Name, backendURL) + os.Setenv(properties.BackendURL.Name, backendURL) configurationSnapshot := configuration.NewSnapshot() Expect(configurationSnapshot.GetBackendURL()).To(Equal(backendURL)) }) }) Context("with a set environment variable (deprecated)", func() { It("should return its value", func() { - if len(configuration.BackendURLConfigurableProperty.DeprecatedNames) > 0 { + if len(properties.BackendURL.DeprecatedNames) > 0 { backendURL := "http://my-multiapps-controller.domain.com" - os.Setenv(configuration.BackendURLConfigurableProperty.DeprecatedNames[0], backendURL) + os.Setenv(properties.BackendURL.DeprecatedNames[0], backendURL) configurationSnapshot := configuration.NewSnapshot() Expect(configurationSnapshot.GetBackendURL()).To(Equal(backendURL)) } @@ -54,8 +55,8 @@ var _ = Describe("Configuration", func() { Describe("GetChunkSizeInMB", func() { BeforeEach(func() { - os.Unsetenv(configuration.ChunkSizeInMBConfigurableProperty.Name) - for _, name := range configuration.ChunkSizeInMBConfigurableProperty.DeprecatedNames { + os.Unsetenv(properties.UploadChunkSizeInMB.Name) + for _, name := range properties.UploadChunkSizeInMB.DeprecatedNames { os.Unsetenv(name) } }) @@ -63,43 +64,43 @@ var _ = Describe("Configuration", func() { Context("with a set environment variable", func() { Context("containing a positive integer", func() { It("should return its value", func() { - chunkSizeInMB := uint64(5) - os.Setenv(configuration.ChunkSizeInMBConfigurableProperty.Name, strconv.Itoa(int(chunkSizeInMB))) + uploadChunkSizeInMB := uint64(5) + os.Setenv(properties.UploadChunkSizeInMB.Name, strconv.Itoa(int(uploadChunkSizeInMB))) configurationSnapshot := configuration.NewSnapshot() - Expect(configurationSnapshot.GetChunkSizeInMB()).To(Equal(chunkSizeInMB)) + Expect(configurationSnapshot.GetUploadChunkSizeInMB()).To(Equal(uploadChunkSizeInMB)) }) }) Context("containing zero", func() { It("should return the default value", func() { - chunkSizeInMB := 0 - os.Setenv(configuration.ChunkSizeInMBConfigurableProperty.Name, strconv.Itoa(chunkSizeInMB)) + uploadChunkSizeInMB := 0 + os.Setenv(properties.UploadChunkSizeInMB.Name, strconv.Itoa(uploadChunkSizeInMB)) configurationSnapshot := configuration.NewSnapshot() - Expect(configurationSnapshot.GetChunkSizeInMB()).To(Equal(configuration.DefaultChunkSizeInMB)) + Expect(configurationSnapshot.GetUploadChunkSizeInMB()).To(Equal(properties.DefaultUploadChunkSizeInMB)) }) }) Context("containing a string", func() { It("should return the default value", func() { - chunkSizeInMB := "abc" - os.Setenv(configuration.ChunkSizeInMBConfigurableProperty.Name, chunkSizeInMB) + uploadChunkSizeInMB := "abc" + os.Setenv(properties.UploadChunkSizeInMB.Name, uploadChunkSizeInMB) configurationSnapshot := configuration.NewSnapshot() - Expect(configurationSnapshot.GetChunkSizeInMB()).To(Equal(configuration.DefaultChunkSizeInMB)) + Expect(configurationSnapshot.GetUploadChunkSizeInMB()).To(Equal(properties.DefaultUploadChunkSizeInMB)) }) }) }) Context("with a set environment variable (deprecated)", func() { It("should return its value", func() { - if len(configuration.ChunkSizeInMBConfigurableProperty.DeprecatedNames) > 0 { - chunkSizeInMB := uint64(5) - os.Setenv(configuration.ChunkSizeInMBConfigurableProperty.DeprecatedNames[0], strconv.Itoa(int(chunkSizeInMB))) + if len(properties.UploadChunkSizeInMB.DeprecatedNames) > 0 { + uploadChunkSizeInMB := uint64(5) + os.Setenv(properties.UploadChunkSizeInMB.DeprecatedNames[0], strconv.Itoa(int(uploadChunkSizeInMB))) configurationSnapshot := configuration.NewSnapshot() - Expect(configurationSnapshot.GetChunkSizeInMB()).To(Equal(chunkSizeInMB)) + Expect(configurationSnapshot.GetUploadChunkSizeInMB()).To(Equal(uploadChunkSizeInMB)) } }) }) Context("without a set environment variable", func() { It("should return the default value", func() { configurationSnapshot := configuration.NewSnapshot() - Expect(configurationSnapshot.GetChunkSizeInMB()).To(Equal(configuration.DefaultChunkSizeInMB)) + Expect(configurationSnapshot.GetUploadChunkSizeInMB()).To(Equal(properties.DefaultUploadChunkSizeInMB)) }) }) diff --git a/configuration/no_op_parser.go b/configuration/no_op_parser.go deleted file mode 100644 index a53a678..0000000 --- a/configuration/no_op_parser.go +++ /dev/null @@ -1,8 +0,0 @@ -package configuration - -type noOpParser struct { -} - -func (p noOpParser) Parse(value string) (interface{}, error) { - return value, nil -} diff --git a/configuration/properties/backend_url_configurable_property.go b/configuration/properties/backend_url_configurable_property.go new file mode 100644 index 0000000..5943dd8 --- /dev/null +++ b/configuration/properties/backend_url_configurable_property.go @@ -0,0 +1,12 @@ +package properties + +var BackendURL = ConfigurableProperty{ + Name: "MULTIAPPS_CONTROLLER_URL", + DeprecatedNames: []string{ + "DEPLOY_SERVICE_URL", + }, + Parser: noOpParser{}, + ParsingSuccessMessage: "Attention: You've specified a custom backend URL (%s) via the environment variable \"%s\". The application listening on that URL may be outdated, contain bugs or unreleased features or may even be modified by a potentially untrused person. Use at your own risk.\n", + ParsingFailureMessage: "No validation implemented for custom backend URLs. If you're seeing this message then something has gone horribly wrong.\n", + DefaultValue: "", +} diff --git a/configuration/properties/configurable_property.go b/configuration/properties/configurable_property.go new file mode 100644 index 0000000..5d1393b --- /dev/null +++ b/configuration/properties/configurable_property.go @@ -0,0 +1,21 @@ +package properties + +type ConfigurableProperty struct { + Name string + DeprecatedNames []string + Parser Parser + ParsingSuccessMessage string + ParsingFailureMessage string + DefaultValue interface{} +} + +type Parser interface { + Parse(value string) (interface{}, error) +} + +type noOpParser struct { +} + +func (p noOpParser) Parse(value string) (interface{}, error) { + return value, nil +} diff --git a/configuration/properties/upload_chunk_size_configurable_property.go b/configuration/properties/upload_chunk_size_configurable_property.go new file mode 100644 index 0000000..939cba8 --- /dev/null +++ b/configuration/properties/upload_chunk_size_configurable_property.go @@ -0,0 +1,36 @@ +package properties + +import ( + "errors" + "strconv" +) + +const DefaultUploadChunkSizeInMB = uint64(45) + +var UploadChunkSizeInMB = ConfigurableProperty{ + Name: "MULTIAPPS_UPLOAD_CHUNK_SIZE", + DeprecatedNames: []string{ + "CHUNK_SIZE_IN_MB", + }, + Parser: uploadChunkSizeParser{}, + ParsingSuccessMessage: "Attention: You've specified a custom chunk size (%d MB) via the environment variable \"%s\".\n", + ParsingFailureMessage: "Attention: You've specified an INVALID custom chunk size (%s) via the environment variable \"%s\". Using default: %d\n", + DefaultValue: DefaultUploadChunkSizeInMB, +} + +type uploadChunkSizeParser struct{} + +func (p uploadChunkSizeParser) Parse(value string) (interface{}, error) { + parsedValue, err := parseUint64(value) + if err != nil { + return nil, err + } + if parsedValue == 0 { + return nil, errors.New("chunk size cannot be 0") + } + return parsedValue, nil +} + +func parseUint64(value string) (uint64, error) { + return strconv.ParseUint(value, 10, 64) +} diff --git a/util/file_splitter.go b/util/file_splitter.go index f53811b..cfdccaf 100644 --- a/util/file_splitter.go +++ b/util/file_splitter.go @@ -8,7 +8,7 @@ import ( "path/filepath" "strconv" - "github.com/cloudfoundry-incubator/multiapps-cli-plugin/configuration" + "github.com/cloudfoundry-incubator/multiapps-cli-plugin/configuration/properties" "github.com/pborman/uuid" ) @@ -76,7 +76,7 @@ func ValidateChunkSize(filePath string, fileChunkSizeInMB uint64) error { return nil } - if fileChunkSizeInMB == configuration.DefaultChunkSizeInMB { + if fileChunkSizeInMB == properties.DefaultUploadChunkSizeInMB { return nil }