ScopeSpecification.IsApplicableTo() removed in 3.4 - is there a replacement?

In our code, we have a construct like this, that takes an IEnumerable<VariableResource> and tries to figure out which one is applicable given a specific environment:

var environmentId = "Environment-3"; // input to the function
var variables = GetAllVariablesForProject(); // fetches all project variables and all variables
                                             // from linked library sets, and concats the lists
var scope = new Dictionary<ScopeField, ScopeValue>
{
    { ScopeField.Environment, new ScopeValue(environmentId) }
};

return variables
    .Where(variable => variable.Scope.IsApplicableTo(scope))
    .GroupBy(variable => variable.Name)
    .Select(group => group.OrderByDescending(variable => variable.Scope.Rank()).First())
    .ToDictionary(variable => variable.Name, variable => variable.Value);

However, it seems ScopeSpecification.IsApplicableTo was removed in Octopus.Client 3.4.0. Is the functionality implemented somewhere else instead?

Hi Tomas,

Thanks for getting in touch!

It looks like it was moved out of Octopus.Client and I can’t see that we’ve implemented it elsewhere that is available to you as a user, I’ll bring it up with the team tomorrow and see what the reasoning behind it was and if we can add it back in to Octopus.Client

I’m sorry for the inconvenience caused by this.

Thank you and best regards,
Henrik

Hi, I have the same problem. Is there any solution?

Hi,

I’ve raised #2845 to have this functionality re-introduced into Octopus.Client as soon as we can.

My apologies for the inconvenience caused!

Thank you and warm regards,
Henrik

Hi,

The logic that used to be ScopeSpecification has moved to ScopeScenario. The methods are: Excludes instead of IsExcludedBy and AppliesTo instead of IsApplicableTo.

Cheers,
Shane