private async Task <IWithPrivateImageRegistryOrVolume> Setup()
        {
            if (withPublicOrPrivateImageRegistry == null)
            {
                var mgr = await Authenticate();

                var a = mgr.ContainerGroups.Define(attribute.GroupName).WithRegion(Region.Create(this.attribute.AzureRegion)).WithExistingResourceGroup(attribute.AciResourceGroupName);
                IWithPublicOrPrivateImageRegistry o = null;
                if (attribute.OsType == "linux")
                {
                    o = a.WithLinux();
                }
                else
                {
                    o = a.WithWindows();
                }
                if (attribute is ContainerGroupWithPrivateRegistryAttribute)
                {
                    var registry = attribute as ContainerGroupWithPrivateRegistryAttribute;
                    withPublicOrPrivateImageRegistry = o.WithPrivateImageRegistry(registry.ImageRegistryServer, registry.ImageRegistryUser, registry.ImageRegistryPassword);
                }
                else
                {
                    withPublicOrPrivateImageRegistry = o.WithPublicImageRegistryOnly();
                }
            }
            return(withPublicOrPrivateImageRegistry);
        }
Example #2
0
        public static IWithPrivateImageRegistry WithRestartPolicy(this IWithPublicOrPrivateImageRegistry builder, string policy)
        {
            var impl = builder.GetType().GetProperty("Inner").GetValue(builder, null);
            var prop = impl.GetType().GetProperty("RestartPolicy");

            prop.SetValue(impl, policy);
            return(builder);
        }