コード例 #1
0
 public Tss(
     Guid id,
     string description,
     TssState state,
     DateTime createdUtc,
     DateTime initializedUtc,
     DateTime disabledUtc,
     string certificate,
     string certificateSerial,
     string publicKey,
     int signatureCounter,
     string signatureAlgorithm,
     long transactionCounter)
 {
     Id                 = id;
     Description        = description;
     State              = state;
     CreatedUtc         = createdUtc;
     InitializedUtc     = initializedUtc;
     DisabledUtc        = disabledUtc;
     Certificate        = certificate;
     CertificateSerial  = certificateSerial;
     PublicKey          = publicKey;
     SignatureCounter   = signatureCounter;
     SignatureAlgorithm = signatureAlgorithm;
     TransactionCounter = transactionCounter;
 }
コード例 #2
0
 internal static Dto.UpdateTssRequest UpdateTss(TssState state)
 {
     return(new Dto.UpdateTssRequest
     {
         State = SerializeTssState(state)
     });
 }
コード例 #3
0
 internal static Dto.CreateTssRequest CreateTss(TssState state, string description = "")
 {
     return(new Dto.CreateTssRequest
     {
         Description = description,
         State = SerializeTssState(state)
     });
 }
コード例 #4
0
 private static Dto.TssState SerializeTssState(TssState state)
 {
     return(state.Match(
                TssState.Disabled, _ => Dto.TssState.DISABLED,
                TssState.Initialized, _ => Dto.TssState.INITIALIZED,
                TssState.Uninitialized, _ => Dto.TssState.UNINITIALIZED
                ));
 }
コード例 #5
0
 public Task <ResponseResult <Tss> > CreateTssAsync(AccessToken token, TssState state, string description = null)
 {
     return(Client.ProcessRequestAsync <Dto.CreateTssRequest, Dto.TssResponse, Tss>(
                method: HttpMethod.Put,
                endpoint: $"tss/{Guid.NewGuid()}",
                request: RequestCreator.CreateTss(state, description),
                successFunc: response => ModelMapper.MapTss(response),
                token: token
                ));
 }
コード例 #6
0
        public async Task <ResponseResult <Tss> > CreateTssAsync(AccessToken token, TssState state, string description = null)
        {
            var request = RequestCreator.CreateTss(state, description);

            return(await Client.ProcessRequestAsync <Dto.CreateTssRequest, Dto.TssResponse, Tss>(
                       method : HttpMethod.Put,
                       endpoint : $"tss/{Guid.NewGuid()}",
                       request : request,
                       successFunc : response => ModelMapper.MapTss(response),
                       token : token
                       ).ConfigureAwait(continueOnCapturedContext: false));
        }
コード例 #7
0
        private static Dto.TssState SerializeTssState(TssState state)
        {
            switch (state)
            {
            case TssState.Disabled:
                return(Dto.TssState.DISABLED);

            case TssState.Initialized:
                return(Dto.TssState.INITIALIZED);

            case TssState.Uninitialized:
                return(Dto.TssState.UNINITIALIZED);

            default:
                throw new NotImplementedException($"Tss state: {state} is not implemented.");
            }
            ;
        }
コード例 #8
0
        public async Task <ResponseResult <Tss> > UpdateTssAsync(AccessToken token, Guid tssId, TssState state)
        {
            var request = RequestCreator.UpdateTss(state);

            return(await Client.ProcessRequestAsync <Dto.UpdateTssRequest, Dto.TssResponse, Tss>(
                       method : HttpMethod.Put,
                       endpoint : $"tss/{tssId}",
                       request : request,
                       successFunc : response => ModelMapper.MapTss(response),
                       token : token
                       ).ConfigureAwait(continueOnCapturedContext: false));
        }
コード例 #9
0
 public Task <ResponseResult <Tss> > UpdateTssAsync(AccessToken token, Guid tssId, TssState state)
 {
     return(Client.ProcessRequestAsync <Dto.UpdateTssRequest, Dto.TssResponse, Tss>(
                method: HttpMethod.Put,
                endpoint: $"tss/{tssId}",
                request: RequestCreator.UpdateTss(state),
                successFunc: response => ModelMapper.MapTss(response),
                token: token
                ));
 }