private void InitContainerGroupIdentity(ResourceIdentityType identityType)
        {
            if (identityType != ResourceIdentityType.UserAssigned && identityType != ResourceIdentityType.SystemAssigned)
            {
                throw new ArgumentException("Invalid argument: " + identityType);
            }

            ContainerGroupInner containerGroupInner = this.containerGroup.Inner;

            if (containerGroupInner.Identity == null)
            {
                containerGroupInner.Identity = new ContainerGroupIdentity();
            }

            if (containerGroupInner.Identity.Type == null ||
                containerGroupInner.Identity.Type == ResourceIdentityType.None ||
                containerGroupInner.Identity.Type == identityType)
            {
                containerGroupInner.Identity.Type = identityType;
            }
            else
            {
                containerGroupInner.Identity.Type = ResourceIdentityType.SystemAssignedUserAssigned;
            }
        }
Esempio n. 2
0
 ///GENMHASH:C4B69D63304D818F517794AA4D07AAC6:C2773B13EB9D03F0091114E1241E51EB
 internal ContainerGroupImpl(string name, ContainerGroupInner innerObject, IContainerInstanceManager manager, IStorageManager storageManager)
     : base(name, innerObject, manager)
 {
     this.storageManager = storageManager;
     if (innerObject != null)
     {
         this.InitializeChildrenFromInner();
     }
 }
Esempio n. 3
0
        protected async Task <IContainerGroup> WrapModelForListAsync(ContainerGroupInner inner, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (inner != null)
            {
                var result = new ContainerGroupImpl(inner.Name, inner, this.Manager, this.storageManager);

                return(await result.RefreshAsync(cancellationToken));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
 ///GENMHASH:1B8C0DFED1520223EC9FC70DFE54F8AF:249E41BD7DC18164687B92988001D319
 protected override IContainerGroup WrapModel(ContainerGroupInner inner)
 {
     return(inner != null ? new ContainerGroupImpl(inner.Name, inner, this.Manager, this.storageManager) : null);
 }
 /// <summary>
 /// Create or update container groups.
 /// </summary>
 /// <remarks>
 /// Create or update container groups with specified configurations.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='containerGroupName'>
 /// The name of the container group.
 /// </param>
 /// <param name='containerGroup'>
 /// The properties of the container group to be created or updated.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ContainerGroupInner> CreateOrUpdateAsync(this IContainerGroupsOperations operations, string resourceGroupName, string containerGroupName, ContainerGroupInner containerGroup, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, containerGroupName, containerGroup, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }