public static CredentialProfileOptions GetRandomOptions(CredentialProfileType profileType)
 {
     CredentialProfileOptions options = new CredentialProfileOptions();
     foreach (var propertyName in CredentialProfileTypeDetector.GetPropertiesForProfileType(profileType))
     {
         typeof(CredentialProfileOptions).GetProperty(propertyName).SetValue(options, Guid.NewGuid().ToString());
     }
     return options;
 }
 public static CredentialProfile GetRandomProfile(string profileName, CredentialProfileType profileType)
 {
     return(GetCredentialProfile(
                uniqueKey: Guid.NewGuid(),
                profileName: profileName,
                options: GetRandomOptions(profileType),
                properties: GetRandomProperties(),
                defaultConfigurationModeName: null,
                region: GetRandomRegion(),
                endpointDiscoveryEnabled: null,
                retryMode: null,
                maxAttempts: null));
 }
 public static HashSet <string> GetPropertiesForProfileType(CredentialProfileType profileType)
 {
     return(new HashSet <string>(TypePropertyDictionary[profileType]));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Set the ProfileType field to maintain backward compatibility with ProfileManager.
        /// The value is ignored when it's read back in.
        /// </summary>
        /// <param name="properties"></param>
        /// <param name="profileType"></param>
        private static void SetProfileTypeField(IDictionary <string, string> properties, CredentialProfileType profileType)
        {
            switch (profileType)
            {
            case CredentialProfileType.Basic:
                properties[SettingsConstants.ProfileTypeField] = AWSCredentialsProfileType;
                break;

#if !NETSTANDARD13
            case CredentialProfileType.SAMLRole:
            case CredentialProfileType.SAMLRoleUserIdentity:
                properties[SettingsConstants.ProfileTypeField] = SAMLRoleProfileType;
                break;
#endif
            default:
                properties[SettingsConstants.ProfileTypeField] = profileType.ToString();
                break;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Set the ProfileType field to maintain backward compatibility with ProfileManager.
        /// The value is ignored when it's read back in.
        /// </summary>
        /// <param name="properties"></param>
        /// <param name="profileType"></param>
        private static void SetProfileTypeField(Dictionary <string, string> properties, CredentialProfileType profileType)
        {
            if (profileType == CredentialProfileType.Basic)
            {
                properties[SettingsConstants.ProfileTypeField] = AWSCredentialsProfileType;
            }
#if BCL
            else if (profileType == CredentialProfileType.SAMLRole ||
                     profileType == CredentialProfileType.SAMLRoleUserIdentity)
            {
                properties[SettingsConstants.ProfileTypeField] = SAMLRoleProfileType;
            }
#endif
            else
            {
                properties[SettingsConstants.ProfileTypeField] = profileType.ToString();
            }
        }
 public static CredentialProfile GetRandomProfile(string profileName, CredentialProfileType profileType)
 {
     return(GetCredentialProfile(Guid.NewGuid(), profileName, GetRandomOptions(profileType), GetRandomProperties(), GetRandomRegion()));
 }