forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Communication]: Add CloudEnvironment and optional full Id (Azure#18766)
* Add CloudEnvironment * Remove MRI from test constants Co-authored-by: JP Chen <jiach@microsoft.com>
- Loading branch information
1 parent
4fcc209
commit d90271c
Showing
13 changed files
with
413 additions
and
58 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
63 changes: 63 additions & 0 deletions
63
...on-common/src/main/java/com/azure/communication/common/CommunicationCloudEnvironment.java
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,63 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
package com.azure.communication.common; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* The cloud that the identifier belongs to. | ||
*/ | ||
public class CommunicationCloudEnvironment { | ||
private static final String PUBLIC_VALUE = "public"; | ||
private static final String DOD_VALUE = "dod"; | ||
private static final String GCCH_VALUE = "gcch"; | ||
|
||
private final String environmentValue; | ||
|
||
/** | ||
* Create CommunicationCloudEnvironment with name string | ||
* @param environmentValue name of hte cloud environment | ||
*/ | ||
public CommunicationCloudEnvironment(String environmentValue) { | ||
Objects.requireNonNull(environmentValue); | ||
this.environmentValue = environmentValue; | ||
} | ||
|
||
static CommunicationCloudEnvironment fromModel(CommunicationCloudEnvironmentModel environmentModel) { | ||
return new CommunicationCloudEnvironment(environmentModel.toString()); | ||
} | ||
|
||
/** | ||
* Represent Azure public cloud | ||
*/ | ||
public static final CommunicationCloudEnvironment PUBLIC = new CommunicationCloudEnvironment(PUBLIC_VALUE); | ||
|
||
/** | ||
* Represent Azure Dod cloud | ||
*/ | ||
public static final CommunicationCloudEnvironment DOD = new CommunicationCloudEnvironment(DOD_VALUE); | ||
|
||
/** | ||
* Represent Azure Gcch cloud | ||
*/ | ||
public static final CommunicationCloudEnvironment GCCH = new CommunicationCloudEnvironment(GCCH_VALUE); | ||
|
||
@Override | ||
public boolean equals(Object that) { | ||
if (this == that) { | ||
return true; | ||
} | ||
return that != null && this.environmentValue.equals(that.toString()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return environmentValue; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return toString().hashCode(); | ||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
...mmon/src/main/java/com/azure/communication/common/CommunicationCloudEnvironmentModel.java
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,41 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
package com.azure.communication.common; | ||
|
||
class CommunicationCloudEnvironmentModel { | ||
|
||
private static final String PUBLIC_VALUE = "public"; | ||
private static final String DOD_VALUE = "dod"; | ||
private static final String GCCH_VALUE = "gcch"; | ||
|
||
private final String environmentValue; | ||
|
||
CommunicationCloudEnvironmentModel(String environmentValue) { | ||
java.util.Objects.requireNonNull(environmentValue); | ||
this.environmentValue = environmentValue; | ||
} | ||
|
||
public static final CommunicationCloudEnvironmentModel PUBLIC = new CommunicationCloudEnvironmentModel(PUBLIC_VALUE); | ||
public static final CommunicationCloudEnvironmentModel DOD = new CommunicationCloudEnvironmentModel(DOD_VALUE); | ||
public static final CommunicationCloudEnvironmentModel GCCH = new CommunicationCloudEnvironmentModel(GCCH_VALUE); | ||
|
||
@Override | ||
public boolean equals(Object that) { | ||
if (this == that) { | ||
return true; | ||
} | ||
|
||
return that != null && this.environmentValue.equals(that.toString()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return environmentValue; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return toString().hashCode(); | ||
} | ||
|
||
} |
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
1 change: 0 additions & 1 deletion
1
...tion-common/src/main/java/com/azure/communication/common/CommunicationIdentifierKind.java
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.