Skip to content

Commit

Permalink
Change optional Guid name to Guid? (#14827)
Browse files Browse the repository at this point in the history
* Fix Key Vault Administration README

* Change optional Guid name to Guid?

Fixes #14823
  • Loading branch information
heaths authored Sep 2, 2020
1 parent e7d57b3 commit 4060b5f
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ protected KeyVaultAccessControlClient() { }
public KeyVaultAccessControlClient(System.Uri vaultUri, Azure.Core.TokenCredential credential) { }
public KeyVaultAccessControlClient(System.Uri vaultUri, Azure.Core.TokenCredential credential, Azure.Security.KeyVault.Administration.KeyVaultAccessControlClientOptions options) { }
public virtual System.Uri VaultUri { get { throw null; } }
public virtual Azure.Response<Azure.Security.KeyVault.Administration.Models.KeyVaultRoleAssignment> CreateRoleAssignment(Azure.Security.KeyVault.Administration.KeyVaultRoleScope roleScope, Azure.Security.KeyVault.Administration.Models.KeyVaultRoleAssignmentProperties properties, System.Guid name = default(System.Guid), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Security.KeyVault.Administration.Models.KeyVaultRoleAssignment>> CreateRoleAssignmentAsync(Azure.Security.KeyVault.Administration.KeyVaultRoleScope roleScope, Azure.Security.KeyVault.Administration.Models.KeyVaultRoleAssignmentProperties properties, System.Guid name = default(System.Guid), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Security.KeyVault.Administration.Models.KeyVaultRoleAssignment> CreateRoleAssignment(Azure.Security.KeyVault.Administration.KeyVaultRoleScope roleScope, Azure.Security.KeyVault.Administration.Models.KeyVaultRoleAssignmentProperties properties, System.Guid? name = default(System.Guid?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Security.KeyVault.Administration.Models.KeyVaultRoleAssignment>> CreateRoleAssignmentAsync(Azure.Security.KeyVault.Administration.KeyVaultRoleScope roleScope, Azure.Security.KeyVault.Administration.Models.KeyVaultRoleAssignmentProperties properties, System.Guid? name = default(System.Guid?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Security.KeyVault.Administration.Models.KeyVaultRoleAssignment> DeleteRoleAssignment(Azure.Security.KeyVault.Administration.KeyVaultRoleScope roleScope, string roleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Security.KeyVault.Administration.Models.KeyVaultRoleAssignment>> DeleteRoleAssignmentAsync(Azure.Security.KeyVault.Administration.KeyVaultRoleScope roleScope, string roleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Security.KeyVault.Administration.Models.KeyVaultRoleAssignment> GetRoleAssignment(Azure.Security.KeyVault.Administration.KeyVaultRoleScope roleScope, string roleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ description: Samples for the Azure.Security.KeyVault.Administration client libra
# Azure.Security.KeyVault.Administration Samples

- Creating, getting, and deleting role assignments [synchronously](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_RbacHelloWorldSync.md) or [asynchronously](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_RbacHelloWorldAsync.md)
- [Assigning roles for specific scopes](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample2_RbacScopeAssignment.md)
- [Assigning roles for specific scopes](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample2_RbacScopeAssignment.md)
- Performing a full key backup and restore [synchronously](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_BackupHelloWorldSync.md) and [asynchronously](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_BackupHelloWorldAsync.md)
- [Performing selective key restore]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Performing a full key backup and restore (Async)

This sample demonstrates how to a perform full key backup and restore in Azure Key Vault.
To get started, you'll need a URI to an Azure Key Vault. See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/readme.md) for links and instructions.
To get started, you'll need a URI to an Azure Key Vault. See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md) for links and instructions.

## Creating a KeyVaultBackupClient

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Performing a full key backup and restore (Sync)

This sample demonstrates how to perform a full key backup and restore in Azure Key Vault.
To get started, you'll need a URI to an Azure Key Vault. See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/readme.md) for links and instructions.
To get started, you'll need a URI to an Azure Key Vault. See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md) for links and instructions.

## Creating a KeyVaultBackupClient

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Creating, getting, and deleting role assignments (Async)

This sample demonstrates how to create, get, and delete role assignments in Azure Key Vault.
To get started, you'll need a URI to an Azure Key Vault. See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/readme.md) for links and instructions.
To get started, you'll need a URI to an Azure Key Vault. See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md) for links and instructions.

## Creating a KeyVaultAccessControlClient

Expand Down Expand Up @@ -44,7 +44,7 @@ Now let's assign a role to a service principal. To do this we'll need a role def

A role definition Id can be obtained from the `Id` property of one of the role definitions returned from `GetRoleAssignments`.

See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/readme.md) for links and instructions on how to generate a new service principal and obtain it's object Id.
See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md) for links and instructions on how to generate a new service principal and obtain it's object Id.
You can also get the object Id for your currently signed in account by running the following [Azure CLI][azure_cli] command.
```
az ad signed-in-user show --query objectId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Creating, getting, and deleting role assignments (Sync)

This sample demonstrates how to create, get, and delete role assignments in Azure Key Vault.
To get started, you'll need a URI to an Azure Key Vault. See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/readme.md) for links and instructions.
To get started, you'll need a URI to an Azure Key Vault. See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md) for links and instructions.

## Creating a KeyVaultAccessControlClient

Expand Down Expand Up @@ -36,7 +36,7 @@ Now let's assign a role to a service principal. To do this we'll need a role def

A role definition Id can be obtained from the `Id` property of one of the role definitions returned from `GetRoleAssignments`.

See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/readme.md) for links and instructions on how to generate a new service principal and obtain it's object Id.
See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md) for links and instructions on how to generate a new service principal and obtain it's object Id.
You can also get the object Id for your currently signed in account by running the following [Azure CLI][azure_cli] command.
```
az ad signed-in-user show --query objectId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ For information about interacting with a `KeyVaultKey` with a `KeyClient`, see t

Let's assign a role to a service principal so that it applies to all keys. To do this we'll need a service principal object Id and a role definition Id.

See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/readme.md) for links and instructions on how to generate a new service principal and obtain it's object Id.
See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md) for links and instructions on how to generate a new service principal and obtain it's object Id.
You can also get the object Id for your currently signed in account by running the following [Azure CLI][azure_cli] command.
```
az ad signed-in-user show --query objectId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,17 @@ public virtual AsyncPageable<KeyVaultRoleAssignment> GetRoleAssignmentsAsync(Key
/// </summary>
/// <param name="roleScope"> The scope of the role assignment to create. </param>
/// <param name="properties"> Properties for the role assignment. </param>
/// <param name="name">The Name used to create the role assignment.</param>
/// <param name="name">Optional name used to create the role assignment. A new <see cref="Guid"/> will be generated if not specified.</param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception>
/// <exception cref="ArgumentNullException"><paramref name="roleScope"/> or <paramref name="properties"/> is null.</exception>
public virtual Response<KeyVaultRoleAssignment> CreateRoleAssignment(KeyVaultRoleScope roleScope, KeyVaultRoleAssignmentProperties properties, Guid name = default, CancellationToken cancellationToken = default)
public virtual Response<KeyVaultRoleAssignment> CreateRoleAssignment(KeyVaultRoleScope roleScope, KeyVaultRoleAssignmentProperties properties, Guid? name = null, CancellationToken cancellationToken = default)
{
using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultAccessControlClient)}.{nameof(CreateRoleAssignment)}");
scope.Start();
try
{
var _name = name == default ? Guid.NewGuid().ToString() : name.ToString();
var _name = (name ?? Guid.NewGuid()).ToString();
return _assignmentsRestClient.Create(VaultUri.AbsoluteUri, roleScope.ToString(), _name, new RoleAssignmentCreateParameters(properties), cancellationToken);
}
catch (Exception ex)
Expand All @@ -264,17 +264,17 @@ public virtual Response<KeyVaultRoleAssignment> CreateRoleAssignment(KeyVaultRol
/// </summary>
/// <param name="roleScope"> The scope of the role assignment to create. </param>
/// <param name="properties"> Properties for the role assignment. </param>
/// <param name="name">The name used to create the role assignment.</param>
/// <param name="name">Optional name used to create the role assignment. A new <see cref="Guid"/> will be generated if not specified.</param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception>
/// <exception cref="ArgumentNullException"><paramref name="roleScope"/> or <paramref name="properties"/> is null.</exception>
public virtual async Task<Response<KeyVaultRoleAssignment>> CreateRoleAssignmentAsync(KeyVaultRoleScope roleScope, KeyVaultRoleAssignmentProperties properties, Guid name = default, CancellationToken cancellationToken = default)
public virtual async Task<Response<KeyVaultRoleAssignment>> CreateRoleAssignmentAsync(KeyVaultRoleScope roleScope, KeyVaultRoleAssignmentProperties properties, Guid? name = default, CancellationToken cancellationToken = default)
{
using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultAccessControlClient)}.{nameof(CreateRoleAssignment)}");
scope.Start();
try
{
var _name = name == default ? Guid.NewGuid().ToString() : name.ToString();
var _name = (name ?? Guid.NewGuid()).ToString();
return await _assignmentsRestClient.CreateAsync(VaultUri.AbsoluteUri, roleScope.ToString(), _name, new RoleAssignmentCreateParameters(properties), cancellationToken)
.ConfigureAwait(false);
}
Expand Down

0 comments on commit 4060b5f

Please sign in to comment.