Skip to content

Commit 4060b5f

Browse files
authored
Change optional Guid name to Guid? (#14827)
* Fix Key Vault Administration README * Change optional Guid name to Guid? Fixes #14823
1 parent e7d57b3 commit 4060b5f

File tree

9 files changed

+16
-16
lines changed

9 files changed

+16
-16
lines changed
File renamed without changes.

sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ protected KeyVaultAccessControlClient() { }
2121
public KeyVaultAccessControlClient(System.Uri vaultUri, Azure.Core.TokenCredential credential) { }
2222
public KeyVaultAccessControlClient(System.Uri vaultUri, Azure.Core.TokenCredential credential, Azure.Security.KeyVault.Administration.KeyVaultAccessControlClientOptions options) { }
2323
public virtual System.Uri VaultUri { get { throw null; } }
24-
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; }
25-
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; }
24+
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; }
25+
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; }
2626
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; }
2727
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; }
2828
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; }

sdk/keyvault/Azure.Security.KeyVault.Administration/samples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ description: Samples for the Azure.Security.KeyVault.Administration client libra
1212
# Azure.Security.KeyVault.Administration Samples
1313

1414
- 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)
15-
- [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)
15+
- [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)
1616
- 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)
1717
- [Performing selective key restore]

sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_BackupHelloWorldAsync.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Performing a full key backup and restore (Async)
22

33
This sample demonstrates how to a perform full key backup and restore in Azure Key Vault.
4-
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.
4+
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.
55

66
## Creating a KeyVaultBackupClient
77

sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_BackupHelloWorldSync.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Performing a full key backup and restore (Sync)
22

33
This sample demonstrates how to perform a full key backup and restore in Azure Key Vault.
4-
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.
4+
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.
55

66
## Creating a KeyVaultBackupClient
77

sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_RbacHelloWorldAsync.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Creating, getting, and deleting role assignments (Async)
22

33
This sample demonstrates how to create, get, and delete role assignments in Azure Key Vault.
4-
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.
4+
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.
55

66
## Creating a KeyVaultAccessControlClient
77

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

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

47-
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.
47+
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.
4848
You can also get the object Id for your currently signed in account by running the following [Azure CLI][azure_cli] command.
4949
```
5050
az ad signed-in-user show --query objectId

sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_RbacHelloWorldSync.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Creating, getting, and deleting role assignments (Sync)
22

33
This sample demonstrates how to create, get, and delete role assignments in Azure Key Vault.
4-
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.
4+
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.
55

66
## Creating a KeyVaultAccessControlClient
77

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

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

39-
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.
39+
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.
4040
You can also get the object Id for your currently signed in account by running the following [Azure CLI][azure_cli] command.
4141
```
4242
az ad signed-in-user show --query objectId

sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample2_RbacScopeAssignment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ For information about interacting with a `KeyVaultKey` with a `KeyClient`, see t
77

88
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.
99

10-
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.
10+
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.
1111
You can also get the object Id for your currently signed in account by running the following [Azure CLI][azure_cli] command.
1212
```
1313
az ad signed-in-user show --query objectId

sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultAccessControlClient.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,17 +239,17 @@ public virtual AsyncPageable<KeyVaultRoleAssignment> GetRoleAssignmentsAsync(Key
239239
/// </summary>
240240
/// <param name="roleScope"> The scope of the role assignment to create. </param>
241241
/// <param name="properties"> Properties for the role assignment. </param>
242-
/// <param name="name">The Name used to create the role assignment.</param>
242+
/// <param name="name">Optional name used to create the role assignment. A new <see cref="Guid"/> will be generated if not specified.</param>
243243
/// <param name="cancellationToken"> The cancellation token to use. </param>
244244
/// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception>
245245
/// <exception cref="ArgumentNullException"><paramref name="roleScope"/> or <paramref name="properties"/> is null.</exception>
246-
public virtual Response<KeyVaultRoleAssignment> CreateRoleAssignment(KeyVaultRoleScope roleScope, KeyVaultRoleAssignmentProperties properties, Guid name = default, CancellationToken cancellationToken = default)
246+
public virtual Response<KeyVaultRoleAssignment> CreateRoleAssignment(KeyVaultRoleScope roleScope, KeyVaultRoleAssignmentProperties properties, Guid? name = null, CancellationToken cancellationToken = default)
247247
{
248248
using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultAccessControlClient)}.{nameof(CreateRoleAssignment)}");
249249
scope.Start();
250250
try
251251
{
252-
var _name = name == default ? Guid.NewGuid().ToString() : name.ToString();
252+
var _name = (name ?? Guid.NewGuid()).ToString();
253253
return _assignmentsRestClient.Create(VaultUri.AbsoluteUri, roleScope.ToString(), _name, new RoleAssignmentCreateParameters(properties), cancellationToken);
254254
}
255255
catch (Exception ex)
@@ -264,17 +264,17 @@ public virtual Response<KeyVaultRoleAssignment> CreateRoleAssignment(KeyVaultRol
264264
/// </summary>
265265
/// <param name="roleScope"> The scope of the role assignment to create. </param>
266266
/// <param name="properties"> Properties for the role assignment. </param>
267-
/// <param name="name">The name used to create the role assignment.</param>
267+
/// <param name="name">Optional name used to create the role assignment. A new <see cref="Guid"/> will be generated if not specified.</param>
268268
/// <param name="cancellationToken"> The cancellation token to use. </param>
269269
/// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception>
270270
/// <exception cref="ArgumentNullException"><paramref name="roleScope"/> or <paramref name="properties"/> is null.</exception>
271-
public virtual async Task<Response<KeyVaultRoleAssignment>> CreateRoleAssignmentAsync(KeyVaultRoleScope roleScope, KeyVaultRoleAssignmentProperties properties, Guid name = default, CancellationToken cancellationToken = default)
271+
public virtual async Task<Response<KeyVaultRoleAssignment>> CreateRoleAssignmentAsync(KeyVaultRoleScope roleScope, KeyVaultRoleAssignmentProperties properties, Guid? name = default, CancellationToken cancellationToken = default)
272272
{
273273
using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultAccessControlClient)}.{nameof(CreateRoleAssignment)}");
274274
scope.Start();
275275
try
276276
{
277-
var _name = name == default ? Guid.NewGuid().ToString() : name.ToString();
277+
var _name = (name ?? Guid.NewGuid()).ToString();
278278
return await _assignmentsRestClient.CreateAsync(VaultUri.AbsoluteUri, roleScope.ToString(), _name, new RoleAssignmentCreateParameters(properties), cancellationToken)
279279
.ConfigureAwait(false);
280280
}

0 commit comments

Comments
 (0)