/* ============================================================================
Copyright 2014 Hewlett Packard
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
============================================================================ */
using System.Collections.Generic;
using Openstack.Client.Powershell.Providers.Common;
using Openstack.Objects.Domain.Networking;
namespace Openstack.Client.Powershell.Providers.Networking
{
// [RequiredServiceIdentifierAttribute("Openstack-ComputeDrive")]
public class NetworksUIContainer : BaseUIContainer
{
//=========================================================================================================
///
///
///
///
///
///
//=========================================================================================================
public NetworksUIContainer() { }
//=========================================================================================================
///
///
///
///
///
///
//=========================================================================================================
public NetworksUIContainer(BaseUIContainer parentContainer,
string name,
string description,
string path)
: base(parentContainer, name, description, path)
{
this.ObjectType = Common.ObjectType.Container;
}
#region Methods
//=========================================================================================================
///
///
///
//=========================================================================================================
public override void Load()
{
this.LoadEntities();
this.LoadContainers();
}
//=========================================================================================================
///
///
///
///
///
//=========================================================================================================
private void LoadEntities()
{
List networks = this.RepositoryFactory.CreateNetworkRepository().GetNetworks();
if (networks != null && networks.Count > 0)
{
this.SetUIContainers(networks);
this.Entities = networks;
}
else
{
this.Containers.Clear();
this.Entities.Clear();
}
}
//=========================================================================================================
///
///
///
///
//=========================================================================================================
private void LoadContainers()
{
this.AddContainer(this.CreateContainer("Subnets", "All Subnets assocated with the Account.", "Subnets"));
this.AddContainer(this.CreateContainer("Ports", "All Ports associated with the Account", "Ports"));
this.AddContainer(this.CreateContainer("FloatingIPs", "All Floating IPs associated with the Account", "FloatingIPs"));
this.AddContainer(this.CreateContainer("Routers", "All Routers associated with the Account", "Routers"));
}
//=========================================================================================================
///
///
///
///
///
//=========================================================================================================
public override BaseUIContainer CreateContainer(string id)
{
return null;
}
#endregion
}
}