@@ -978,25 +978,100 @@ public virtual async Task<TPage> ListImageDetailsAsync<TPage>(Url url, Cancellat
978978
979979 #region Keypairs
980980
981+ /// <summary />
982+ public virtual async Task < T > GetKeyPairAsync < T > ( string keypairName , CancellationToken cancellationToken = default ( CancellationToken ) )
983+ where T : IServiceResource
984+ {
985+ if ( keypairName == null )
986+ throw new ArgumentNullException ( "keypairName" ) ;
987+
988+ PreparedRequest request = await BuildGetKeyPairRequestAsync ( keypairName , cancellationToken ) ;
989+
990+ var result = await request . SendAsync ( ) . ReceiveJson < T > ( ) ;
991+ result . PropogateOwner ( this ) ;
992+ return result ;
993+ }
994+
995+ /// <summary />
996+ public virtual async Task < PreparedRequest > BuildGetKeyPairRequestAsync ( string keypairName , CancellationToken cancellationToken = default ( CancellationToken ) )
997+ {
998+ Url endpoint = await UrlBuilder . GetEndpoint ( cancellationToken ) . ConfigureAwait ( false ) ;
999+
1000+ return endpoint
1001+ . AppendPathSegment ( $ "os-keypairs/{ keypairName } ")
1002+ . Authenticate ( AuthenticationProvider )
1003+ . SetMicroversion ( this )
1004+ . PrepareGet ( cancellationToken ) ;
1005+ }
1006+
9811007 /// <summary />
9821008 public virtual async Task < T > CreateKeyPairAsync < T > ( object keypair , CancellationToken cancellationToken = default ( CancellationToken ) )
1009+ where T : IServiceResource
9831010 {
1011+ if ( keypair == null )
1012+ throw new ArgumentNullException ( "keypair" ) ;
1013+
9841014 PreparedRequest request = await BuildCreateKeyPairRequestAsync ( keypair , cancellationToken ) ;
985- return await request . SendAsync ( ) . ReceiveJson < T > ( ) ;
1015+ var result = await request . SendAsync ( ) . ReceiveJson < T > ( ) ;
1016+ result . PropogateOwner ( this ) ;
1017+ return result ;
1018+ }
1019+
1020+ /// <summary />
1021+ public virtual async Task < PreparedRequest > BuildCreateKeyPairRequestAsync ( object keypairName , CancellationToken cancellationToken = default ( CancellationToken ) )
1022+ {
1023+ Url endpoint = await UrlBuilder . GetEndpoint ( cancellationToken ) . ConfigureAwait ( false ) ;
1024+
1025+ return endpoint
1026+ . AppendPathSegment ( "os-keypairs" )
1027+ . Authenticate ( AuthenticationProvider )
1028+ . SetMicroversion ( this )
1029+ . PreparePostJson ( keypairName , cancellationToken ) ;
1030+ }
1031+
1032+ /// <summary />
1033+ public virtual async Task < T > ListKeyPairsAsync < T > ( CancellationToken cancellationToken = default ( CancellationToken ) )
1034+ where T : IEnumerable < IServiceResource >
1035+ {
1036+ PreparedRequest request = await BuildListKeyPairsRequestAsync ( cancellationToken ) ;
1037+ var result = await request . SendAsync ( ) . ReceiveJson < T > ( ) ;
1038+ result . PropogateOwner ( this ) ;
1039+ return result ;
9861040 }
9871041
9881042 /// <summary />
989- public virtual async Task < PreparedRequest > BuildCreateKeyPairRequestAsync ( object keypair , CancellationToken cancellationToken = default ( CancellationToken ) )
1043+ public virtual async Task < PreparedRequest > BuildListKeyPairsRequestAsync ( CancellationToken cancellationToken = default ( CancellationToken ) )
9901044 {
9911045 Url endpoint = await UrlBuilder . GetEndpoint ( cancellationToken ) . ConfigureAwait ( false ) ;
9921046
9931047 return endpoint
9941048 . AppendPathSegment ( "os-keypairs" )
9951049 . Authenticate ( AuthenticationProvider )
9961050 . SetMicroversion ( this )
997- . PreparePostJson ( keypair , cancellationToken ) ;
1051+ . PrepareGet ( cancellationToken ) ;
1052+ }
1053+
1054+ /// <summary />
1055+ public virtual Task DeleteKeyPairAsync ( string keypairName , CancellationToken cancellationToken = default ( CancellationToken ) )
1056+ {
1057+ if ( keypairName == null )
1058+ throw new ArgumentNullException ( "keypairName" ) ;
1059+
1060+ return BuildDeleteKeyPairRequestAsync ( keypairName , cancellationToken ) . SendAsync ( ) ;
9981061 }
9991062
1063+ /// <summary />
1064+ public virtual async Task < PreparedRequest > BuildDeleteKeyPairRequestAsync ( string keypairName , CancellationToken cancellationToken = default ( CancellationToken ) )
1065+ {
1066+ Url endpoint = await UrlBuilder . GetEndpoint ( cancellationToken ) . ConfigureAwait ( false ) ;
1067+
1068+ return ( PreparedRequest ) endpoint
1069+ . AppendPathSegment ( $ "os-keypairs/{ keypairName } ")
1070+ . Authenticate ( AuthenticationProvider )
1071+ . SetMicroversion ( this )
1072+ . PrepareDelete ( cancellationToken )
1073+ . AllowHttpStatus ( HttpStatusCode . NotFound ) ;
1074+ }
10001075 #endregion
10011076
10021077 #region Security Groups
0 commit comments