-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Communication] - Identifier serialization new schema (#18120)
* Identity Derialization Requires Id * Add cloud environment to MicrosoftTeamsIdentifier * Update description Co-authored-by: Dominik <domessin@microsoft.com>
- Loading branch information
1 parent
8468943
commit 231fb45
Showing
10 changed files
with
275 additions
and
45 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
48 changes: 48 additions & 0 deletions
48
sdk/communication/Azure.Communication.Common/src/CommunicationCloudEnvironment.cs
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.ComponentModel; | ||
|
||
namespace Azure.Communication | ||
{ | ||
/// <summary> The cloud that the identifier belongs to. </summary> | ||
public readonly partial struct CommunicationCloudEnvironment : IEquatable<CommunicationCloudEnvironment> | ||
{ | ||
private readonly string _value; | ||
|
||
/// <summary> Determines if two <see cref="CommunicationCloudEnvironment"/> values are the same. </summary> | ||
/// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception> | ||
public CommunicationCloudEnvironment(string value) | ||
=> _value = value ?? throw new ArgumentNullException(nameof(value)); | ||
|
||
private const string PublicValue = "public"; | ||
private const string DodValue = "dod"; | ||
private const string GcchValue = "gcch"; | ||
|
||
/// <summary> public. </summary> | ||
public static CommunicationCloudEnvironment Public { get; } = new CommunicationCloudEnvironment(PublicValue); | ||
/// <summary> dod. </summary> | ||
public static CommunicationCloudEnvironment Dod { get; } = new CommunicationCloudEnvironment(DodValue); | ||
/// <summary> gcch. </summary> | ||
public static CommunicationCloudEnvironment Gcch { get; } = new CommunicationCloudEnvironment(GcchValue); | ||
/// <summary> Determines if two <see cref="CommunicationCloudEnvironment"/> values are the same. </summary> | ||
public static bool operator ==(CommunicationCloudEnvironment left, CommunicationCloudEnvironment right) => left.Equals(right); | ||
/// <summary> Determines if two <see cref="CommunicationCloudEnvironment"/> values are not the same. </summary> | ||
public static bool operator !=(CommunicationCloudEnvironment left, CommunicationCloudEnvironment right) => !left.Equals(right); | ||
/// <summary> Converts a string to a <see cref="CommunicationCloudEnvironment"/>. </summary> | ||
public static implicit operator CommunicationCloudEnvironment(string value) => new CommunicationCloudEnvironment(value); | ||
|
||
/// <inheritdoc /> | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public override bool Equals(object obj) => obj is CommunicationCloudEnvironment other && Equals(other); | ||
/// <inheritdoc /> | ||
public bool Equals(CommunicationCloudEnvironment other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); | ||
|
||
/// <inheritdoc /> | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public override int GetHashCode() => _value?.GetHashCode() ?? 0; | ||
/// <inheritdoc /> | ||
public override string ToString() => _value; | ||
} | ||
} |
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.