Add-KrFormOption
SYNOPSIS
Adds a form option to the Kestrun server.
SYNTAX
__AllParameterSets
Add-KrFormOption [[-PartRules] <KrFormPartRule[]>] [[-Name] <string>] [[-Description] <string>]
[[-AllowedRequestContentTypes] <string[]>] [[-DefaultUploadPath] <string>]
[[-AllowedPartContentEncodings] <string[]>] [[-MaxDecompressedBytesPerPart] <long>]
[[-Logger] <ILogger>] [[-MaxRequestBodyBytes] <long>] [[-MaxPartBodyBytes] <long>]
[[-MaxParts] <int>] [[-MaxHeaderBytesPerPart] <int>] [[-MaxFieldValueBytes] <long>]
[[-MaxNestingDepth] <int>] [-AllowUnknownRequestContentType] [-ComputeSha256]
[-EnablePartDecompression] [-RejectUnknownContentEncoding] [-PassThru] [<CommonParameters>]
ALIASES
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION
This function creates and adds a form option to the Kestrun server’s form options collection. It allows you to specify various parameters for the form option, such as name, description, allowed content types, upload path, and part rules.
EXAMPLES
EXAMPLE 1
Add-KrFormOption -Name ‘fileUpload’ -DefaultUploadPath ‘C:\Uploads’ -ComputeSha256 -PartRules $rules This example adds a form option named ‘fileUpload’ with a default upload path of ‘C:\Uploads’, enables SHA-256 computation, and associates the specified part rules.
EXAMPLE 2
New-KrFormPartRule -Name ‘file’ -Required -AllowedContentTypes ‘text/plain’| Add-KrFormOption -Name ‘textFileUpload’ -PassThru This example creates a form part rule for a required text file and adds it to a new form option named ‘textFileUpload’.
PARAMETERS
-AllowedPartContentEncodings
An array of allowed content encodings for parts.
Type: System.String[]
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 5
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-AllowedRequestContentTypes
An array of allowed request content types for the form option.
Type: System.String[]
DefaultValue: "@('multipart/form-data')"
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 3
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-AllowUnknownRequestContentType
Indicates whether to allow unknown request content types.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-ComputeSha256
Indicates whether to compute the SHA-256 hash of uploaded files.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-DefaultUploadPath
The default upload path for files.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 4
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Description
A description of the form option.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 2
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-EnablePartDecompression
Indicates whether to enable decompression of parts.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Logger
The logger to use for logging.
Type: Serilog.ILogger
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 7
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxDecompressedBytesPerPart
The maximum number of decompressed bytes per part.
Type: System.Int64
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 6
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxFieldValueBytes
The maximum size in bytes for field values.
Type: System.Int64
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 12
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxHeaderBytesPerPart
The maximum size in bytes for headers per part.
Type: System.Int32
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 11
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxNestingDepth
The maximum nesting depth for multipart forms.
Type: System.Int32
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 13
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxPartBodyBytes
The maximum size in bytes for each part body.
Type: System.Int64
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 9
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxParts
The maximum number of parts allowed in the form.
Type: System.Int32
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 10
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxRequestBodyBytes
The maximum size in bytes for the request body.
Type: System.Int64
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 8
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Name
The name of the form option. If not provided, a unique name will be generated as “FormOption_{GUID}”. Also used as the key when registering the form option in the server’s form options collection. If not unique, the registration will fail and $null will be returned. If not provided, the form option will still be created and returned, but not registered.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-PartRules
An array of form part rules associated with the form option. Can be provided via pipeline input.
Type: Kestrun.Forms.KrFormPartRule[]
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: false
ValueFromPipeline: true
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-PassThru
If specified, the cmdlet will return the created form option. If a Name is not provided, the created form option will always be returned.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-RejectUnknownContentEncoding
Indicates whether to reject unknown content encodings.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
Kestrun.Forms.KrFormPartRule[]
{{ Fill in the Description }}
OUTPUTS
Kestrun.Forms.KrFormOptions
{{ Fill in the Description }}
NOTES
This function is part of the Kestrun.Forms module and is used to define form options.
RELATED LINKS
{{ Fill in the related links here }}