internal static unsafe ContainerDescription CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, "ContainerActivationArgs.CreateFromNative() has null pointer."); var nativeDescription = *((NativeTypes.FABRIC_CONTAINER_DESCRIPTION *)nativePtr); var containerDescription = new ContainerDescription { ApplicationName = NativeTypes.FromNativeString(nativeDescription.ApplicationName), ServiceName = NativeTypes.FromNativeString(nativeDescription.ServiceName), ApplicationId = NativeTypes.FromNativeString(nativeDescription.ApplicationId), ContainerName = NativeTypes.FromNativeString(nativeDescription.ContainerName), DeploymentFolder = NativeTypes.FromNativeString(nativeDescription.DeploymentFolder), NodeWorkFolder = NativeTypes.FromNativeString(nativeDescription.NodeWorkFolder), EntryPoint = NativeTypes.FromNativeString(nativeDescription.EntryPoint), HostName = NativeTypes.FromNativeString(nativeDescription.HostName), GroupContainerName = NativeTypes.FromNativeString(nativeDescription.GroupContainerName), IsolationMode = InteropHelpers.FromNativeContainerIsolationMode(nativeDescription.IsolationMode), PortBindings = NativeTypes.FromNativeStringPairList(nativeDescription.PortBindings), LogConfig = ContainerLogConfigDescription.CreateFromNative(nativeDescription.LogConfig), Volumes = ContainerVolumeDescription.CreateFromNative(nativeDescription.Volumes), DnsServers = NativeTypes.FromNativeStringList(nativeDescription.DnsServers), SecurityOptions = NativeTypes.FromNativeStringList(nativeDescription.SecurityOptions), RepositoryCredential = RepositoryCredentialDescription.CreateFromNative(nativeDescription.RepositoryCredential), HealthConfig = ContainerHealthConfigDescription.CreateFromNative(nativeDescription.HealthConfig), AutoRemove = NativeTypes.FromBOOLEAN(nativeDescription.AutoRemove), RunInteractive = NativeTypes.FromBOOLEAN(nativeDescription.RunInteractive), IsContainerRoot = NativeTypes.FromBOOLEAN(nativeDescription.IsContainerRoot), CodePackageName = NativeTypes.FromNativeString(nativeDescription.CodePackageName), ServicePackageActivationId = NativeTypes.FromNativeString(nativeDescription.ServicePackageActivationId), PartitionId = NativeTypes.FromNativeString(nativeDescription.PartitionId), }; if (nativeDescription.Reserved != null) { var nativeContainerDescriptionEx1 = *((NativeTypes.FABRIC_CONTAINER_DESCRIPTION_EX1 *)nativeDescription.Reserved); containerDescription.UseDefaultRepositoryCredentials = NativeTypes.FromBOOLEAN(nativeContainerDescriptionEx1.UseDefaultRepositoryCredentials); containerDescription.Labels = ContainerLabelDescription.CreateFromNative(nativeContainerDescriptionEx1.Labels); containerDescription.RemoveServiceFabricRuntimeAccess = NativeTypes.FromBOOLEAN(nativeContainerDescriptionEx1.RemoveServiceFabricRuntimeAccess); containerDescription.BindMounts = NativeTypes.FromNativeStringPairList(nativeContainerDescriptionEx1.BindMounts); if (nativeContainerDescriptionEx1.Reserved != null) { var nativeContainerDescriptionEx2 = *((NativeTypes.FABRIC_CONTAINER_DESCRIPTION_EX2 *)nativeContainerDescriptionEx1.Reserved); containerDescription.UseTokenAuthenticationCredentials = NativeTypes.FromBOOLEAN(nativeContainerDescriptionEx2.UseTokenAuthenticationCredentials); if (nativeContainerDescriptionEx2.Reserved != null) { var nativeContainerDescriptionEx3 = *((NativeTypes.FABRIC_CONTAINER_DESCRIPTION_EX3 *)nativeContainerDescriptionEx2.Reserved); containerDescription.ContainerNetworkConfig = ContainerNetworkConfigDescription.CreateFromNative(nativeContainerDescriptionEx3.ContainerNetworkConfigDescription); } } } return(containerDescription); }
internal static unsafe ContainerImageDescription CreateFromNative( NativeTypes.FABRIC_CONTAINER_IMAGE_DESCRIPTION nativeDescription) { var containerImageDescription = new ContainerImageDescription { ImageName = NativeTypes.FromNativeString(nativeDescription.ImageName), RepositoryCredential = RepositoryCredentialDescription.CreateFromNative(nativeDescription.RepositoryCredential), }; if (nativeDescription.Reserved != null) { var nativeParametersEx1 = *((NativeTypes.FABRIC_CONTAINER_IMAGE_DESCRIPTION_EX1 *)nativeDescription.Reserved); containerImageDescription.UseDefaultRepositoryCredentials = NativeTypes.FromBOOLEAN(nativeParametersEx1.UseDefaultRepositoryCredentials); if (nativeParametersEx1.Reserved != null) { var nativeParametersEx2 = *((NativeTypes.FABRIC_CONTAINER_IMAGE_DESCRIPTION_EX2 *)nativeParametersEx1.Reserved); containerImageDescription.UseTokenAuthenticationCredentials = NativeTypes.FromBOOLEAN(nativeParametersEx2.UseTokenAuthenticationCredentials); } } return(containerImageDescription); }
internal static unsafe RepositoryCredentialDescription CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot( nativePtr != IntPtr.Zero, "RepositoryCredentialDescription.CreateFromNative() has null pointer."); var nativeCredential = *((NativeTypes.FABRIC_REPOSITORY_CREDENTIAL_DESCRIPTION *)nativePtr); var repositoryCredentials = new RepositoryCredentialDescription { AccountName = NativeTypes.FromNativeString(nativeCredential.AccountName), Password = NativeTypes.FromNativeString(nativeCredential.Password), Email = NativeTypes.FromNativeString(nativeCredential.Email), IsPasswordEncrypted = NativeTypes.FromBOOLEAN(nativeCredential.IsPasswordEncrypted) }; if (nativeCredential.Reserved != null) { var nativeParametersEx1 = *((NativeTypes.FABRIC_REPOSITORY_CREDENTIAL_DESCRIPTION_EX1 *)nativeCredential.Reserved); repositoryCredentials.Type = NativeTypes.FromNativeString(nativeParametersEx1.Type); } return(repositoryCredentials); }