Esempio n. 1
0
 internal ManagedEnvironmentStorageResource(ArmClient client, ManagedEnvironmentStorageData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }
        public virtual async Task <ArmOperation <ManagedEnvironmentStorageResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string name, ManagedEnvironmentStorageData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(name, nameof(name));
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _managedEnvironmentStorageManagedEnvironmentsStoragesClientDiagnostics.CreateScope("ManagedEnvironmentStorageCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _managedEnvironmentStorageManagedEnvironmentsStoragesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken).ConfigureAwait(false);

                var operation = new ContainersArmOperation <ManagedEnvironmentStorageResource>(Response.FromValue(new ManagedEnvironmentStorageResource(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Esempio n. 3
0
        public virtual ArmOperation <ManagedEnvironmentStorageResource> Update(WaitUntil waitUntil, ManagedEnvironmentStorageData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _managedEnvironmentStorageManagedEnvironmentsStoragesClientDiagnostics.CreateScope("ManagedEnvironmentStorageResource.Update");
            scope.Start();
            try
            {
                var response  = _managedEnvironmentStorageManagedEnvironmentsStoragesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken);
                var operation = new ContainersArmOperation <ManagedEnvironmentStorageResource>(Response.FromValue(new ManagedEnvironmentStorageResource(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }