public Registry UpdateRegistry( string resourceGroupName, string registryName, bool?adminUserEnabled, string sku = null, string storageAccountId = null, PSNetworkRuleSet networkRuleSet = null, IDictionary <string, string> tags = null) { var parameters = new RegistryUpdateParameters() { AdminUserEnabled = adminUserEnabled }; if (sku != null) { parameters.Sku = new Management.ContainerRegistry.Models.Sku(sku); } if (tags != null) { parameters.Tags = tags; } if (networkRuleSet != null) { parameters.NetworkRuleSet = networkRuleSet.GetNetworkRuleSet(); } return(_client.Registries.Update(resourceGroupName, registryName, parameters)); }
public void ContainerRegistrySystemData() { var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; using (MockContext context = MockContext.Start(this.GetType())) { var resourceClient = ContainerRegistryTestUtilities.GetResourceManagementClient(context, handler); var registryClient = ContainerRegistryTestUtilities.GetContainerRegistryManagementClient(context, handler); // Create resource group var resourceGroup = ContainerRegistryTestUtilities.CreateResourceGroup(resourceClient); // Create container registry var registry = ContainerRegistryTestUtilities.CreateManagedContainerRegistry(registryClient, resourceGroup.Name, resourceGroup.Location); // Validate registry system data properties var cachedSystemData = registry.SystemData; ValidateSystemData(cachedSystemData); // Apply SKU update var parameters = new RegistryUpdateParameters() { Sku = new Sku() { Name = SkuName.Standard } }; registry = registryClient.Registries.Update(resourceGroup.Name, registry.Name, parameters); // Validate updated registry system data properties ValidateSystemData(registry.SystemData); // Validate system data create properties Assert.Equal(cachedSystemData.CreatedAt, registry.SystemData.CreatedAt); Assert.Equal(cachedSystemData.CreatedBy, registry.SystemData.CreatedBy); Assert.Equal(cachedSystemData.CreatedByType, registry.SystemData.CreatedByType); // Validate system data update properties Assert.NotEqual(cachedSystemData.LastModifiedAt, registry.SystemData.LastModifiedAt); Assert.Equal(cachedSystemData.LastModifiedBy, registry.SystemData.LastModifiedBy); Assert.Equal(cachedSystemData.LastModifiedByType, registry.SystemData.LastModifiedByType); void ValidateSystemData(SystemData systemData) { Assert.NotNull(systemData); Assert.NotNull(systemData.CreatedAt); Assert.NotNull(systemData.CreatedBy); Assert.NotNull(systemData.CreatedByType); Assert.NotNull(systemData.LastModifiedAt); Assert.NotNull(systemData.LastModifiedBy); Assert.NotNull(systemData.LastModifiedByType); } } }
public Registry UpdateRegistry( string resourceGroupName, string registryName, bool?adminUserEnabled, string storageAccountName = null, string storageAccountResourceGroup = null, IDictionary <string, string> tags = null) { var parameters = new RegistryUpdateParameters() { AdminUserEnabled = adminUserEnabled }; if (storageAccountName != null) { if (storageAccountResourceGroup == null) { throw new ArgumentNullException("Storage account resource group cannot be null."); } var storageAccountAccessKey = GetStorageAccountAccessKey(storageAccountResourceGroup, storageAccountName); parameters.StorageAccount = new StorageAccountParameters() { Name = storageAccountName, AccessKey = storageAccountAccessKey }; } if (tags != null) { parameters.Tags = tags; } return(_client.Registries.Update(resourceGroupName, registryName, parameters)); }
/// <summary> /// Updates a container registry with the specified parameters. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group to which the container registry belongs. /// </param> /// <param name='registryName'> /// The name of the container registry. /// </param> /// <param name='registryUpdateParameters'> /// The parameters for updating a container registry. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async System.Threading.Tasks.Task <Registry> BeginUpdateAsync(this IRegistriesOperations operations, string resourceGroupName, string registryName, RegistryUpdateParameters registryUpdateParameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, registryName, registryUpdateParameters, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Updates a container registry with the specified parameters. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group to which the container registry belongs. /// </param> /// <param name='registryName'> /// The name of the container registry. /// </param> /// <param name='registryUpdateParameters'> /// The parameters for updating a container registry. /// </param> public static Registry BeginUpdate(this IRegistriesOperations operations, string resourceGroupName, string registryName, RegistryUpdateParameters registryUpdateParameters) { return(operations.BeginUpdateAsync(resourceGroupName, registryName, registryUpdateParameters).GetAwaiter().GetResult()); }