예제 #1
0
        public ManagedServiceIdentityType FindIdentity(string identityType)
        {
            ManagedServiceIdentityType Type = ManagedServiceIdentityType.None;

            if (identityType == SystemAssigned)
            {
                Type = ManagedServiceIdentityType.SystemAssigned;
            }

            else if (identityType == UserAssigned)
            {
                Type = ManagedServiceIdentityType.UserAssigned;
            }

            else if (identityType == SystemAssignedUserAssigned)
            {
                Type = ManagedServiceIdentityType.SystemAssignedUserAssigned;
            }

            else if (identityType == None)
            {
                Type = ManagedServiceIdentityType.None;
            }

            return(Type);
        }
예제 #2
0
        /// <summary>
        /// Initialize VM's identity property.
        /// </summary>
        /// <param name="identityType">The identity type to set.</param>
        private void InitSiteIdentity(ManagedServiceIdentityType identityType)
        {
            if (!identityType.Equals(ManagedServiceIdentityType.UserAssigned) &&
                !identityType.Equals(ManagedServiceIdentityType.SystemAssigned))
            {
                throw new ArgumentException("Invalid argument: " + identityType);
            }

            SiteInner siteInner = this.webAppBaseImpl.Inner;

            if (siteInner.Identity == null)
            {
                siteInner.Identity = new ManagedServiceIdentity();
            }

            if (siteInner.Identity.Type == null ||
                siteInner.Identity.Type.Equals(ManagedServiceIdentityType.None) ||
                siteInner.Identity.Type.Equals(identityType))
            {
                siteInner.Identity.Type = identityType;
            }
            else
            {
                siteInner.Identity.Type = ManagedServiceIdentityType.SystemAssignedUserAssigned;
            }
        }
예제 #3
0
        internal static string ToSerializedValue(this ManagedServiceIdentityType value)
        {
            switch (value)
            {
            case ManagedServiceIdentityType.SystemAssigned:
                return("SystemAssigned");

            case ManagedServiceIdentityType.UserAssigned:
                return("UserAssigned");

            case ManagedServiceIdentityType.SystemAssignedUserAssigned:
                return("SystemAssigned, UserAssigned");

            case ManagedServiceIdentityType.None:
                return("None");
            }
            return(null);
        }
 public static string ToSerialString(this ManagedServiceIdentityType value) => value switch
 {
예제 #5
0
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param>
 /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param>
 /// <param name="formatProvider">not used by this TypeConverter.</param>
 /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param>
 /// <returns>
 /// an instance of <see cref="ManagedServiceIdentityType" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ManagedServiceIdentityType.CreateFrom(sourceValue);