/// <summary> /// Creates an instance of external child resource in-memory. /// </summary> /// <param name="serverKeyName">The name of this external child resource.</param> /// <param name="parent">Reference to the parent of this external child resource.</param> /// <param name="innerObject">Reference to the inner object representing this external child resource.</param> /// <param name="sqlServerManager">Reference to the SQL server manager that accesses firewall rule operations.</param> ///GENMHASH:8DC05BF94897E82ED9B14D4ACE761E71:385B5B4D5CE77CC6BDE66FA1392BE5E2 internal SqlServerKeyImpl(string serverKeyName, SqlServerImpl parent, ServerKeyInner innerObject, ISqlManager sqlServerManager) : base(innerObject, parent) { this.serverKeyName = serverKeyName; this.sqlServerManager = sqlServerManager; this.resourceGroupName = parent.ResourceGroupName; this.sqlServerName = parent.Name; if (innerObject != null && innerObject.Name != null) { this.serverKeyName = innerObject.Name; } }
/// <summary> /// Creates an instance of external child resource in-memory. /// </summary> /// <param name="serverKeyName">The name of this external child resource.</param> /// <param name="innerObject">Reference to the inner object representing this external child resource.</param> /// <param name="sqlServerManager">Reference to the SQL server manager that accesses firewall rule operations.</param> ///GENMHASH:137DAACD2261698E82334933A0868D1A:889083AF977CA8FF77804D3045E866B0 internal SqlServerKeyImpl(string serverKeyName, ServerKeyInner innerObject, ISqlManager sqlServerManager) : base(innerObject, null) { this.serverKeyName = serverKeyName; this.sqlServerManager = sqlServerManager; if (innerObject != null && innerObject.Id != null) { if (innerObject.Id != null) { ResourceId resourceId = ResourceId.FromString(innerObject.Id); this.resourceGroupName = resourceId.ResourceGroupName; this.sqlServerName = resourceId.Parent.Name; } } if (innerObject != null && innerObject.Name != null) { this.serverKeyName = innerObject.Name; } }
/// <summary> /// Creates or updates a server key. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group that contains the resource. You can obtain /// this value from the Azure Resource Manager API or the portal. /// </param> /// <param name='serverName'> /// The name of the server. /// </param> /// <param name='keyName'> /// The name of the server key to be operated on (updated or created). The key /// name is required to be in the format of 'vault_key_version'. For example, /// if the keyId is /// https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, /// then the server key name should be formatted as: /// YourVaultName_YourKeyName_01234567890123456789012345678901 /// </param> /// <param name='parameters'> /// The requested server key resource state. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ServerKeyInner> CreateOrUpdateAsync(this IServerKeysOperations operations, string resourceGroupName, string serverName, string keyName, ServerKeyInner parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, keyName, parameters, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Creates or updates a server key. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group that contains the resource. You can obtain /// this value from the Azure Resource Manager API or the portal. /// </param> /// <param name='serverName'> /// The name of the server. /// </param> /// <param name='keyName'> /// The name of the server key to be operated on (updated or created). The key /// name is required to be in the format of 'vault_key_version'. For example, /// if the keyId is /// https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, /// then the server key name should be formatted as: /// YourVaultName_YourKeyName_01234567890123456789012345678901 /// </param> /// <param name='parameters'> /// The requested server key resource state. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ServerKeyInner> BeginCreateOrUpdateAsync(this IServerKeysOperations operations, string resourceGroupName, string serverName, string keyName, ServerKeyInner parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, keyName, parameters, SqlManagementClient.SetJsonAcceptHeader(), cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }