GetExtension() public méthode

public GetExtension ( string extensionId ) : HostedServiceListExtensionsResponse.Extension
extensionId string
Résultat HostedServiceListExtensionsResponse.Extension
 public bool ExistDefault(string nameSpace, string type)
 {
     return(allRoles.Any(id =>
     {
         var e = extensionManager.GetExtension(id);
         return e != null && e.ProviderNamespace == nameSpace && e.Type == type;
     }));
 }
        /// <summary>
        /// The configuration must be defined in either allRoles or namedRoles.
        /// Otherwise, it will fail for trying to apply the same extension.
        /// We only apply the fix here but not in ExtensionManager, so other commands won't get affected.
        /// </summary>
        /// <param name="configInput">The configuration used for InstallExtension()</param>
        /// <param name="extConfig">The extension config after InstallExtension()</param>
        private Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration PostProcessExtensionConfigAfterInstallExtension(
            ExtensionConfigurationInput configInput,
            Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration extConfig)
        {
            ExtensionConfigurationBuilder builder = ExtensionManager.GetBuilder(extConfig);

            if (configInput.Roles.All(r => r.Default))
            {
                // If the configuration applies to all roles, remove the ones defined in each named roles
                foreach (var role in Deployment.Roles)
                {
                    builder.Remove(role.RoleName, ProviderNamespace, ExtensionName);
                }
            }
            else
            {
                // If the configuration applies to some specific roles and there is already extension defined in allRoles,
                // we remove the setting from allRoles and move it to specific namedRoles.
                if (builder.ExistDefault(ProviderNamespace, ExtensionName))
                {
                    var diagnosticExtensionId = extConfig.AllRoles.FirstOrDefault(ext =>
                    {
                        var e = ExtensionManager.GetExtension(ext.Id);
                        return(e != null && e.ProviderNamespace == ProviderNamespace && e.Type == ExtensionName);
                    }).Id;
                    builder.RemoveDefault(diagnosticExtensionId);

                    foreach (var role in Deployment.Roles)
                    {
                        // The role is previously configured by allRoles, move it to the namedRole itself
                        if (!configInput.Roles.Exists(r => r.RoleName == role.RoleName))
                        {
                            builder.Add(role.RoleName, diagnosticExtensionId);
                        }
                    }
                }
            }

            return(builder.ToConfiguration());
        }