-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add group & add graph endpoints to AzureEnvironment
- Loading branch information
1 parent
262a7ee
commit fd4ce07
Showing
10 changed files
with
293 additions
and
37 deletions.
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/Group.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,96 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for | ||
* license information. | ||
*/ | ||
|
||
package com.microsoft.azure.management.graphrbac; | ||
|
||
import com.microsoft.azure.management.graphrbac.implementation.ADGroupInner; | ||
import com.microsoft.azure.management.resources.fluentcore.model.Creatable; | ||
import com.microsoft.azure.management.resources.fluentcore.model.Wrapper; | ||
|
||
/** | ||
* An immutable client-side representation of an Azure tenant. | ||
*/ | ||
public interface Group extends | ||
This comment has been minimized.
Sorry, something went wrong. |
||
Wrapper<ADGroupInner> { | ||
/** | ||
* @return object Id. | ||
*/ | ||
String objectId(); | ||
|
||
/** | ||
* @return object type. | ||
*/ | ||
String objectType(); | ||
|
||
/** | ||
* @return group display name. | ||
*/ | ||
String displayName(); | ||
|
||
/** | ||
* @return security enabled field. | ||
*/ | ||
Boolean securityEnabled(); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
/** | ||
* @return mail field. | ||
*/ | ||
String mail(); | ||
|
||
/************************************************************** | ||
* Fluent interfaces to provision a StorageAccount | ||
**************************************************************/ | ||
|
||
/** | ||
* Container interface for all the definitions that need to be implemented. | ||
*/ | ||
interface Definition extends | ||
DefinitionStages.Blank, | ||
DefinitionStages.WithDisplayName, | ||
DefinitionStages.WithMailNickname, | ||
DefinitionStages.WithCreate { | ||
} | ||
|
||
/** | ||
* Grouping of all the storage account definition stages. | ||
*/ | ||
interface DefinitionStages { | ||
/** | ||
* The first stage of the storage account definition. | ||
*/ | ||
interface Blank extends WithDisplayName { | ||
} | ||
|
||
interface WithDisplayName { | ||
WithMailNickname withDisplayName(String displayName); | ||
} | ||
|
||
interface WithMailNickname { | ||
WithCreate withMailNickname(String mailNickname); | ||
} | ||
|
||
/** | ||
* A storage account definition with sufficient inputs to create a new | ||
* storage account in the cloud, but exposing additional optional inputs to | ||
* specify. | ||
*/ | ||
interface WithCreate extends | ||
Creatable<Group> { | ||
} | ||
} | ||
|
||
/** | ||
* Grouping of all the storage account update stages. | ||
*/ | ||
interface UpdateStages { | ||
} | ||
|
||
/** | ||
* The template for a storage account update operation, containing all the settings that can be modified. | ||
*/ | ||
interface Update { | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/Groups.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,43 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for | ||
* license information. | ||
*/ | ||
|
||
package com.microsoft.azure.management.graphrbac; | ||
|
||
import com.microsoft.azure.CloudException; | ||
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; | ||
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeleting; | ||
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
/** | ||
* Entry point to tenant management API. | ||
*/ | ||
public interface Groups extends | ||
SupportsCreating<Group.DefinitionStages.Blank>, | ||
SupportsListing<Group>, | ||
SupportsDeleting { | ||
/** | ||
* Gets the information about a user. | ||
* | ||
* @param objectId the unique object id | ||
* @return an immutable representation of the resource | ||
* @throws CloudException exceptions thrown from the cloud | ||
* @throws IOException exceptions thrown from serialization/deserialization | ||
*/ | ||
Group getByObjectId(String objectId) throws CloudException, IOException; | ||
|
||
/** | ||
* Gets the information about a user. | ||
* | ||
* @param displayNamePrefix the partial prefix of the display name to search | ||
* @return an immutable representation of the resource | ||
* @throws CloudException exceptions thrown from the cloud | ||
* @throws IOException exceptions thrown from serialization/deserialization | ||
*/ | ||
List<Group> searchByDisplayName(String displayNamePrefix) throws CloudException, IOException; | ||
} |
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
35 changes: 35 additions & 0 deletions
35
...e-mgmt-graph-rbac/src/main/test/com/microsoft/azure/management/graphrbac/GroupsTests.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,35 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for | ||
* license information. | ||
*/ | ||
|
||
package com.microsoft.azure.management.graphrbac; | ||
|
||
import org.junit.AfterClass; | ||
import org.junit.Assert; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
import java.util.List; | ||
|
||
public class GroupsTests extends GraphRbacManagementTestBase { | ||
private static final String RG_NAME = "javacsmrg350"; | ||
private static final String APP_NAME = "app-javacsm350"; | ||
|
||
@BeforeClass | ||
public static void setup() throws Exception { | ||
createClients(); | ||
} | ||
|
||
@AfterClass | ||
public static void cleanup() throws Exception { | ||
} | ||
|
||
@Test | ||
public void getServicePrincipal() throws Exception { | ||
List<ServicePrincipal> servicePrincipals = graphRbacManager.servicePrincipals().list(); | ||
Assert.assertNotNull(servicePrincipals); | ||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
azure-mgmt-graph-rbac/src/main/test/com/microsoft/azure/management/graphrbac/UsersTests.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. See License.txt in the project root for | ||
* license information. | ||
*/ | ||
|
||
package com.microsoft.azure.management.graphrbac; | ||
|
||
import org.junit.AfterClass; | ||
import org.junit.Assert; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
import java.util.List; | ||
|
||
public class UsersTests extends GraphRbacManagementTestBase { | ||
private static final String RG_NAME = "javacsmrg350"; | ||
private static final String APP_NAME = "app-javacsm350"; | ||
|
||
@BeforeClass | ||
public static void setup() throws Exception { | ||
createClients(); | ||
} | ||
|
||
@AfterClass | ||
public static void cleanup() throws Exception { | ||
} | ||
|
||
@Test | ||
public void canCRUDUser() throws Exception { | ||
//LIST | ||
List<User> userList = graphRbacManager.users().list(); | ||
Assert.assertNotNull(userList); | ||
User user = graphRbacManager.users().define("jeffrolfnlu@hotmail.com") | ||
.withDisplayName("Test User 309") | ||
.withPassword("Pa$$w0rd") | ||
.withMailNickname("") | ||
.create(); | ||
} | ||
|
||
} |
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.
"Group" seems to be too generic of a name. Remember discussion we had in the past about "Group" vs ResourceGroup and we settled on qualifying the word "group" b/c of multiple different uses. So this sounds like
ActiveDirectoryGroup
(since the inner isADGroupInner
--- but we don't want the abbreviation here either)