internal CreateMountTargetResponse CreateMountTarget(CreateMountTargetRequest request) { var marshaller = new CreateMountTargetRequestMarshaller(); var unmarshaller = CreateMountTargetResponseUnmarshaller.Instance; return(Invoke <CreateMountTargetRequest, CreateMountTargetResponse>(request, marshaller, unmarshaller)); }
/// <summary> /// Initiates the asynchronous execution of the CreateMountTarget operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateMountTarget operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task <CreateMountTargetResponse> CreateMountTargetAsync(CreateMountTargetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateMountTargetRequestMarshaller(); var unmarshaller = CreateMountTargetResponseUnmarshaller.Instance; return(InvokeAsync <CreateMountTargetRequest, CreateMountTargetResponse>(request, marshaller, unmarshaller, cancellationToken)); }
/** * Creates a mount target and waits for it to become available. We recommend to retry these requests * so that if you receive a timeout or server error and you won't run into the risk of creating multiple resources. * * This creates a mount target WITHOUT specifying a hostname. This means that the mount target will only be accessible * via its private IP address. * * @param fsClient the service client to use to create the mount target * @param vcnClient a client used to communiate with the Virtual Networking service * @param compartmentId the OCID of the compartment where the file system will be created * @param displayName the display name of the mount target * @param availabilityDomain the availability domain where the file system will be created * @param subnet the subnet where the mount target will reside. If no private IP address is explicitly specified at * creation time then the mount target will be assigned a free private IP address from the subnet * * @return the created mount target */ private static async Task <MountTarget> CreateMountTarget(FileStorageClient fsClient, VirtualNetworkClient vcnClient, string compartmentId, string displayName, AvailabilityDomain availabilityDomain, Subnet subnet) { logger.Info("Creating mount target......"); CreateMountTargetDetails createDetails = new CreateMountTargetDetails { AvailabilityDomain = availabilityDomain.Name, SubnetId = subnet.Id, CompartmentId = compartmentId, DisplayName = displayName }; CreateMountTargetRequest createRequest = new CreateMountTargetRequest { CreateMountTargetDetails = createDetails }; var retryConfiguration = new RetryConfiguration { MaxAttempts = 5 }; CreateMountTargetResponse createResponse = await fsClient.CreateMountTarget(createRequest, retryConfiguration); logger.Info($"Created Mount target: {createResponse.MountTarget.DisplayName}"); logger.Info("Waiting for mount target to become available"); GetMountTargetRequest getRequest = new GetMountTargetRequest { MountTargetId = createResponse.MountTarget.Id }; GetMountTargetResponse getResponse = fsClient.Waiters.ForMountTarget(getRequest, MountTarget.LifecycleStateEnum.Active).Execute(); logger.Info($"Mount target state: {getResponse.MountTarget.LifecycleState}"); string mountTargetPrivateIpId = getResponse.MountTarget.PrivateIpIds[0]; GetPrivateIpRequest getPrivateIpRequest = new GetPrivateIpRequest { PrivateIpId = mountTargetPrivateIpId }; GetPrivateIpResponse getPrivateIpResponse = await vcnClient.GetPrivateIp(getPrivateIpRequest); logger.Info($"Mount target private IP: {getPrivateIpResponse.PrivateIp.IpAddress}"); return(getResponse.MountTarget); }
protected override void ProcessRecord() { base.ProcessRecord(); CreateMountTargetRequest request; try { request = new CreateMountTargetRequest { CreateMountTargetDetails = CreateMountTargetDetails, OpcRetryToken = OpcRetryToken, OpcRequestId = OpcRequestId }; response = client.CreateMountTarget(request).GetAwaiter().GetResult(); WriteOutput(response, response.MountTarget); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// - 为一个文件系统创建一个挂载目标。通过这个挂载目标,你可以挂载将一个文件系统挂载到主机实例上。 /// - 创建一个挂载目标,为这个挂载目标分配一个Id /// /// </summary> /// <param name="request">请求参数信息</param> /// <returns>请求结果信息</returns> public async Task <CreateMountTargetResponse> CreateMountTarget(CreateMountTargetRequest request) { return(await new CreateMountTargetExecutor().Client(this).Execute <CreateMountTargetResponse, CreateMountTargetResult, CreateMountTargetRequest>(request).ConfigureAwait(false)); }
/// <summary> /// - 为一个文件系统创建一个挂载目标。通过这个挂载目标,你可以挂载将一个文件系统挂载到主机实例上。 /// - 创建一个挂载目标,为这个挂载目标分配一个Id /// /// </summary> /// <param name="request">请求参数信息</param> /// <returns>请求结果信息</returns> public CreateMountTargetResponse CreateMountTarget(CreateMountTargetRequest request) { return(new CreateMountTargetExecutor().Client(this).Execute <CreateMountTargetResponse, CreateMountTargetResult, CreateMountTargetRequest>(request)); }