//snippet-sourcedescription:[GetCrawler.java demonstrates how to get an AWS Glue crawler.]
//snippet-keyword:[Java]
//snippet-keyword:[Code Sample]
//snippet-keyword:[AWS Glue]
//snippet-service:[AWS Glue]
//snippet-sourcetype:[full-example]
//snippet-sourcedate:[9/3/2020]
//snippet-sourceauthor:[scmacdon AWS]
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */

package com.example.glue;

import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.glue.GlueClient;
import software.amazon.awssdk.services.glue.model.GetCrawlerRequest;
import software.amazon.awssdk.services.glue.model.GetCrawlerResponse;
import software.amazon.awssdk.services.glue.model.GlueException;

import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.Locale;

public class GetCrawler {

    public static void main(String[] args) {

        String crawlerName = args[0];

        Region region = Region.US_EAST_1;
        GlueClient glueClient = GlueClient.builder()
                .region(region)
                .build();

        getSpecificCrawler(glueClient, crawlerName);
    }

    public static void getSpecificCrawler(GlueClient glueClient, String crawlerName) {

      try {
        GetCrawlerRequest crawlerRequest = GetCrawlerRequest.builder()
                .name(crawlerName)
                .build();

        GetCrawlerResponse response = glueClient.getCrawler(crawlerRequest);
        Instant createDate = response.crawler().creationTime();

        // Convert the Instant to readable date
        DateTimeFormatter formatter =
                  DateTimeFormatter.ofLocalizedDateTime( FormatStyle.SHORT )
                          .withLocale( Locale.US)
                          .withZone( ZoneId.systemDefault() );

          formatter.format( createDate );
          System.out.println("The create date of the Crawler is " + createDate );

      } catch (GlueException e) {
          System.err.println(e.awsErrorDetails().errorMessage());
          System.exit(1);
      }






    }
}

@@ -929,24 +929,73 @@
 le.glue;%0D%0A%0D%0A
+//snippet-start:%5Bglue.java2.get_crawler.import%5D%0D%0A
 import softw
@@ -1293,18 +1293,16 @@
 ption;%0D%0A
-%0D%0A
 import j
@@ -1453,16 +1453,63 @@
 Locale;%0D
+%0A//snippet-end:%5Bglue.java2.get_crawler.import%5D%0D
 %0A%0D%0Apubli
@@ -1839,24 +1839,75 @@
 ;%0D%0A    %7D%0D%0A%0D%0A
+    //snippet-start:%5Bglue.java2.get_crawler.main%5D%0D%0A
     public s
@@ -1997,32 +1997,36 @@
  try %7B%0D%0A        
+    
 GetCrawlerReques
@@ -2138,32 +2138,36 @@
 d();%0D%0A%0D%0A        
+    
 GetCrawlerRespon
@@ -2228,16 +2228,20 @@
         
+  
+  
 Instant 
@@ -2299,16 +2299,20 @@
         
+    
 // Conve
@@ -2344,16 +2344,20 @@
 e date%0D%0A
+    
         
@@ -2592,16 +2592,18 @@
         
+  
 formatte
@@ -2623,24 +2623,26 @@
 ateDate );%0D%0A
+  
           Sy
@@ -2856,25 +2856,61 @@
  %7D%0D%0A
-%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A    %7D
+   %7D%0D%0A    //snippet-end:%5Bglue.java2.get_crawler.main%5D
 %0D%0A%7D%0D

Update GetCrawler.java