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), AssignedIp = NativeTypes.FromNativeString(nativeDescription.AssignedIp), 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); } } return(containerDescription); }
internal static unsafe ContainerActivationArgs CreateFromNative(IntPtr nativePtr) { ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, "ContainerActivationArgs.CreateFromNative() has null pointer."); var nativeArgs = *((NativeTypes.FABRIC_CONTAINER_ACTIVATION_ARGS *)nativePtr); return(new ContainerActivationArgs { IsUserLocalSystem = NativeTypes.FromBOOLEAN(nativeArgs.IsUserLocalSystem), AppHostId = NativeTypes.FromNativeString(nativeArgs.AppHostId), NodeId = NativeTypes.FromNativeString(nativeArgs.NodeId), ContainerDescription = ContainerDescription.CreateFromNative(nativeArgs.ContainerDescription), ProcessDescription = ProcessDescription.CreateFromNative(nativeArgs.ProcessDescription), FabricBinPath = NativeTypes.FromNativeString(nativeArgs.FabricBinPath), GatewayIpAddress = NativeTypes.FromNativeString(nativeArgs.GatewayIpAddress) }); }