コード例 #1
0
        private void RegisterProfileInternal(CredentialProfile profile)
        {
            var reservedProperties = new Dictionary <string, string>();

            if (profile.UniqueKey != null)
            {
                reservedProperties[ToolkitArtifactGuidField] = profile.UniqueKey.Value.ToString("D");
            }

            if (profile.Region != null)
            {
                reservedProperties[RegionField] = profile.Region.SystemName;
            }

            if (profile.EndpointDiscoveryEnabled != null)
            {
                reservedProperties[EndpointDiscoveryEnabledField] = profile.EndpointDiscoveryEnabled.Value.ToString().ToLowerInvariant();
            }

            var profileDictionary = PropertyMapping.CombineProfileParts(
                profile.Options, ReservedPropertyNames, reservedProperties, profile.Properties);

            credentialsFile.EditSection(profile.Name, new SortedDictionary <string, string>(profileDictionary));
            credentialsFile.Persist();
            profile.CredentialProfileStore = this;
        }
コード例 #2
0
        private void RegisterProfileInternal(CredentialProfile profile)
        {
            var reservedProperties = new Dictionary <string, string>();

            if (profile.UniqueKey != null)
            {
                reservedProperties[ToolkitArtifactGuidField] = profile.UniqueKey.Value.ToString("D");
            }

            if (profile.Region != null)
            {
                reservedProperties[RegionField] = profile.Region.SystemName;
            }

            if (profile.EndpointDiscoveryEnabled != null)
            {
                reservedProperties[EndpointDiscoveryEnabledField] = profile.EndpointDiscoveryEnabled.Value.ToString().ToLowerInvariant();
            }

            if (profile.StsRegionalEndpoints != null)
            {
                reservedProperties[StsRegionalEndpointsField] = profile.StsRegionalEndpoints.ToString().ToLowerInvariant();
            }

            if (profile.S3UseArnRegion != null)
            {
                reservedProperties[S3UseArnRegionField] = profile.S3UseArnRegion.Value.ToString().ToLowerInvariant();
            }

            if (profile.S3RegionalEndpoint != null)
            {
                reservedProperties[S3RegionalEndpointField] = profile.S3RegionalEndpoint.ToString().ToLowerInvariant();
            }

            if (profile.S3DisableMultiRegionAccessPoints != null)
            {
                reservedProperties[S3DisableMultiRegionAccessPointsField] = profile.S3DisableMultiRegionAccessPoints.ToString().ToLowerInvariant();
            }

            if (profile.RetryMode != null)
            {
                reservedProperties[RetryModeField] = profile.RetryMode.ToString().ToLowerInvariant();
            }

            if (profile.MaxAttempts != null)
            {
                reservedProperties[MaxAttemptsField] = profile.MaxAttempts.ToString().ToLowerInvariant();
            }

            if (profile.EC2MetadataServiceEndpoint != null)
            {
                reservedProperties[EC2MetadataServiceEndpointField] = profile.EC2MetadataServiceEndpoint.ToString().ToLowerInvariant();
            }

            if (profile.EC2MetadataServiceEndpointMode != null)
            {
                reservedProperties[EC2MetadataServiceEndpointModeField] = profile.EC2MetadataServiceEndpointMode.ToString().ToLowerInvariant();
            }

            if (profile.UseDualstackEndpoint != null)
            {
                reservedProperties[UseDualstackEndpointField] = profile.UseDualstackEndpoint.ToString().ToLowerInvariant();
            }

            if (profile.UseFIPSEndpoint != null)
            {
                reservedProperties[UseFIPSEndpointField] = profile.UseFIPSEndpoint.ToString().ToLowerInvariant();
            }

            var profileDictionary = PropertyMapping.CombineProfileParts(
                profile.Options, ReservedPropertyNames, reservedProperties, profile.Properties);

            _credentialsFile.EditSection(profile.Name, new SortedDictionary <string, string>(profileDictionary));
            _credentialsFile.Persist();
            profile.CredentialProfileStore = this;
        }