-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renames Add-CloudEvent*Data to Set-CloudEvent*Data (#12)
* Addresses issue #9 renaming Add-CloudEvent*Data functions to Set-CloudEvent*Data. As described in the issue the Add notion is not correct for the functions functionality. Set verb notion matches the behavior of the functions. * Increment minor version of the module. The module is not yet released but this is a backward compatibility breaking change. * Remove module catalog file creation from build.ps1 because catalog file is needed only when module is signed. We still don't have a signing implementation for this module. * Explicitly set `-Depth` parameter for `Set-CloudEventJsonData` function in the tests Signed-off-by: Dimitar Milov <[email protected]>
- Loading branch information
Showing
12 changed files
with
74 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,30 +72,30 @@ PROCESS { | |
} | ||
} | ||
|
||
#region Add Data Functions | ||
function Add-CloudEventData { | ||
#region Set Data Functions | ||
function Set-CloudEventData { | ||
<# | ||
.SYNOPSIS | ||
This function adds data to a cloud event. | ||
This function sets data in a cloud event. | ||
.DESCRIPTION | ||
This function adds data to a cloud event object with the provided parameters. | ||
This function sets data in a cloud event object with the provided parameters. | ||
.PARAMETER CloudEvent | ||
Specifies the cloud event object to add data to. | ||
Specifies the cloud event object that receives the data. | ||
.PARAMETER Data | ||
Specifies the data object that is added to the cloud event 'data' attribute. | ||
Specifies the data object for the cloud event 'data' attribute. | ||
.PARAMETER DataContentType | ||
Specifies the 'datacontenttype' attribute of the cloud event. | ||
.EXAMPLE | ||
$cloudEvent = New-CloudEvent -Type 'com.example.object.deleted.v2' -Source 'mailto:[email protected]' -Id '6e8bc430-9c3a-11d9-9669-0800200c9a66' -Time (Get-Date) | ||
$cloudEvent | Add-CloudEventData -Data '<much wow="xml"/>' -DataContentType 'application/xml' | ||
$cloudEvent | Set-CloudEventData -Data '<much wow="xml"/>' -DataContentType 'application/xml' | ||
Adds xml data to the cloud event | ||
Sets xml data to the cloud event | ||
#> | ||
|
||
[CmdletBinding()] | ||
|
@@ -135,27 +135,32 @@ PROCESS { | |
|
||
} | ||
|
||
function Add-CloudEventJsonData { | ||
function Set-CloudEventJsonData { | ||
<# | ||
.SYNOPSIS | ||
This function adds JSON format data to a cloud event. | ||
This function sets JSON format data in a cloud event. | ||
.DESCRIPTION | ||
This function converts a PowerShell hashtable to JSON format data and adds it to a cloud event. | ||
This function converts a PowerShell hashtable to JSON format data and sets it in a cloud event. | ||
.PARAMETER CloudEvent | ||
Specifies the cloud event object to add data to. | ||
Specifies the cloud event object that receives the data. | ||
.PARAMETER Data | ||
Specifies the PowerShell hashtable object that is added as JSON to the cloud event 'data' attribute. | ||
The 'datacontenttype' attribute is set to 'applicaiton/json' | ||
Specifies the PowerShell hashtable object that is set as JSON on the cloud event 'data' attribute. | ||
The 'datacontenttype' attribute is set to 'application/json' | ||
.PARAMETER Depth | ||
The maximum depth of the input hashtable specified on the `Data` parameter that will be converted to JSON. | ||
This parameter is passed on the `-Depth` parameter of the `ConvertTo-Json` cmdlet. | ||
The default value is 3 | ||
.EXAMPLE | ||
$cloudEvent = New-CloudEvent -Type 'com.example.object.deleted.v2' -Source 'mailto:[email protected]' -Id '6e8bc430-9c3a-11d9-9669-0800200c9a66' -Time (Get-Date) | ||
$cloudEvent | Add-CloudEventJsonData -Data @{ 'key1' = 'value1'; 'key2' = 'value2'; } | ||
$cloudEvent | Set-CloudEventJsonData -Data @{ 'key1' = 'value1'; 'key2' = 'value2'; } | ||
Adds JSON data to the cloud event | ||
Sets JSON data to the cloud event | ||
#> | ||
|
||
[CmdletBinding()] | ||
|
@@ -193,20 +198,20 @@ PROCESS { | |
|
||
} | ||
|
||
function Add-CloudEventXmlData { | ||
function Set-CloudEventXmlData { | ||
<# | ||
.SYNOPSIS | ||
This function adds XML format data to a cloud event. | ||
This function sets XML format data in a cloud event. | ||
.DESCRIPTION | ||
This function converts a PowerShell hashtable to XML format data and adds it to a cloud event. | ||
This function converts a PowerShell hashtable to XML format data and sets it in a cloud event. | ||
.PARAMETER CloudEvent | ||
Specifies the cloud event object to add data to. | ||
Specifies the cloud event object that receives the data. | ||
.PARAMETER Data | ||
Specifies the PowerShell hashtable object that is added as XML to the cloud event 'data' attribute. | ||
The 'datacontenttype' attribute is set to 'applicaiton/xml' | ||
Specifies the PowerShell hashtable object that is set as XML on the cloud event 'data' attribute. | ||
The 'datacontenttype' attribute is set to 'application/xml' | ||
.PARAMETER AttributesKeysInElementAttributes | ||
Specifies how to format the XML. If specified and the input Data hashtable has pairs of 'Attributes', 'Value' keys | ||
|
@@ -219,9 +224,9 @@ function Add-CloudEventXmlData { | |
.EXAMPLE | ||
$cloudEvent = New-CloudEvent -Type 'com.example.object.deleted.v2' -Source 'mailto:[email protected]' -Id '6e8bc430-9c3a-11d9-9669-0800200c9a66' -Time (Get-Date) | ||
$cloudEvent | Add-CloudEventXmlData -Data @{ 'key1' = 'value1'; 'key2' = 'value2'; } -AttributesKeysInElementAttributes $true | ||
$cloudEvent | Set-CloudEventXmlData -Data @{ 'key1' = 'value1'; 'key2' = 'value2'; } -AttributesKeysInElementAttributes $true | ||
Adds XML data to the cloud event | ||
Sets XML data in the cloud event | ||
#> | ||
|
||
[CmdletBinding()] | ||
|
@@ -256,7 +261,7 @@ PROCESS { | |
} | ||
|
||
} | ||
#endregion Add Data Functions | ||
#endregion Set Data Functions | ||
|
||
#region Read Data Functions | ||
function Read-CloudEventData { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.