public virtual SshPublicKeyCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string sshPublicKeyName, SshPublicKeyData parameters, CancellationToken cancellationToken = default) { if (sshPublicKeyName == null) { throw new ArgumentNullException(nameof(sshPublicKeyName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("SshPublicKeyCollection.CreateOrUpdate"); scope.Start(); try { var response = _sshPublicKeysRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, sshPublicKeyName, parameters, cancellationToken); var operation = new SshPublicKeyCreateOrUpdateOperation(this, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <SshPublicKey> CreateOrUpdate(bool waitForCompletion, string sshPublicKeyName, SshPublicKeyData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(sshPublicKeyName, nameof(sshPublicKeyName)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _sshPublicKeyClientDiagnostics.CreateScope("SshPublicKeyCollection.CreateOrUpdate"); scope.Start(); try { var response = _sshPublicKeyRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, sshPublicKeyName, parameters, cancellationToken); var operation = new ComputeArmOperation <SshPublicKey>(Response.FromValue(new SshPublicKey(Client, response), response.GetRawResponse())); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }