Exemplo n.º 1
0
 private void SortOvfSectionsAndReferences_v1_5()
 {
     if (this.Resource.Items == null)
     {
         return;
     }
     foreach (Section_Type sectionType in this.Resource.Items)
     {
         if (sectionType is NetworkConfigSectionType)
         {
             this._networkConfigSection = (NetworkConfigSectionType)sectionType;
         }
         else if (sectionType is NetworkSection_Type)
         {
             this._networkSection = (NetworkSection_Type)sectionType;
         }
         else if (sectionType is LeaseSettingsSectionType)
         {
             this._leaseSettingsSection = (LeaseSettingsSectionType)sectionType;
         }
         else if (sectionType is StartupSection_Type)
         {
             this._startupSection = (StartupSection_Type)sectionType;
         }
         Logger.Log(TraceLevel.Information, sectionType.GetType().Name);
     }
     if (this.Resource.Link == null)
     {
         return;
     }
     foreach (LinkType linkType in this.Resource.Link)
     {
         if (this._vdcReference != null)
         {
             break;
         }
         if (linkType.rel != null && linkType.type != null)
         {
             if (linkType.rel.Equals("up") && linkType.type.Equals("application/vnd.vmware.vcloud.vdc+xml"))
             {
                 this._vdcReference = (ReferenceType)linkType;
             }
             else if (linkType.rel.Equals("down") && linkType.type.Equals("application/vnd.vmware.vcloud.vAppNetwork+xml"))
             {
                 this._vappNetworkRefsByName.Add(linkType.name, (ReferenceType)linkType);
             }
         }
     }
 }
Exemplo n.º 2
0
 private void SortOvfSectionAndReferences_v1_5()
 {
     if (this.Resource.Items != null)
     {
         foreach (Section_Type sectionType in this.Resource.Items)
         {
             if (sectionType is NetworkConfigSectionType)
             {
                 this._networkConfigSection = (NetworkConfigSectionType)sectionType;
             }
             else if (sectionType is NetworkSection_Type)
             {
                 this._networkSection = (NetworkSection_Type)sectionType;
             }
             else if (sectionType is NetworkConnectionSectionType)
             {
                 this._networkConnectionSection = (NetworkConnectionSectionType)sectionType;
             }
             else if (sectionType is LeaseSettingsSectionType)
             {
                 this._leaseSettingsSection = (LeaseSettingsSectionType)sectionType;
             }
             else if (sectionType is CustomizationSectionType)
             {
                 this._customizationSection = (CustomizationSectionType)sectionType;
             }
             else if (sectionType is GuestCustomizationSectionType)
             {
                 this._guestCustomizationSection = (GuestCustomizationSectionType)sectionType;
             }
             else if (sectionType is ProductSection_Type)
             {
                 this._productSections.Add((ProductSection_Type)sectionType);
             }
             Logger.Log(TraceLevel.Information, sectionType.GetType().Name);
         }
     }
     if (this.Resource.Link != null)
     {
         foreach (LinkType linkType in this.Resource.Link)
         {
             if (this._parentVappTemplateReference == null || this._catalogItemReference == null || this._vdcReference == null)
             {
                 if (linkType.rel.Equals("up") && linkType.type.Equals("application/vnd.vmware.vcloud.vAppTemplate+xml"))
                 {
                     this._parentVappTemplateReference = (ReferenceType)linkType;
                 }
                 else if (linkType.rel.Equals("catalogItem") && linkType.type.Equals("application/vnd.vmware.vcloud.catalogItem+xml"))
                 {
                     this._catalogItemReference = (ReferenceType)linkType;
                 }
                 else if (linkType.rel.Equals("up") && linkType.type.Equals("application/vnd.vmware.vcloud.vdc+xml"))
                 {
                     this._vdcReference = (ReferenceType)linkType;
                 }
                 else if (linkType.rel.Equals("storageProfile") && linkType.type.Equals("application/vnd.vmware.vcloud.vdcStorageProfile+xml"))
                 {
                     this._storageProfileRef = (ReferenceType)linkType;
                 }
             }
             else
             {
                 break;
             }
         }
     }
     if (this.Resource == null || this.Resource.VCloudExtension == null)
     {
         return;
     }
     foreach (VCloudExtensionType vcloudExtensionType in this.Resource.VCloudExtension)
     {
         if (vcloudExtensionType.Any != null)
         {
             XmlElement[] any   = vcloudExtensionType.Any;
             int          index = 0;
             if (index < any.Length)
             {
                 this.vmVimInfoType = Response.GetResource <VmVimInfoType>(any[index].OuterXml);
             }
         }
     }
 }