如何使用aws java sdk通过通配符过滤?

时间:2017-04-13 12:45:20

标签: java amazon-web-services amazon-ec2 aws-sdk

我正在使用aws java sdk来描述带有请求的ec2实例:

.686
.MODEL flat, STDCALL

INCLUDE kernel32.inc        ; GetStdHandle, WriteFile, ExitProcess
INCLUDELIB kernel32.lib

INCLUDE user32.inc          ; wsprintf
INCLUDELIB user32.lib

NumberOfNumbers = 30        ; Number of random numbers to be generated and shown
RangeOfNumbers = 12         ; Range of the random numbers (0..RangeOfNumbers-1)

.CONST
    err_text db "ERR: RDSEED not supported.",10,0

.CODE
main PROC
    mov eax, 07h                        ; Check for availability (EAX=7, ECX=0) -> EBX.18
    xor ecx, ecx
    cpuid
    bt ebx, 18                          ; CPUID (EAX=07H, ECX=0H):EBX.RDSEED[bit 18] = 1 ?
    jnc err_exit                        ; No (RDSEED not supported) -> err_exit

    mov ecx, NumberOfNumbers            ; Loop counter - generate and show ECX random numbers
    LL1:
    push ecx                            ; Preserve loop counter

    @@:
    db 0Fh, 0C7h, 0F8h                  ; rdseed eax
    jnc @B                              ; Invalid number - try again

    ; Adjust EAX to the range
    mov ecx, RangeOfNumbers             ; Range (0..RangeOfNumbers-1)
    xor edx, edx                        ; Needed for DIV
    div ecx                             ; EDX:EAX/ECX -> EAX remainder EDX
    mov eax, edx                        ; Get the remainder

    call write_number

    pop ecx                             ; Restore loop counter
    loop LL1

    invoke ExitProcess, 0               ; Returncode = 0

    err_exit:
    invoke GetStdHandle, -11            ; Get STD_OUTPUT_HANDLE
    push eax                            ; Place for WriteFile.NumberOfBytesWritten
    invoke WriteFile, eax, ADDR err_text, LENGTHOF err_text, esp, 0
    invoke ExitProcess, 1               ; Returncode = 1
main ENDP

write_number PROC STDCALL USES ebx      ; printf ("%u ", EAX)
LOCAL numstring[20]:BYTE, NumberOfBytesWritten:DWORD
.CONST
    fmt db "%u ",0
.CODE
    invoke wsprintf, ADDR numstring, ADDR fmt, eax
    mov ebx, eax                        ; Preserve count of written bytes
    invoke GetStdHandle, -11            ; Get STD_OUTPUT_HANDLE
    mov edx, eax                        ; EAX will be used by the following INVOKE
    invoke WriteFile, edx, ADDR numstring, ebx, ADDR NumberOfBytesWritten, 0
    ret
write_number ENDP

END main

我如何使用通配符?

new DescribeInstanceRequest().withFilters(new Filter("tag:TagKey", "expectedTagValue"));

我如何过滤所有实例都有过滤器?例如:

new DescribeInstanceRequest().withFilters(new Filter("tag:TagKey", "expectedTag*"));

以上就是我的想法,这样做的正确方法是什么?

1 个答案:

答案 0 :(得分:0)

使用

new Filter().withName("tag-key").withValues(tagName);

其中tagName是您要过滤的标记。我用它来过滤快照,也适用于实例。