Skip to content

Commit d950ce1

Browse files
authored
Email service data plane operations - Send email and get email send status (#25431)
* Email services data plane operations * Email Service data plane - added examples * Email Service pipeline issue fix * Pipeline issue fix * Updated the module name to EmailServicedata * Email Service data plane - updated test scenarios * Revert "Email Service data plane - updated test scenarios" This reverts commit 15c7974. * Email Service data plane - Updated test scenarios
1 parent bdbc966 commit d950ce1

25 files changed

+2112
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
bin
2+
obj
3+
.vs
4+
generated
5+
internal
6+
exports
7+
tools
8+
custom/*.psm1
9+
custom/autogen-model-cmdlets
10+
test/*-TestResults.xml
11+
/*.ps1
12+
/*.ps1xml
13+
/*.psm1
14+
/*.snk
15+
/*.csproj
16+
/*.nuspec
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@{
2+
GUID = '5168d495-7a9d-45d6-ab8f-9127f05ee378'
3+
RootModule = './Az.EmailServicedata.psm1'
4+
ModuleVersion = '0.1.0'
5+
CompatiblePSEditions = 'Core', 'Desktop'
6+
Author = 'Microsoft Corporation'
7+
CompanyName = 'Microsoft Corporation'
8+
Copyright = 'Microsoft Corporation. All rights reserved.'
9+
Description = 'Microsoft Azure PowerShell: EmailServicedata cmdlets'
10+
PowerShellVersion = '5.1'
11+
DotNetFrameworkVersion = '4.7.2'
12+
RequiredAssemblies = './bin/Az.EmailServicedata.private.dll'
13+
FormatsToProcess = './Az.EmailServicedata.format.ps1xml'
14+
FunctionsToExport = 'Get-AzEmailServicedataEmailSendResult', 'Send-AzEmailServicedataEmail'
15+
PrivateData = @{
16+
PSData = @{
17+
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'EmailServicedata'
18+
LicenseUri = 'https://aka.ms/azps-license'
19+
ProjectUri = 'https://github.com/Azure/azure-powershell'
20+
ReleaseNotes = ''
21+
}
22+
}
23+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<!-- region Generated -->
2+
# Az.EmailServicedata
3+
This directory contains the PowerShell module for the EmailServicedata service.
4+
5+
---
6+
## Info
7+
- Modifiable: yes
8+
- Generated: all
9+
- Committed: yes
10+
- Packaged: yes
11+
12+
---
13+
## Detail
14+
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.
15+
16+
## Module Requirements
17+
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater
18+
19+
## Authentication
20+
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.
21+
22+
## Development
23+
For information on how to develop for `Az.EmailServicedata`, see [how-to.md](how-to.md).
24+
<!-- endregion -->
25+
26+
### AutoRest Configuration
27+
> see https://aka.ms/autorest
28+
29+
``` yaml
30+
commit: 512e966e15cd8e6ffd756279971c478702f4e19e
31+
require:
32+
# readme.azure.noprofile.md is the common configuration file
33+
- $(this-folder)/../../readme.azure.noprofile.md
34+
input-file:
35+
# You need to specify your swagger files here.
36+
- $(repo)/specification/communication/data-plane/Email/stable/2023-03-31/CommunicationServicesEmail.json
37+
# If the swagger has not been put in the repo, you may uncomment the following line and refer to it locally
38+
# - (this-folder)/relative-path-to-your-swagger
39+
40+
root-module-name: $(prefix).Communication
41+
# For new RP, the version is 0.1.0
42+
module-version: 0.1.0
43+
# Normally, title is the service name
44+
title: EmailServicedata
45+
subject-prefix: $(service-name)
46+
47+
# If there are post APIs for some kinds of actions in the RP, you may need to
48+
# uncomment following line to support viaIdentity for these post APIs
49+
identity-correction-for-post: true
50+
resourcegroup-append: true
51+
nested-object-to-string: true
52+
endpoint-resource-id-key-name: AzureCommunicationEmailEndpointResourceId
53+
54+
directive:
55+
# [swagger] change the final-state-via to align with service response
56+
- from: swagger-document
57+
where: $.paths["/emails:send"].post["x-ms-long-running-operation-options"]
58+
transform: $["final-state-via"] = "operation-location"
59+
60+
# Add 200 status code.
61+
- from: swagger-document
62+
where: $.paths["/emails:send"].post.responses
63+
transform: >-
64+
return {
65+
"200": {
66+
"description": "Message status was successfully retrieved.",
67+
"headers": {
68+
"retry-after": {
69+
"description": "This header will only be present when the status is a non-terminal status. It indicates the minimum amount of time in seconds to wait before polling for operation status again.",
70+
"type": "integer",
71+
"format": "int32"
72+
}
73+
},
74+
"schema": {
75+
"$ref": "#/definitions/EmailSendResult"
76+
}
77+
}
78+
}
79+
```
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Custom
2+
This directory contains custom implementation for non-generated cmdlets for the `Az.EmailServicedata` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.EmailServicedata.custom.psm1`. This file should not be modified.
3+
4+
## Info
5+
- Modifiable: yes
6+
- Generated: partial
7+
- Committed: yes
8+
- Packaged: yes
9+
10+
## Details
11+
For `Az.EmailServicedata` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*.
12+
13+
For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.EmailServicedata.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder.
14+
15+
For script cmdlets, these are loaded via the `Az.EmailServicedata.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build.
16+
17+
## Purpose
18+
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder.
19+
20+
## Usage
21+
The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters:
22+
- Break
23+
- DefaultProfile
24+
- HttpPipelineAppend
25+
- HttpPipelinePrepend
26+
- Proxy
27+
- ProxyCredential
28+
- ProxyUseDefaultCredentials
29+
30+
These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.EmailServicedata`. For C#, follow the usage seen in the `ProcessRecordAsync` method.
31+
32+
### Attributes
33+
For processing the cmdlets, we've created some additional attributes:
34+
- `Microsoft.Azure.PowerShell.Cmdlets.EmailServicedata.DescriptionAttribute`
35+
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
36+
- `Microsoft.Azure.PowerShell.Cmdlets.EmailServicedata.DoNotExportAttribute`
37+
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.EmailServicedata`.
38+
- `Microsoft.Azure.PowerShell.Cmdlets.EmailServicedata.InternalExportAttribute`
39+
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.EmailServicedata`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder.
40+
- `Microsoft.Azure.PowerShell.Cmdlets.EmailServicedata.ProfileAttribute`
41+
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
Module Name: Az.EmailServicedata
3+
Module Guid: 5168d495-7a9d-45d6-ab8f-9127f05ee378
4+
Download Help Link: https://learn.microsoft.com/powershell/module/az.emailservicedata
5+
Help Version: 1.0.0.0
6+
Locale: en-US
7+
---
8+
9+
# Az.EmailServicedata Module
10+
## Description
11+
Microsoft Azure PowerShell: EmailServicedata cmdlets
12+
13+
## Az.EmailServicedata Cmdlets
14+
### [Get-AzEmailServicedataEmailSendResult](Get-AzEmailServicedataEmailSendResult.md)
15+
Gets the status of the email send operation.
16+
17+
### [Send-AzEmailServicedataEmail](Send-AzEmailServicedataEmail.md)
18+
Queues an email message to be sent to one or more recipients
19+
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
external help file:
3+
Module Name: Az.Communication
4+
online version: https://learn.microsoft.com/powershell/module/az.communication/get-azemailservicedataemailsendresult
5+
schema: 2.0.0
6+
---
7+
8+
# Get-AzEmailServicedataEmailSendResult
9+
10+
## SYNOPSIS
11+
Gets the status of the email send operation.
12+
13+
## SYNTAX
14+
15+
### Get (Default)
16+
```
17+
Get-AzEmailServicedataEmailSendResult -Endpoint <String> -OperationId <String> [-DefaultProfile <PSObject>]
18+
[<CommonParameters>]
19+
```
20+
21+
### GetViaIdentity
22+
```
23+
Get-AzEmailServicedataEmailSendResult -Endpoint <String> -InputObject <IEmailServicedataIdentity>
24+
[-DefaultProfile <PSObject>] [<CommonParameters>]
25+
```
26+
27+
## DESCRIPTION
28+
Gets the status of the email send operation.
29+
30+
## EXAMPLES
31+
32+
### Example 1: Gets the status and operation id of the email send operation.
33+
```powershell
34+
Get-AzEmailServicedataEmailSendResult -Endpoint "https://contoso.unitedstates.communication.azure.com" -OperationId 1111c0de-899f-5cce-acb5-3ec493af3800
35+
```
36+
37+
```output
38+
AdditionalInfo :
39+
Code :
40+
Detail :
41+
Id : 1111c0de-899f-5cce-acb5-3ec493af3800
42+
Message :
43+
ResourceGroupName :
44+
RetryAfter :
45+
Status : Succeeded
46+
Target :
47+
```
48+
49+
Returns a status and operation id of the email send operation.
50+
51+
## PARAMETERS
52+
53+
### -DefaultProfile
54+
The DefaultProfile parameter is not functional.
55+
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
56+
57+
```yaml
58+
Type: System.Management.Automation.PSObject
59+
Parameter Sets: (All)
60+
Aliases: AzureRMContext, AzureCredential
61+
62+
Required: False
63+
Position: Named
64+
Default value: None
65+
Accept pipeline input: False
66+
Accept wildcard characters: False
67+
```
68+
69+
### -Endpoint
70+
The communication resource, for example https://my-resource.communication.azure.com
71+
72+
```yaml
73+
Type: System.String
74+
Parameter Sets: (All)
75+
Aliases:
76+
77+
Required: True
78+
Position: Named
79+
Default value: None
80+
Accept pipeline input: False
81+
Accept wildcard characters: False
82+
```
83+
84+
### -InputObject
85+
Identity Parameter
86+
87+
```yaml
88+
Type: Microsoft.Azure.PowerShell.Cmdlets.EmailServicedata.Models.IEmailServicedataIdentity
89+
Parameter Sets: GetViaIdentity
90+
Aliases:
91+
92+
Required: True
93+
Position: Named
94+
Default value: None
95+
Accept pipeline input: True (ByValue)
96+
Accept wildcard characters: False
97+
```
98+
99+
### -OperationId
100+
ID of the long running operation (GUID) returned from a previous call to send email
101+
102+
```yaml
103+
Type: System.String
104+
Parameter Sets: Get
105+
Aliases:
106+
107+
Required: True
108+
Position: Named
109+
Default value: None
110+
Accept pipeline input: False
111+
Accept wildcard characters: False
112+
```
113+
114+
### CommonParameters
115+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
116+
117+
## INPUTS
118+
119+
### Microsoft.Azure.PowerShell.Cmdlets.EmailServicedata.Models.IEmailServicedataIdentity
120+
121+
## OUTPUTS
122+
123+
### Microsoft.Azure.PowerShell.Cmdlets.EmailServicedata.Models.IEmailSendResult
124+
125+
## NOTES
126+
127+
## RELATED LINKS
128+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Docs
2+
This directory contains the documentation of the cmdlets for the `Az.EmailServicedata` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overridden on regeneration*. To update documentation examples, please use the `..\examples` folder.
3+
4+
## Info
5+
- Modifiable: no
6+
- Generated: all
7+
- Committed: yes
8+
- Packaged: yes
9+
10+
## Details
11+
The process of documentation generation loads `Az.EmailServicedata` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `..\exports` folder. Additionally, when writing custom cmdlets in the `..\custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `..\examples` folder.

0 commit comments

Comments
 (0)